Capturing when a Scene is no longer in effect

I’d like to build into my lovelace some buttons that directly trigger scenes - and show visually that the scene is currently ‘active’ (with some sort of custom button card config).

However im not sure how easy this is to do - the state of the scene entities seems to be ‘scening’ regardless of whether theyve been called or not. I guess I could do this by checking to see if the state of any entities used in the scenes has changed, and therefore deviating from the scene itself, but this seems like a lot of work.

I had thought about a series of input booleans - triggering them on and off as the different scenes were called - but this seems inflexible as not all scenes being switched ‘on’ will necessarily mean another scene that manages different entities is now ‘off’.

Is there a method I havent thought of that makes this an easier job?

I use an input select.

Change the input select to select a scene either from the front end or via an automation.

An automation monitors the input select for changes of state and applies the required scene.

- id: 3c6e8948-47f7-49ba-bc69-f78135315f98
  alias: 'Lounge Scene Select'
  trigger:
    platform: state
    entity_id: input_select.lounge_scene
  action:
  - service: homeassistant.turn_on
    data:
      entity_id: >
        {% if states('input_select.lounge_scene') == 'Off' %}
          scene.lounge_off
        {% elif states('input_select.lounge_scene') == 'Manual' %}
          script.lounge_manual
        {% elif states('input_select.lounge_scene') == 'Automatic' %}
          scene.lounge_automatic
        {% elif states('input_select.lounge_scene') == 'Blood' %}
          scene.lounge_blood
        {% elif states('input_select.lounge_scene') == 'Bright' %}
          scene.lounge_bright
        {% elif states('input_select.lounge_scene') == 'Forest' %}
          scene.lounge_forest
        {% elif states('input_select.lounge_scene') == 'Imperial' %}
          scene.lounge_imperial
        {% elif states('input_select.lounge_scene') == 'Night Light' %}
          scene.lounge_night_light
        {% elif states('input_select.lounge_scene') == 'Party' %}
          script.lounge_party
        {% elif states('input_select.lounge_scene') == 'Sky' %}
          scene.lounge_sky
        {% elif states('input_select.lounge_scene') == 'Under Water' %}
          scene.lounge_under_water
        {% elif states('input_select.lounge_scene') == 'Watch Movie' %}
          scene.lounge_watch_movie
        {% elif states('input_select.lounge_scene') == 'Zen' %}
          scene.lounge_zen
        {% else %}
          scene.lounge_automatic
        {% endif %}

The state of this input select is handy for use in conditions. e.g.

- id: 5e4aa2fa-5de9-4531-ba1b-a26456c84a02
  alias: "Lounge Movie Scene Off"
  trigger:
    platform: state
    entity_id: media_player.lounge_osmc_kodi
    from: 'playing'
    for:
      seconds: 1
  condition:
  - condition: state
    entity_id: input_select.lounge_scene
    state: 'Watch Movie'
  action:
  - service: input_select.select_option
    data:
      entity_id: input_select.lounge_scene
      option: "Automatic"
2 Likes