How to add state to entity?

Hi,
if the title makes no sense it’s because I’m not really sure what I’m looking for. I’ve got 2 automations called lights_on and lights_off, which do exactly what you’d think. Then I have a third automation which acts as sort of a toggle, i.e. every time I call the automation it calls lights_on if lights are off and lights_off when lights are on.

If I add single lightbulb to dashboard, if it’s on, the bulb icon will be yellow and full, if it’s off the icon will be blue and outlined.

I would like the same for my automation, so that the icon lights up when lights_on was called and dims when lights_off was called. No idea if it’s even doable, I was thinking maybe a template would do it, but haven’t found any example like that and personally not that good with templates to try something from scratch.

Thanks for any ideas!

Just make a light group and use the light group in the UI and scrap the automation.

Hi, this would indeed work and I already use it for other groups of lights, but the automations the button toggles do a lot of other stuff apart from lights, such as checking if I’m home and then adjusting thermostats and blinds, turning on computers etc.

But that set me on the right path I believe: I could use a group with all the lights for the dashboard button, and then have the automation I previously controlled with the button instead react to the state of the light group.

Thanks!

edit: worked great

alias: LIGHTS ON-OFF dashboard button helper
description: ''
trigger:
  - platform: state
    entity_id: light.lights_on_off_helper
    from: 'off'
    to: 'on'
  - platform: state
    entity_id: light.lights_on_off_helper
    from: 'on'
    to: 'off'
condition: []
action:
  - choose:
      - conditions:
          - condition: state
            entity_id: light.lights_on_off_helper
            state: 'off'
        sequence:
          - service: automation.trigger
            target:
              entity_id: automation.lights_off
      - conditions:
          - condition: state
            entity_id: light.lights_on_off_helper
            state: 'on'
        sequence:
          - service: automation.trigger
            target:
              entity_id: automation.lights_on
    default: []
mode: single