Conditional card to only show during an automation

I’ve searched for the answer to this, but not found anything to help.

I have two conditional cards in a vertical stack to show at the top of the frontend, but only during an automation.

The automations switch a hot water socket on, delay for either 1 or 2 hours and then switch it off. I only want to see the two conditional cards if one of these two automations is somewhere in the delay phase on the frontend.

I thought I could use the automation entity as a condition if the state was = ‘on’ but it doesn’t work. I’ve tried true too with the same result.

Is there a state I’m missing for automations, or is there a better way to achieve the same thing. I could just show the card based on the switch state, but I’d prefer to see it only when the automations are running.

type: vertical-stack
cards:
  - type: conditional
    conditions:
      - entity: >-
          automation.switch_the_hot_water_on_for_1_hour_in_response_to_telegram_check
        state: 'true'
    card:
      type: markdown
      content: _The Hot Water has been activated for 1 hour_
      title: Hot Water heating
      theme: slate
  - type: conditional
    conditions:
      - entity: >-
          automation.switch_the_hot_water_on_for_2_hours_in_response_to_telegram_check
        state: 'true'
    card:
      type: markdown
      content: _The Hot Water has been activated for 2 hours_
      title: Hot Water heating

change ‘true’ to 'on'

1 Like

You could create an input_boolean that is set to “on” (service homeassistant.turn_on) when the automation starts, and set to off when the automation finishes.
Then check for the state of the boolean with your conditional card

1 Like

actually, to get it to only display when you’re executing the actions, move the actions to a stand alone script and then display the condition based on the script state. I.E. on/off.

3 Likes

Yes, that’s a better solution :slightly_smiling_face:
You’ll also see the scripts state if it’s just an entity instead of a conditional card

1 Like

Great, thanks, will create a script and trigger that in the automation then. I did try ‘on’ instead of ‘true’ but it didn’t work either. It’s strange that automations appear in the option list if the state isn’t available.