i am a bit lost right now. Basically i am looking for a option to stop automation A from running if automation B starts running - or in other words an Option to prioritize automations that have the same triggers.
In my case i have automation A which toggles light based on movement between sunset and sunrise. That base is always on. Now automation B (i want optional) fires my nightlight and some other stuff at 1 % if motion is detected and it’s really late (23:00 - 05:00). So if B ist toggled than A should not start in the first place.
How do i achieve this? a condition?
I read a bit of a script that calls automation.turn_off but i don’t think that solves my problem because then Automation A is off forever and i want this just for the time Automation B triggers…
Sorry for the noobish question…
Thanks in advance!
So the literal answer to your question (how do I prioritize the trigger of A over B) is you can’t. That being said, that’s not the way to look at this problem.
What you have here is two automations that both trigger off of motion but each only fires when a specific other condition is met. In your case it sounds like that other condition is time of day. So add a mutually exclusive condition to each like this:
A
trigger:
...
condition:
condition: time
after: '04:59'
before: '23:00'
B
trigger:
...
condition:
condition: time
after: '10:59'
before: '05:00'
Now B and A don’t care what the other is doing. They just each do their thing when it’s their time.
Conditions listed under condition are combined with and by default, so just add it like this:
condition:
- condition: or
conditions:
- condition: sun
after: sunset
after_offset: !input 'sunset_offset'
- condition: sun
before: sunrise
before_offset: !input 'sunrise_offset'
- condition: time
after: '04:59'
before: '23:00'
This would also work in the choose block like tinkerer showed if you prefer. Although you’d need to add another choose section:
choose:
- alias: is late
conditions: #from 23-5 from above
sequence: # dim lights
- alias: is evening
conditions: # after sunrise or before sunset
sequence: # bright lights
default:
# do nothing. It's daytime