Automatic turn on the power switch when the bulb is turning on (zigbee) - best way in HA?

Hi,

In my configuration I have zigbee wall switch controlling the physical power of four zigbee bulbs.
Separately each of those devices can be accessed and controlled by my Home Assistant instance.

What is the best approach with Home Assistant to script functionality to turn automatically the wall switch on, whenever other parts of the system are trying to turn on the bulbs (each of them or as a group)?

Simply adding an Automation triggered by the device bulb when it’s ‘on’ does not work, since (most likely) the bulb is not powered yet, so it does not react to the command to turn on and, efectively, its state does not change from off to on. Is there a way to “hook into” command like 'turn on the device' to perform beforehand some extra actions?

Thanks!
Paul

If the light only has abonary state, without dimming/rgb, a workaround might be to have an input_boolean and use that instead of the light. Then you can have an automation that triggers on the state change and in turn makes sure the power is turned on, and after a startup delay turn on the light itself.

When using ~lovelace~ the dashboard, you could use conditionals to display the input_boolean when the light is off, and show the actual light entity when it’s on

Thank you Kenneth. That’s some idea.

Of course, I wish to keep fulll light functionality, including exposing this light to external services like Alexa/Google.

I was examining MQTT path - is there a way to setup HA so it posts its commands to the MQTT?

Most simplistic solution would be to not use the physical switching function of the wall switch.
Just constantly power the bulbs and let HA do the switching via Zigbee based on any source including the Zigbee wall switch.

Very late to the party, but I ran into the same issue, and found a fully functional but somewhat clunky workaround. I use z2m, and noticed that when I create an automation that turns on a z2m group with the bulb in it, I can activate the wall switch (where acting on the bulb itself won’t work).

So the solution would be to create a z2m group for each bulb that is controlled by a switch that physically cuts the power to it, and use the group in all automations in stead of the actual bulb. This group carries all features of the bulb, so the issue with losing light functionality should be resolved.

Now on to the next issue: when the switch is turned on, all the lights connected also turn on, not only the one that I enabled…