This means that I would not control the automation but a Bool helper, which in turn is queried in automation.
However, this does not yet solve the question of how I control this helper. So that when the light changes, the second automation checks and recognizes that the change is not triggered by the 1st automation and then switches the helper.
You asked for a condition for when the state change is not from another automation, which is what’s provided. That condition will stop the automation from running when automation.xyz is what caused the state change.
condition:
- condition: template
value_template: "{{ trigger.to_state.context.parent_id not in states.automation | map(attribute='context.id') | list }}"
makes sure the automation only runs when it comes from a source outside automations.
states.automation → makes a list of all automations
| map(attribute=‘context.id’) → maps the automations context.id as the item in the list
| list → makes it a list
trigger.to_state.context.parent_id not in → checks to see if the parent_id is in the automation list
It’s going to always say yes when the context isn’t coming from an automation.
Context can only distinguish it’s origin if it came from: Automations, A user action in the frontend, and scripts. Everything else (Physical press or from the integration) are seen with no context as they both look the same.
So, this automations condition will only stop when it comes from an automation.