Erroneous triggering of automation

My scenario is I have a TV lamp OFF and a hall lamp ON. When I switch on my Samsung TV I want to toggle the lamps if the hall lamp is ON (glare on the screen…)
This is the only automation that switches ON the TV lamp I have another sunset based automation for putting ON hall lamp and a time of day based automation for switching OFF the hall lamp

Twice now (this is the fist evening having this automation enabled) the lights have toggled with the TV off.

- alias: Night_Lights toggle with TV on
  trigger:
  - platform: state
    entity_id: media_player.livingroom
    to: 'on'
  condition:
    condition: state
    entity_id: switch.lamp_hall
    state: "on"
  action:
    - service: switch.turn_on
      entity_id: switch.lamp_living_tv
    - service: switch.turn_off
      entity_id: switch.lamp_hall

Finally Logbook show no triggering as per all my other automations and when I switch the TV on it updates Logbook and toggles lamps fine.

Any ideas?

Try triggering from off to on. It may be triggering on unavailable to on.

Cheers, will give it a go

There must be packets being sent from the TV that HA it interpreting as on/off as the bowser logbook shows is happening many (many) times a day. As it’s an official integration im not sure if there’s any logging to see what is being sent v’s real power button presses. I have just disabled auto add new Samsung devices (the only option for this integration) to see if that helps.

My TV does the same, it’s set (in firmware no doubt) to check for firmware and app updates.
I now only run automations when the TV comes on, IF other conditions are met.
Currently this is : -

  1. The house is occupied
    And one of the following
    2a. Lamp a on or
    2b. Lamp b on or
    2c. Lamp c on

You’ll just have to find your own conditions
Edit: This is not meant to detract from Tom’s post. Being specific with from ‘off’ to ‘on’ REALLY cuts down on ‘unexpected’ tiggering

1 Like