How best to update ZHA lights that are powered off at mains, so that they can be reconfigured when they return to life

Hi,

I have been using HA for a while, but only starting with lights. For this purpose I have a ConBee II stick and am running ZHA. I have little experience with Zigbee, since the rest of my system is mostly on ZWave.

I have bought a few Zigbee bulbs to put in some existing dumb lights. Realistically, I am not going to change my wall switches to be virtual and hot wire the bulbs any time soon, so I am happy to have the lights disappear from HA when they are switched off at the mains and not be able to operate them then.

However, I would like to be able to automatically change the target state of the bulb when it is eventually turned on, so that when it comes back into HA, it would be reconfigured to this target state. E.g. the light in the bathroom should have low brightness at night, but go back to full brightness during the day.

Is there a smart way of setting this up?

Right now I am thinking of having one automation change the value of some brightness number helper at bedtime and morning and having another automation trigger whenever the light reappears in HA (what’s the right thing to look for here?) and to send the helper’s current value to the brightness of the light. Is there a smarter way to do this, and more efficiently than coding this one by one for each light?

One problem is that the lights do not become unavailable immediately, but rather follow the general device timeout setting. I could change that from its default 7200s to something like e.g. 60s or less, but this may have some adverse effect on the network?

I am willing to convert to Zigbee2mqtt or DeConz if that makes more sense.

I use the custom_component ‘Adaptive Lighting’ for this kind of purpose.

You can install it using HACS and you need to add it as many times as an integration as you want to setup separate controls.
I recommend to not add a configuration manually, but use the configuration from the Integrations page.

You may be happy, but, depending on which bulbs you choose your Zigbee mesh is going to absolutely HATE life. Its not designed for devices to pop in and out like this. IF you do this (and i reccommmend you dont) make sure you specifically choose bulbs that DO NOT act as zigbee repeaters like the Sengleds… Otherwise your routing infrastructure will take the hit when thr bulbs go offline and the entire zigbee mesh can destabilize.

Better choice is to not allow a mains power cut and/or dont use bulbs in those circuts.

1 Like

Blockquote
I use the custom_component ‘Adaptive Lighting’ for this kind of purpose.

This is great. Thanks!

In that case, what is the reasonably-priced alternative for the wall switch? The only thing that seems to be a good technological solution is something like the Phillips Wall Switch module, but this seems very expensive for what is a remote controller without a faceplate. Is there something similar that would be better priced?

If I were to hotwire the lights and install a remote of some kind in the switch box, I would rather it were possible to control the lights without HA in between. Is that possible with Zigbee? Or is there no equivalent of the ZWave associations here, and the Zigbee network dies if there is a power failure at the coordinator device in any case?

In any case, something like Shelly i3 → ESPHome → HA → ZHA → Conbee → Lightbulb has too many points of failure for something as basic as the light (although the price is good).

A Sonoff ZbMini, bound directly to your bulb.

But isn’t that a relay, so would power down the lights? Or can one use it without a load connected to it at all?

This. Then it just sends commands to the bulb.

The problem is that this supposes that you have Phase and Neutral available near your switch or that you can wire the Zigbee mains powered relay where it is powered while still getting the command from your switch.

I was able to do the latter in one case as I had access to the electrical boxes where the light’s power and the switch wiring came together, but not in another location.

A battery powered button may also be a solution, but then you have to change the battery every few years. There are also zigbee switch boxes with 4 switches - I haven’t tried them yet - they can be used to control different stuff or define scenes.

I am also switching of zigbee lights and I do not have that much trouble with the zigbee network (at least I can’t notice any).

Thankfully my building is 10 years old, so neutral is available. Still, putting in a relay is a bit of a waste if all you want is to repurpose the light switch as a remote. It means that the Sonoff zbMini is bigger than it needs to be for my purpose: about 17 mm thick and 42mm wide – I have managed to put Fibaro ZWave relays in the switch boxes in a few places, but an electrician would not approve the mess that I made because of the lack of space. And they are significantly smaller than the Shelly.

Frankly the Shelly i3 seems like a great thing (10 mm thick), except it is wifi and I am trying to keep IoT off my WiFi to the maximum extent and I don’t really want to have my lights be unavailable if the router or HA server decides to reboot/dies.

Groan – I guess Philips will inspire some competition eventually, so probably after I give up and get those Modules, something cheap will appear on the market.

1 Like