Bug in automation with light

Hello dear Community,

I have a flaw in my automation which drives me crazy.

Setup:
Light bulb (“Schreibtisch”): _TZ3000_49qchf10, modell TS0502A1 I bought from Lidl (Silvercrest)
Light bulb is in lamp which is plugged in to a smart switch
Smart Plug (“Schreibtisch Christoph”): Plug Z3 from LEDVANCE
group.alle contains 2 persons (me and my wife)

Both light bulb and plug are connected via Zigbee to the hue bridge
Both can be controlled flawlessly via hue app and Home-Assistant

I have an automation which switches off all lights when the last person leaves the house → works as intended
I have another automation which turns on the smart plugs when somebody comes home → works as intended

Now, when the smart plugs are turned on, the light (Schreibtisch) is connected to electricity again and by default is turned on. Since this lamp is not supposed to be turned on everytime someone comes home, I added to the automation, that the light is turned off again.

The automation looks like this:

alias: Anwesenheit_Schalter an
description: ""
trigger:
  - platform: state
    entity_id:
      - group.alle
    to: home
    from: not_home
condition: []
action:
  - service: light.turn_on
    data: {}
    target:
      entity_id:
        - light.schreibtisch_ilka
        - light.schreibtisch_christoph
        - light.tv_avr
  - service: media_player.turn_off
    data: {}
    target:
      device_id:
        - 46f09b690daa47a88da346adf7e3ed8e
        - 1d47d6a24cbe3d0e54fdf53b859c69b4
  - delay:
      hours: 0
      minutes: 0
      seconds: 3
      milliseconds: 0
  - service: automation.trigger
    data: {}
    target:
      entity_id: automation.schreibtischlampe_aus
  - service: light.turn_off
    data: {}
    target:
      entity_id:
        - light.fernseher
        - light.color_temperature_light_1
      device_id:
        - d710266a85a3711f9366775d43a61952
        - e18165158f8780e4433e1994f59a0825
      area_id: arbeitszimmer_christoph
mode: single

Whenever I trigger this automation manually, the light bulb is on and turns off after the 3 seconds (–> works as intended)
However, when the automation is triggered by the actual trigger (somebody comes home), all plugs are turned on, but the light bulb is not turned off again.

Things I already did to address it (none of it worked though):

  • build separate automation which only turns off the light buld and which is triggered by the first automation
  • deleted the light bulb from Hue app and re-connected it

Things I thought about which might be a problem:

  • Switching off different entities&devices in the same service
  • The light bulb maybe needs some seconds to initially connect to the Zigbee hub. I set the duration from 3 to 30 seconds as a test, but it didnt change anything. Also, when triggered manually, it also works with 3 seconds delay.

I don’t know how to fix it. Maybe it is a bug in the light bulb?
Would really appreciate further hints :slight_smile:
Thank you and best regards
Christoph

Hi.
Although the strange idea to switch smart bulb on/off, there should be settings for power on behavior of the bulb.
How to do with hue bridge, I don’t know but there are screenshots of the zigbee2mqtt screens with similar lidl bulb (TS0502A).


1 Like

Thank you for your reply!
That was one of the solutions I also thought about. However, in the Hue app as well as the Hue Essentials app, you can only configure this for Hue-original-bulbs, not for 3rd party bulbs. So unfortunately this does not solve the problem.

And yes, I agree, it is not necessary to have a smart bulb plugged into a smart switch. In my scenario the bulb is plugged into a multi socket which is mounted to my standing desk. In this multisocket there is also the motor of the desk, my laptop, my monitor etc. which I want to have turned off when I am not home. If the bulb was plugged to a socket in the wall, the wire would be too short if the desk goes up.