How to keep track of which scenes are active

Hi there.

I was trying to set up an automation that involved looking at whether a certain scene was active or not - I have just read that this was removed from HA, some time ago, as it caused some issues.

Is there any way round this problem?

For example - say I have six scenes set up in my Living room. Is there anyway that I can output which of these states is active to another node that I can then use as current state?

Please vote.

Looks like you have to make a work around. A toggle- or a text-helper you populate when a scene is turned on/off in your script or automation.

1 Like

Thanks for that.

Is there a particular node I could use for this?

I was thinking about a single node that I could attach to all my scenes to, to mark which scene was last activated. I could then use this node to check the current state.

I have one automation triggering most of the scenes (lighting, based on time of day) and have it run an additional action to set a input helper text entity.
(I also use a motion detection based automation to power everything off after 30 minutes - this also calls my “off” scene, and sets the same “current scene” text)

The current scene is configured as a condition - for instance:

- if:
      - condition: time
        after: "01:00:00"
        before: "05:30:00"
        weekday:
          - mon
          - tue
          - wed
          - thu
          - fri
          - sat
          - sun
    then:
      - service: scene.turn_on
        target:
          entity_id: scene.lighting_overnight_soft
        metadata: {}
      - delay:
          hours: 0
          minutes: 5
          seconds: 0
          milliseconds: 0
      - service: automation.trigger
        data:
          skip_condition: true
        target:
          entity_id: automation.no_motion_detected_30_minutes
      - if:
          - type: is_no_motion
            condition: device
            device_id: ********
            entity_id: binary_sensor.pir_kitchen_tz3000_****_ts0202_ias_zone
            domain: binary_sensor
            for:
              hours: 0
              minutes: 5
              seconds: 0
        then:
          - parallel:
              - service: input_text.set_value
                data:
                  value: "Off"
                target:
                  entity_id: input_text.downstairs_current_light_scene
              - service: scene.turn_on
                target:
                  entity_id: scene.downstairs_lights_off
                metadata: {}
              - service: automation.turn_off
                data:
                  stop_actions: true
                target:
                  entity_id: automation.lights_downstairs_scene
mode: single