Keep Philips Hue state after power toggle

For anyone interested i made a small python script that keeps the last state of the light bulbs after they loose power. It can be found here:
https://www.cron.dk/keeping-state-of-philips-hues/

Comments are welcome :slight_smile:

Best regards,
Alex

2 Likes

What happens if the homeassistant on the pi also loose power?

Power loss is extremely rare in my country, so I don’t take that into account… It’s much more likely that someone touch the physical switch on the wall :slight_smile:

But the script could easily be rewritten so it saves the state on disk/ssh.

Best regards,
Alex

For anyone interested I made the script into an Appdaemon app here:
https://www.cron.dk/keeping-state-of-philips-hues-in-appdaemon/