Question about Scenes, and how to force a switch off with one

Hey guys,
I have set up a “Goodnight” scene, which does a bunch of stuff before i go to sleep.

One of this things is make sure my TV is off (through IR).

Unfortunately, as i turn on the TV with multiple ways, HA rarely knows the true state of it.

So sometimes, when i run the scene, the TV switch is already off (although the TV is on) and HA ignores the scene entry.

Is there some way to force send the OFF IR command every time the scene runs?

Perhaps create a template switch that will run the same script on on/off and have the scene toggle it every time? But that sounds dumb, any smarter way?

I should say that i have separate IR codes for on/off and that i also tried having HA run a script as part of a scene but it didnt work. I guess there’s the solution to turn the whole scene into a script but i’d like to avoid that.

Any ideas?

Use a script instead of a scene. That way you can ensure you call the switch.turn_off service.

Scenes are just interpreted into scripts anyway. In a scene you specify a state and home assistant works out what service to call to get that state. If you do the interpreting there is less chance for ambiguous results, especially if your switches have no state feedback.

1 Like

but… i’ll lose the nice scene UI functionality :slight_smile:

Pfft. UI. Schmooeye. :stuck_out_tongue_closed_eyes:

Everyone should be forced to edit their config with ed.

1 Like

Despites you making fun of me, i went the “template switch” way :slight_smile: :

  - platform: template
    switches:
      up_lr_samsung_tv_reverse_off_force:
        value_template: "{{ is_state('switch.receiver1' , 'off') }}"
        turn_on:
          service: homeassistant.turn_off
          entity_id: switch.receiver1
        turn_off:
          service: homeassistant.turn_off
          entity_id: switch.receiver1

This switch is set to On whenever the dumb tv entity on HA is off, so by having the scene turning both off when leaving, im sure the tv will turn off.

Separate IR on and off codes are required for this btw.