How to ensure lights turn off


I have one node sensing command to HA to turn off all lights. I have some HUE lights, some switch components and MySensors lights.

The problem is that sometimes all of them does not turn off. Is there some sophisticated way to turn off remaining lights that did not turn off the first time? Especially HUE and MySensors tend to leave something on.

All I can think of is to call a script after the automation. Then turn off once more all lights after some time delay. But is there another way?

I used to have this problem when my Zwave network had some issues. I fixed those and now don’t need it.

I wrote a script to turn off a light or group of lights; wait 30 seconds and check if off; and if not off repeat this loop for up to 5 tries. That was a suitable work around to my issue.

But again this typically indicates an underlying connectivity issue that you really want to sort out – they tend to get worse as you add more devices.


Then it is only the thing what to do as I have no idea.

Is there some tool to diagnose what is happening between HUE lights? Are they getting the commands or where the message is lost? For example in the kitchen lamp I have 5 individual E14 hue bulbs. And again, only 4/5 have been turned on and one is off. The bulb for sure is not 100% dead. It is quite random which one doesn’t work.

Then the MySensor network is its own story. Well the network itself seems fine and works good. It is the connection between the MySensors gateway and HA. I have one nrf24 radio connected to raspberry and have compiled the ethernet gateway. If I disconnect HA and start the gateway in debug mode, everything works really snap. But when HA connects to the gateway it becomes slower and sometimes unresponsive.

Anyway, the MySensors I have been thinking to integrate somehow to talk to MQTT instead of ethernet gateway to HA. I think that would solve that issue. And currently if HA is connected to this gateway it takes minutes to shut down HA and in the end go to fail state. Also making the restart button not work from the front end.

Try setting them into a light_group and see if turning it on/off works reliably?

1 Like

I never understood the benefit of that. At least in my case when I have only similiar lights in one group. In this case those HUE ambience lights. The normal group can set the temperature and brightness as well.

I was reading the hue component page about the hue groups. Maybe that is more likely the problem that I make 5 api calls to kitchen lights. Need to test how the syntax works setting brightness in hue groups. There werent an example at the component page.

I’ll post later how it works. Thanks for the effort of helping :slight_smile:

I’ve had this issue with my LimitlessLED’s occasionally when I move the bridge to my office. When the bridge is central the lights don’t fail. When in office they do. So I’d suggest trying another more central location for your bridge.


The MySensors mqtt gateway works fine. I have it running on a Wemos D1 mini rather than the Pi. I can’t say about the MySensors component though, as I create MQTT sensors directly in my configuration.yaml.

1 Like

@DavidFW1960 I didn’t move the bridge yet but figured out how the LightGroup works. Seems to be more reliable way to switch multiple HUE lights.

@gpbenton Good to hear. Have to haste the plan to switch over MQTT gateway. I’ll test ride it first in the PI as the radio is already connected there.

Yes, we often forget that Zwave and Zigbee are SLOW networks so when we hammer them in rapid fire things might get delayed.

For example I had a “all lights on” script for emergencies. But all it did was melt down the zwave network for several minutes with very few lights coming on quickly and the rest coming on over the next 10 minutes. So I changed it to turn on groups of 4 lights with a 5 second pause between groups and it works nicely now.