1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-27 21:23:48 +00:00

light: add RESTORE_AND_OFF/RESTORE_AND_ON LightRestoreMode (#3238)

This commit is contained in:
Niorix
2022-02-21 06:52:14 +07:00
committed by GitHub
parent ba785e29e9
commit 771162bfb1
3 changed files with 10 additions and 0 deletions

View File

@@ -68,6 +68,12 @@ void LightState::setup() {
recovered.state = !recovered.state;
}
break;
case LIGHT_RESTORE_AND_OFF:
case LIGHT_RESTORE_AND_ON:
this->rtc_ = global_preferences->make_preference<LightStateRTCState>(this->get_object_id_hash());
this->rtc_.load(&recovered);
recovered.state = (this->restore_mode_ == LIGHT_RESTORE_AND_ON);
break;
case LIGHT_ALWAYS_OFF:
recovered.state = false;
break;