How to access state of the automation (running/not running)?

Is there a state for an automation that is updated while the automation is running and terminated (i.e. is tracking wheather the automation is running or not)?

For example, if have an automation my_automation I would like to test its state (is it running or not) as a condition:

condition: "{{ state_attr('automation.my_automation', 'isActive') == True }}"

I went through the documentation of automations but can’t find this information (besides the info that they can persist their state during restart).

– update –
Is it maybe current with possible values {0,1} 0 - non active, 1 - active ? I am guessing here. If so - does it has this exact semantics? Can those values be different (restart times, or whatever)?

image

The value of an automation’s current attribute reports the number of concurrently executing instances of the automation.

  • If it reports 1 then there’s one instance of the automation in-progress (meaning one instance is busy executing actions).
  • A value of 2 means two instances of the automation are in-progress (this is possible if the automation’s mode is parallel).
  • If there are no instances of the automation that are in-progress then the value of current is 0.
condition: "{{ state_attr('automation.my_automation', 'current') > 0 }}"
6 Likes