I have a few Hue light bulbs integrated in HA using Zigbee2mqtt and a CC2531 usb dongle.
The light bulbs are still actionable using the wall switches, which is fine for wife and kids
I would like HA to update the bulb state when the light bulbs are switched OFF or ON from the wall switch.
Is there any way to do that ? Either by telling Zigbee2mqtt to retreive the state every few seconds, or by checkign the state using a special mqtt topic ?
I don’t think this is possible because if you switch the light off from the wall switch it doesn’t have power anymore and therefore it’s state is “unavailable” and not “off”. This way you cannot know what the real state of the light is when it says “unavailable”, because it could also be that the bulb is “on”, but there is some problem with your system and it shows as “unavailable”
Generally speaking, I don’t think it’s a good idea to switch the lights with the wall switch and cut power to them, this should only be used when home assistant is down in my opinion. I have Hue Dimmer Switches next to the wall switch, which control the lights. I just told my wife to only use the normal wall switch if the Hue Dimmer Switch doesn’t work.
I’m pretty sure my Tradfri power outlets report their status every now and the, but not sure if it’s Zigbee2mqtt that interrogates their status every X minutes or it’s built in directly in the Tradfri outlets.
I know if I check the topic zigbee2mqtt/[FRIENDLY_NAME]/get it will return the current status if the light bulb has power (switched on from the wall switch), and if it doesn’t respond that could probably mean the light is turned off from the wall switch.
What I’m interested in here is to power off the light (stairs lights, corridot lights) if it’s powered on for a certain amount of time.