All currently running automations card > turn_off button

I have this very useful card I picked up somewhere. It shows all currently running automations, but it doesn’t display on the Dashboard if there are none.

It also has a toggle that disables the automation, which of course stops it. Which is almost really handy. But as soon as the automation is disabled the card is hidden, so the automation will remain disabled until one manually finds it and re-enables it.

My question is, is there a way to incorporate an automation.turn_off button for each running automation? Or any other ideas on how to halt a running automation without disabling it?

The actual code:

type: custom:auto-entities
card:
  type: entities
  title: Running Automations
filter:
  exclude:
    - state: unavailable
    - attributes:
        current: '= 0'
  include:
    - domain: automation
show_empty: false
sort:
  ignore_case: true
  method: name

Automations should not run so long that you would need a list of them.
They should be done in seconds and that is even slow.
This indicate the wrong usage of delays.
Delays should just short and max a few seconds. There are so many events that can reset automations and then you are in a unknown state.
The usage of timestamps in helpers are better, because they can not be interrupted and even a restart of HA will can be survived.

1 Like

That’s a great tip, ty.

I have an input that allows me to set a wake up time for the next morning.

So I went to the template editor and hacked around a bit.

{{ states('input_datetime.wake_up_time') }} returns 06:00:00

{{ (states.input_datetime.wake_up_time.attributes.timestamp - 3600) | timestamp_custom('%H:%M', False) }} returns 05:00. Perfect.

So then I created a test automation:

trigger:
  - platform: template
    value_template: >-
      {{ (states.input_datetime.wake_up_time.attributes.timestamp - 3600) |
      timestamp_custom('%H:%M', False) }} 
action:
  - service: light.turn_off
    data: {}
    target:
      device_id: 6ebe50173bf3aefe29469f5bc860cfdb
mode: single

I then set input_datetime.wake_up_time for 1 hour and 1 minute from now, expecting the automation to run within less than a minute. But it never ran.

What am I missing?

Nevermind. Got it.

trigger:
  - platform: template
    value_template: >-
      {{ now().strftime("%H:%M:%S") == (today_at(states("input_datetime.wake_up_time"))-timedelta(minutes=60)).strftime("%H:%M:%S") }}
action:
  - service: light.turn_off
    data: {}
    target:
      device_id: 6ebe50173bf3aefe29469f5bc860cfdb