Samsung TV Toggling instead of turning off

I have an automation that runs turning off my lights and TVs, until recently this has worked fine. However, it has started toggling instead of turning off.
One TV works fine, the other “media_player.65_qled_3” is the one with the problem. Any ideas?

The code is as follows:

alias: Turn Off Interior Lights and Media
description: ""
triggers:
  - entity_id:
      - input_button.goodnight
    trigger: state
conditions: []
actions:
  - data: {}
    target:
      entity_id:
        - light.large_lounge_sideboard_lamp_hue
        - light.large_lounge_zone
        - light.large_lounge_window_lamp
        - light.mezzanine_lamp
        - light.garden_room_table_lamp_2
        - light.hue_small_lounge_window_lamp
        - light.hall_under_stairs_lamp_2
        - light.large_lounge_back_corner_lamp
        - light.hue_smart_plug_1_2_small_lounge_corner_lamp
    action: light.turn_off
  - data: {}
    target:
      entity_id:
        - media_player.samsung_q60_series_43
        - media_player.65_qled_3
    action: media_player.turn_off
  - delay:
      hours: 0
      minutes: 0
      seconds: 10
      milliseconds: 0
  - action: light.turn_off
    metadata: {}
    data: {}
    target:
      entity_id: light.hue_hall_table_lamp
mode: single

Hello

I would consider giving those things the same label, then turning off the label with homeassistant.turn-off action…

then if lights come or go you can give them the label or remove the label and you don’t have to code anything. Or if something is a switch or a window shade, that action will still work.

Thanks, I have tried that, but it still toggles. The code I have used is:

  - action: homeassistant.turn_off
    metadata: {}
    data: {}
    target:
      label_id: samsung

I have opted for an If-Then loop to resolve this as I can’t see a way around it. I suspect it started when the TV received a firmware upgrade last month.

 - if:
      - condition: state
        entity_id: media_player.65_qled_3
        state: "on"
    then:
      - action: media_player.turn_off
        metadata: {}
        data: {}
        target:
          entity_id: media_player.65_qled_3