Any one know how I can save and restore some specific switches states so when I restart HA they are restored back to what they were?
I looked at Recorder, but no luck there. There’s some very hacky python scrips from 2018 that I am not sure will work now, nor I know how I would get them working.
I am using Switchbot for my button presser, the app itself has a “on/off” state (for light/rocker mode), but I do not believe it is exposed. I am merely using IFTT to trigger the button presser.
I also have one to turn on/off appliances that need a on/off state (switchbot has a simple press mode), if HA is restarted and the state not restored, it can cause automation to do dangerous things, which is why I am looking for a way to store the last state of a switch, and restore them upon HA restart…
If Switchbot can’t report the device’s true state, it seems like a spectacularly bad idea to use it for an application that can produce a “dangerous” outcome.
Saving the switch’s state in an input_boolean provides no guarantee that, after a restart, the input_boolean’s state matches the switch’s state. There’s a better chance it does but it won’t be if, for example, the switch is manually toggled while Home Assistant is restarting.