Initialize color temperature to value within range if possible (#2168)

This commit is contained in:
Oxan van Leeuwen 2021-08-17 04:02:38 +02:00 committed by GitHub
parent 9b48ff5775
commit 0c370d5897
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -39,6 +39,13 @@ void LightState::setup() {
effect->init_internal(this); effect->init_internal(this);
} }
// When supported color temperature range is known, initialize color temperature setting within bounds.
float min_mireds = this->get_traits().get_min_mireds();
if (min_mireds > 0) {
this->remote_values.set_color_temperature(min_mireds);
this->current_values.set_color_temperature(min_mireds);
}
auto call = this->make_call(); auto call = this->make_call();
LightStateRTCState recovered{}; LightStateRTCState recovered{};
switch (this->restore_mode_) { switch (this->restore_mode_) {