Do state triggers for automation being enabled and disabled work on the same automation? The triggers do fire when my test automation is enabled or disabled but no conditions or actions run, and no trace is generated either.
alias: Foo
trigger:
- platform: state
entity_id:
- automation.foo
to: "on"
- platform: state
entity_id:
- automation.foo
to: "off"
...
They don’t. A trace is produced when an automation is triggered and no traces are produced when the following automation is enabled/disabled.
alias: Foo
description: ""
trigger:
- platform: state
entity_id:
- automation.foo
to: "on"
- platform: state
entity_id:
- automation.foo
to: "off"
condition: []
action:
- service: notify.persistent_notification
data:
message: "{{ trigger.to_state.state }}"
When the automation’s state changes from off to on, the State Trigger is functional only after the state-change is complete. Therefore it cannot detect the state-change.
When the automation’s state changes from on to off, the State Trigger ceases to be functional after the state-change is complete. Therefore it cannot detect it.