Turn Movie Scene On and off with Switch

Total noob here. I have 2 scenes. One that dims the lights for movie lighting and then goes back to normal lighting. I’d like to create a virtual switch that toggles between these two scenes. How do I do this?

Do a search for template switch.

On my phone can’t paste my one

It would be something like this :

  - platform: template
    switches:
      desktop_destiny:
        value_template: "{{ is_state('binary_sensor.movieplaying', 'on') }}"
        turn_on:
          - service: scene.turn_on
            data:
              entity_id: scene.movielightson
        turn_off:
          - service: scene.turn_on
            data:
              entity_id: scene.movielightsoff

1 Like

Thanks for the code. I can get it to do something but not what I want. Where I seem to be stuck is the value_template. I’m not sure how to evaluate the state of the lights. Do i put ‘(‘scene.movie’, ‘on’)’? I don’t have a sensor that detects what the state is. How do I do that?

Scenes don’t have a state, so you can’t track that. You could use an input_boolean to track which scene is on. Say you defined a input_boolean movieplaying

  - platform: template
    switches:
      scene_switch:
        value_template: "{{ is_state('input_boolean.movieplaying', 'on') }}"
        turn_on:
          -  service: input_boolean.turn_on
             data:
               entity_id: input_boolean.movieplaying
          - service: scene.turn_on
            data:
              entity_id: scene.movielightson
        turn_off:
          -  service: input_boolean.turn_off
             data:
               entity_id: input_boolean.movieplaying
          - service: scene.turn_on
            data:
              entity_id: scene.movielightsoff

OK. Here is my code. The first half seems to turn on the movie lights, but then the switch returns to the “off” position and won’t turn the scene back to “movie_lights_off”

switch:
  - platform: template
    switches:
      movie_lights_switch:
        value_template: "{{ is_state('input_boolean.movie_playing', 'on') }}"
        turn_on:
          - service: input_boolean.turn_on
            data:
              entity_id: input_boolean.movie_playing
          - service: scene.turn_on
            data:
              entity_id: scene.movie_lights_on
        turn_off:
          - service: input_boolean.turn_off
            data:
              entity_id: input_boolean.movie_playing
          - service: scene.turn_on
            data:
              entity_id: scene.movie_lights_off

You can just use the input_boolean with 2 automations :

- id: '1625153512298'
  alias: movie_lights_on
  description: ''
  trigger:
  - platform: state
    entity_id: input_boolean.movie_playing
    to: 'on'
  condition: []
  action:
  - scene: scene.movie_lights_on
  mode: single

- id: '1625153512299'
  alias: movie_lights_off
  description: ''
  trigger:
  - platform: state
    entity_id: input_boolean.movie_playing
    to: 'off'
  condition: []
  action:
  - scene: scene.movie_lights_off
  mode: single


It will do that if its state fails to change to on. Its state is stored by input_boolean.movie_playing. Does this entity exist? Does its state change to on when you turn on switch.movie_lights_switch?

I didn’t create the boolean. I realized it was a toggle in the UI. As soon as I created that it worked. Thank you so much for the help!