However this also fires if someone leaves the house. There is a Door Sensor on the front door so I can see if the front door is left openâŚ
alias: Frontdoor Left Open
description: Repeat alert to mobile if the front door is open every 2 minutes
trigger:
- platform: state
entity_id:
- binary_sensor.frontdoor_isopened
to: "on"
for:
hours: 0
minutes: 2
seconds: 0
condition: []
action:
- repeat:
while:
- condition: state
entity_id: binary_sensor.frontdoor_isopened
state: "on"
sequence:
- service: notify.mobile_app_m2007j20cg
data:
message: Front Door has been open for more than 2 minutes
title: Front Door
enabled: false
- service: notify.pushover
data:
title: Front Door
message: Open > 2 minutes
- delay:
hours: 0
minutes: 2
seconds: 0
milliseconds: 0
mode: single
What I would like to do is combine these sensors so I only get alerted if someone comes to the door, not if someone leaves. So what I am thinking is have a condition of the first YAML (which fires if there is someone outside the Front Door) to only fire if the front Door Door/Window Sensor has not been triggered in the last 20 seconds. This will stop the alert if someone has just left the house but will still fire if someone comes to the house.
Something like
If front door motion sensor fires and front door open/closed sensor has not been fired in last 20 seconds send alert âsomeoner at front doorâ
Feel like I need to save the time the front door open/closed sensor to some type of varable/widget and check this time when the front door motion sensor fires. However not sure how to do this?
Create a sensor âoutside motion armedâ that gets set when the door is closed for more than 20 seconds and reset when the door is opened. Use this âarmedâ sensor as a condition on the motion detection automation.
Anyone leaving home will have 20 seconds to vacate after closing the door. 20 seconds after the door is closed, any detected movement will permit the automation to execute its action .
The State Condition posted above will allow the automation to execute its action only if the door was closed at least 20 seconds before the automation was triggered.
At the moment when motion is detected, the door must be in a closed state for at least the past 20 seconds in order for the notification to occur.
Thanks, yhat did the trick. I also added another condition so I only get the alert during the day. Hope this is usefull to others.
alias: Front Door Someone outside
description: Send an alert if someone arrives at the Front Door during the day
trigger:
- type: motion
platform: device
device_id: ffda8f8b6dbdc576e1418c170394edc2
entity_id: 2a694648c767946595286485a6d13f15
domain: binary_sensor
for:
hours: 0
minutes: 0
seconds: 1
condition:
- condition: and
conditions:
- condition: state
entity_id: binary_sensor.frontdoor_isopened
state: "off"
for:
seconds: 20
- condition: time
after: "08:30:00"
before: "23:00:00"
action:
- service: notify.pushover
data:
title: Front Door
message: Someone Outside
mode: single
Youâre welcome! Glad to hear it fulfilled your request.
Please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topicâs title which signals to other users that this topic has been resolved. This helps users find answers to similar questions.
You appear to have marked your own post with the Solution tag. Itâs the custom of this community forum to assign the Solution tag to the post that resolves the original problem or answers the original question. If you recall, that this post which explained how to use a State Condition to meet your requirements. Only one post in the entire topic can have the tag.
FWIW, if everyone marked their own post, it would give the impression that everyone ultimately solves their own problem (regardless of the help they received).