Automations Attributes as a Condition in a Automation

last_triggered: 2021-12-03T23:58:52.475569+00:00
mode: single
current: 0
id: 1638481153745
friendly_name: AA Blank Automaion

Notice the current: 0 will change from 0 to 1 when the automation is currently running. This happens as long as a Time Delay is running in the automation. e.g. Wait for time to pass.

How does one use the Attribute “current: 1” as a condition or trigger in another automation?

Like any other attributes.

  - platform: state
    entity_id: automation.aa_blank_automation
    attribute: current
    to: '1'

How do you enter that in the Automation Editor? Does it need to be a template?

Since nobody answered, just for future reference:

  • in a Trigger or Condition, select “State”
  • choose the animation as the Entity
  • Click on “Attributes”
  • select “Current” from the drop-down list
    the values are 0 for not running, and 1 for running.

EDIT: you must then go into YAML editor, and remove the quotes arounf the value, e.g “1” has to be changed to just 1, otherwise the check will fail !

.Eg to have something trigger when an animation runs, set it to trigger on change from 0 to 1
to have an automation run only when another is running, add the condition “Current”, value 1.

You can make animations which mutually exclude each other: in actions, put “delay 5 seconds”, then condition “other script” “Current” 0. The delay is to avoid the race condition in case both scripts try to start at exactly the same moment.

3 Likes

Thank You !! :slightly_smiling_face:

If want this to be done better, please vote for Add a "running" state for automations

As I mention there, the steps I outlined above do not work. You need to also go into the YAML editor and change the “1” to just 1.

Thank you!
This really helped me

Thank you - this was driving me crazy!

This not always true for automations running in parallel mode. Those can have counts that are higher. But granted, that is rarely the case.