this post was submitted on 17 Dec 2025
17 points (100.0% liked)

homeassistant

17171 readers
2 users here now

Home Assistant is open source home automation that puts local control and privacy first.
Powered by a worldwide community of tinkerers and DIY enthusiasts.

Home Assistant can be self-installed on ProxMox, Raspberry Pi, or even purchased pre-installed: Home Assistant: Installation

Discussion of Home-Assistant adjacent topics is absolutely fine, within reason.
If you're not sure, DM @GreatAlbatross@feddit.uk

founded 2 years ago
MODERATORS
 

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 are viewing a single comment's thread
view the rest of the comments
[–] passenger@sopuli.xyz 7 points 2 days ago* (last edited 2 days ago) (1 children)

The right answer: enable the online/offline detection in zigbee2mqtt. I forget the name of the setting though (edit: it's called availability). This might increase power consumption on some battery devices. You can then check if devices are available in your scripts and ignore their state if not.

It has a delay until offline state is detected, the delay can be tweaked as far as I know, but is a tradeoff with battery powered devices consumption.

[–] Kirk@startrek.website 1 points 1 day ago (1 children)

Helpful! Thank you I will look into it.

[–] passenger@sopuli.xyz 2 points 1 day ago* (last edited 1 day ago)

To add, I found some old Philips switches might have reacted badly to this, because they drained battery super fast afterwards. Like a month or two. I switched them all to cheap Ikea switches which work as usual and drain very slowly. All working nicely and I can make toggle buttons work like you described even if some lights are cut off from power.

But yeah there might be problems with certain devices and drain.