Lights Automatically Turning Off After Being Switched On – Only When Home Assistant Is Running

Hi everyone,

I’m running into a strange issue with my Home Assistant setup and would really appreciate some help.

Some of my light entities – specifically those coming from Shelly and Govee integrations – are not working correctly. Here’s what’s happening:
• When I turn the light on (either using the physical switch or in the HA UI), it immediately turns off again.
• This behavior only occurs while Home Assistant is running.
• If I stop Home Assistant completely, the lights behave normally – they can be turned on and stay on.
• I’ve disabled all automations, so nothing should be turning them off via logic.
• I’ve also tried a fresh configuration and a full HA restart, but no change.
• It feels like Home Assistant is sending some sort of “off” command right after I turn the lights on.

Any ideas on what to look for or how to debug this would be greatly appreciated. Thanks in advance!

Take a look at the device history (logbook), it should say what turned the light on/off.

You’ll need to go to the device page:

I’m sorry Dave, but I can’t let you turn that light on. :smile:

1 Like

After a reboot, the issue disappeared for now, but I suspect it will come back soon.

In the logbook, I can see that the light is turned on by action XY, and then almost immediately turned off again by the same action. So it doesn’t look like any automation or external trigger is turning it off — it seems like the same action is responsible for both turning it on and off.

Does anyone have an idea what could be causing this or how I could dig deeper to debug it?

Please share the logbook entry detailing the action?

Something is turning it back off. What action/service are you using?

I also experience this, in random and weird ways with zigbee lights. I cant track down what is causing the lights to turn off, randomly, but only after the devices receive an ‘on/toggle’ command.

Are your lights also zigbee?

Did you ever find a solution for the issue?

I am experiencing the very same with Tuya TS0505B_1_1 and Tuya TS0505B_1 bulbs: If switched to ON the bulbs are switched back OFF again some milliseconds later. No automation is involved:

The bulbs are only controllable (can only be switched to ON) when using the slider for setting the brightness. ON through light.turn_on or through the switch on the light card does not work.

What physical switch are you using to turn these on and off ? Sometimes you can get strange behaviour with rocker style switches.

Iirc, this was happening with someone in the forums (ages ago) who also had a switch module that was controlled by a pull cord, where it would need a weird double pull to get it to stay on.

One of my cheap Tuya pushbuttons recently developed a fault where it would trigger action events without anyone touching it. Light would turn on and off randomly. Try disabling the switch that controls this light and try triggering the light on via the HA interface. If it doesn’t turn off then, it’s probably the switch.

Another thing that might be happening is that the lamp doesn’t update the state of the light being on correctly, so the state comes back as “off” to HA which then prompts the light.turn_off cal for consistency. This was happening to some of my Tuya wifi lamps, but went away without me doing anything special.

None. The lamp is directly connected to the AC outlet without any switch inbetween.

What’s weird is that I can control the bulb(s) through the light card in Lovelace by going to “Brightness” and slide the slider up. With this the bulb gets switched to ON. It’s just the ON/OFF function which doesn’t work for “switch to ON” while switching the bulb to OFF is working.

Edit: I have just rechecked through Developer Tools → States. If I hit the Light ON button the state of the bulb changes instantly to “on” for a brief moment but goes back to “off” instantly. Thus I don’t think it is a state issue.

Just out of curiosity, does it work if you simultaneously have the Govee/Shelly app open? Can you control them from their manufacturer apps without an issue? Does the state in the app gets updated between HA and the app if you trigger them to on via the app/via home assistant?

These are Tuya-Zigbee bulbs and I purely control them through HA without any manufacturer’s app. I am looking to order another LED bulb now without that Tuya label to see whether it’s the firmware which is buggy.

Ah sorry, I have confused you with @kaikl2023

For zigbee lights there are a lot of cheap ones with bad transitions and/or badly implemented software around. For example, I have some gledopto bulbs that are unable to process a light.turn_oncall if it also contains brightness and/or color parameters. I also had a lamp by tint (lidl) which actually refused to turn on if you set the brightness to <27%. You had to first set the brightness to something higher for it to turn on properly. Which kind of sounds similar to your experience.

IMHO, there is a reason philips hue can ask the prices they ask - the experience is nearly flawless. The only other lamps that come close are Innr, at least after applying the OTA updates via z2m

1 Like

That seems to be it! Since I am using that lamp as a night light the brigtness is set to only 3 (1%) and color_temp_kelvin to 2000. I will play with it and see the results. Thank you for pointing me to that direction :+1:

Additionally I will look for Hue bulbs to replace those cheap crapware bulbs.

Glad I could help!

For a night light, a Hue bulb is probably the best choice as they has the lowest brightness at 1% I know of. Using E14 color bulbs set to 1% + red for the darkest result myself. It also doubles as a wake-up light.

If I was on a budget, I’d take the Innr E14 adjustable whites, after a firmware update their minimal brightness reduced considerably, because they only turn on the warmest LEDs. The lamp itself appears yellow, but the light itself is not unpleasant by far.

I have changed the automation for the night lamp to switch to ON with a initial brightness of 28% and after a short delay it should dimm down to 1%. Will let you know tomorrow whether this is working as expected.

Nevertheless I will look into the Hue bulbs. Thank you again for the hints :+1:

To follow-up on the latter although I tried with different automations (i.e. turn ON at full brightness and then gradually dimm down to 1%) these Tuya Zigbee bulbs are a real PIA to control through HA/Z2M. I can not recommend them, at least not when used with Z2M (Idk whether they work better with ZHA):

  • Tuya Zigbee 3.0 18W led light bulb E27 RGBCW, TS0505B_1_1 (Zigbee-Model: TS0505B, Zigbee-Manufacturer: _TZ3210_r5afgmkl, Firmware: z.1.0).

As you recommended I replaced that bulb with a Hue 60W A19 - E26, Model 810. Not really a bargain but then again: You get what you pay for. I’m very pleased with it, pairing was a breeze and all is working as expected. These are even dimmable to 0.2% brightness :laughing:

Lesson learned, no cheap cn led bulbs anymore in the future!

1 Like

I’m mostly using ikea bulbs these days, not necessarily because of any strange behaviour, but I experimented with a couple of tuya bulbs and the whilst the white modes were fine, the colour LED’s were barely brighter than a night light.

The only downside of the ikea bulbs is (was?) that when set to yellow, they come out with a distinct green hue.