I want to do an automation able to distinguish that an event has to happen before the other one.
I have a motion sensor in the other side of the door and a vibration sensor in the door.
If the vibration sensor event happens before the motion within 10 secs means that someone is going outside.
If the motion sensor event happens before the vibration means someone is coming in.
Depending on the condition I want to do different automation.
trigger:
- platform: state
entity_id: sensor.vibration
to: 'on'
action:
- wait_for_trigger:
continue_on_timeout: false
timeout: '00:00:10'
- platform: state
entity_id: sensor.motion
to: 'on'
- # YOUR GOING OUTSIDE ACTIONS HERE
Going inside:
trigger:
- platform: state
entity_id: sensor.motion
to: 'on'
action:
- wait_for_trigger:
continue_on_timeout: false
timeout: '00:00:10'
- platform: state
entity_id: sensor.vibration
to: 'on'
- # YOUR GOING INSIDE ACTIONS HERE
Thanks.
I have it working now, but I need to add more complexity.
I need another automation
Trigger is:
Automation ABC has been triggered.
Actions (I know how to do this part):
-whateverâŚ
I have read this
But I am not sure how to apply this to my case
How do I find the event name of an automation?
Although you idea of using âwait to triggerâ action works is there a way to do this as a condition? I mean wait during 10 mins to see if this condition is meet⌠then do actions based on codition.
iirc, an automation being âonâ only means itâs activated, able to run, not that it is ârunningâ. Scripts, on the other hand, are âonâ if running and âoffâ if not. You might be able to incorporate that by using a script from your automation. You could also set an input Boolean in your triggered automation and use that as a trigger for the automation you want to run when the first one runs, and even include the delay. I use that technique.
@tom_l â how would you do this if you had a series of THREE triggers? e.g. Iâve got motion sensors a the bottom, middle, and top of my driveway and want to use a series to determine if someone is coming up or going down the driveway.
The same way as for two sensors but with an extra wait for trigger. You could do it with trigger ids and choose actions or (a lot simpler) two automations:
Automation: up drive:
trigger: bottom of drive sensor
actions: wait for trigger middle, then wait for trigger top. Then notify.
Automation: down drive:
trigger: top of drive sensor
actions: wait for trigger middle, then wait for trigger bottom. Then notify.
In all wait for triggers, set continue on timeout false.