I have a button that triggers a script for bedtime to turn off all lights, and, if pressed again, checks to see if all lights are off and if so, turns a few (like the bathroom light) on.
My problem is one or two of the lights (connected via Zigbee2Mqtt) are often powered off at the switch on the lamp, meaning HA still sees them as “on” until the power is restored and they can be turned “off” via the app. The lights cannot be turned “off” (in HA) manually.
Is there any good solution for detecting when a light goes missing and turning it “off” in HA?


I’d say it’s always best to avoid Zigbee devices going offline, its neither convenient for automation or good for the mesh for devices to keep dropping.
This might be true for the majority of cases, but it really depends on your mesh network, what devices drop and your needs. It works perfectly in my case.