Unexplained TV triggered an automation

I have a automation to turn the lights on after watching TV at night. Last night after watching TV the light turned on as expected and I went upstairs turning the light off with my HA mobile app. A few minutes later the light come back on. It was triggered by the TV which I double checked was not on. Any idea on what caused the TV to trigger the automation?

alias: Dim Light in FR TV on
description: Dim Light in FR TV on at night
trigger:
  - platform: state
    entity_id:
      - media_player.sony_xr_75x90k
    from: 'off'
    to: 'on'
    id: TV_On
  - platform: state
    entity_id:
      - media_player.sony_xr_75x90k
    from: 'on'
    to: 'off'
    id: TV_Off
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - TV_On
          - condition: numeric_state
            entity_id: sun.sun
            attribute: elevation
            below: 2
        sequence:
          - service: scene.create
            data:
              scene_id: Before TV
              snapshot_entities:
                - light.switch_familyroom
          - service: scene.turn_on
            target:
              entity_id: scene.fr_20
            data:
              transition: 4
      - conditions:
          - condition: trigger
            id:
              - TV_Off
        sequence:
          - service: scene.turn_on
            target:
              entity_id: scene.fr_100
            data:
              transition: 4
mode: single

FR Xmas Trigger

Look at the trace for that automation at that time; it should tell you exactly why it triggered.

It looks like after the tv was turned off at 10:45 it had an addition turn off state that occurred again at 10:52. Not sure why the state changed from on to off the second time at 10:52 with no one touching the remote?


You can look at the TV entity and it may give you a hint. Either it will give some detail about something in HA that turned the TV on/off or it won’t, which just means the TV reported the changes on its own.

i use a ping on tv ip adress and give me a binary sensor (on/off)

  - platform: state
    entity_id: binary_sensor.q9tv
    from: "on"
    to: "off"
    for:
      hours: 0
      minutes: 2
      seconds: 0
    enabled: true

Interesting idea. I’ll give it a try. My main issue is that the TVs are on a different subnet and I have to figure out how to allow the ping in my PFSense firewall.

I know the issue is the tv went from off to on and triggered the automation I just don’t know why it did that after it was already off for a few minutes.