Create a switch to run different scenes when turned on and off?

I think I’m running into similar problems, I can press once and it seem to activate the scene but it seem to reset the scene state to off even tho its the good one playing. when I press again , nothing happen (probably because its trying to re-do the same scene).

here is what my template looks like:

- platform: template
    switches:
      my_cinema_scene:
        value_template: "{{ is_state('my_cinema_scene', 'on') }}"
        turn_on:
          service: scene.turn_on
          data:
            entity_id: scene.cinema
        turn_off:
          service: scene.turn_off
          data: 
            entity_id: scene.cinema_off

any ideas?


Try changing the type of switch from a toggle to the other kind (can't remember what it's called). Add this in customize.yaml
switch.my_cinema_scene:
  assumed_state: true

Also, for `scene.cinema_off` you should be turning it on (`service: scene.turn_on`), not `service: scene.turn_off` I think.

there is no scene.turn_off service. change that to on

sorry im reviving an old thread but I still haven’t completely figured it out.
here what I have now:

- platform: template
  switches:
    cinema:
        friendly_name: "Cinema Scene"
        value_template: "{{ is_state('switch.cinema', 'on') }}"
        turn_on:
          - service: scene.turn_on
            data:
              entity_id: scene.cinema
        turn_off:
         - service: scene.turn_on
           data:
             entity_id: scene.cinema_off

if I use my switch fast enough I will be able to trigger one scene or the other but the switch.cinema state isn’t changing (or maybe is being reset?). So the entity switcher will always go back to OFF.

any idea there?

There was a change to scenes a few months ago that made them stop working a lot of the time for me (can’t remember the technical details), and I ended up changing all of switches like these to run scripts to instead of scenes.

They all work fine now, so it could be worth trying to rewrite this with scripts to see if it works better?

I found an alternative, I created a toggle switch helper, used it in node red so I trigger each scenes.

Sorry to refresh the topic - but not sure after reading all the comments - how can I setup the scene and switch to show the real state of the switch (on/off). Every time I click on the newly created switch - it shows on for 3 sec, and come back to off. That way - I do not have current status if switch is still on or not…

thanks!

switch:
  - platform: template
    switches:
      my_scene_switch:
        value_template: "{{ is_state('my_scene_switch', 'on') }}"
        turn_on:
          service: scene.turn_on
          entity_id: scene.my_scene_on
        turn_off:
          service: switch.turn_off
          entity_id: scene.my_scene_off

I tried all of them but none of them worked for me.
it works fine as below

switch:
  - platform: template
    switches:
      vantilator_aydinlatma: 
        turn_on:
          service: scene.turn_on
          entity_id: scene.aa3tyxrcpuasd3gd
        turn_off:
          service: scene.turn_on
          entity_id: scene.araakt5uqv1urei3