Try adding this condition to your first automation:
condition:
- condition: template
value_template: >
{{ not trigger.to_state.context.parent_id }}
I believe that parent_id is populated with a value that should link to an automation. If the parent_id is empty, it came from a user press or physical arm.
Not sure if it will work, haven’t played with this aspect much.
I’ve added this in the message to see its value, and it’s None.
So it can’t be used I guess, as the two automation aren’t really in a parent/children dependancy…
Not 100% sure what you mean, if I set a boolean to true following the 11pm trigger, and set the other automation to not message if the boolean is true?
If that’s what you mean, when do I put the boolean back to false?
Another idea :
Could I maybe add a step before and after sending the 11pm notification, to disable temporarily the other automation maybe and then activate it back?
You’re saying it’s none when the other automation triggers it? Try again but remove the .parent_id. The context object has 3 separate ids that should point to the context.
Edit: the context might only be available in the from_state too.
FWIW, I carried out a simple test (with 0.111.4) using an automation triggered by an input_boolean (it reports trigger.to_state_context).
When the input_boolean is turned on via the UI, trigger.to_state.context.user_id contains a string identifier that represents my user account.
When the input_boolean is turned on via another automation, trigger.to_state.context.user_id contains the string None.
Therefore trigger.to_state.context.user_id can be used to determine if the automation was triggered by a user or by Home Assistant (i.e. an automation, script, or scene).
If you want to demonstrate it for yourself, create two input_booleans named flipper and toggler and use the two automations shown below.
If you toggle flipper via the UI, it triggers the “context” automation. It will report it was triggered by “user”.
If you toggle toggler via the UI, it triggers the “indirection” automation which causes the “context” automation to trigger. Given that “context” was triggered by the “indirection” automation, it will report that it was triggered by “Home Assistant”.