libretiny-eu / libretiny

PlatformIO development platform for IoT modules
http://docs.libretiny.eu/
MIT License
382 stars 55 forks source link

restore_mode not working #198

Open nedyarrd opened 8 months ago

nedyarrd commented 8 months ago

It looks like restore mode, or anything else what needs to be writen to persistent memory is not working. I have LSC bulbs flashed with LibreTiny ESPHome. When I try to set restore_mode it makes only "on" and "off" like stated, but don't remember last state and state of color temperature.

Cossid commented 8 months ago

restore_mode works fine on every device I have. "on" and "off" are not valid settings, see https://esphome.io/components/light/index.html?highlight=restore_mode. Additionally, settings are not saved instantly, by default, they are only updated every 60 seconds to avoid flash wearing. Additionally if you use anything like groups, they may be overriding the restored settings when they sync.

Edit: there are also quirks as to when save triggers when the mode changes, but the on/off state does not. You may want to consider calling the preferences save when you set the state you desire.