Fix saving light state for restore modes LIGHT_RESTORE_AND_OFF/ON (#4131)

This commit is contained in:
myhomeiot 2022-12-22 09:57:53 +02:00 committed by GitHub
parent 50e8e92f0b
commit 57a1c207c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -276,7 +276,15 @@ void LightState::set_immediately_(const LightColorValues &target, bool set_remot
void LightState::save_remote_values_() { void LightState::save_remote_values_() {
LightStateRTCState saved; LightStateRTCState saved;
saved.color_mode = this->remote_values.get_color_mode(); saved.color_mode = this->remote_values.get_color_mode();
switch (this->restore_mode_) {
case LIGHT_RESTORE_AND_OFF:
case LIGHT_RESTORE_AND_ON:
saved.state = (this->restore_mode_ == LIGHT_RESTORE_AND_ON);
break;
default:
saved.state = this->remote_values.is_on(); saved.state = this->remote_values.is_on();
break;
}
saved.brightness = this->remote_values.get_brightness(); saved.brightness = this->remote_values.get_brightness();
saved.color_brightness = this->remote_values.get_color_brightness(); saved.color_brightness = this->remote_values.get_color_brightness();
saved.red = this->remote_values.get_red(); saved.red = this->remote_values.get_red();