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?


You can decrease the timeout of the devices to maybe get them to show as offline faster. Thread about it here.