I have an automation that triggers based on a person in my driveway, and it works well. over time I’ve realized that many of my alerts are me in my driveway, and I dont really need an alert for that haha.
So I’ve tried to set up the situations that I want to keep from getting alerts. In plain language, I dont want it to trigger if the front door just opened (it was me opening the door), and I don’t want it to trigger if my garage door is open and I’m home. That’s usually me working in the yard on the weekend. I do want alerts, if the garage door is open and I’m not home since.
I’m not quite there but this is what I have. The more I try to get it my brain starts hurting, haha.
- alias: Person Detection in the Driveway
trigger:
- platform: state
entity_id: binary_sensor.person_in_driveway
to: 'on'
condition:
- condition: numeric_state
entity_id: sensor.ha_runtime_in_minutes
above: 1
- condition: state
entity_id: binary_sensor.motion_sensor_outdoor_motion
state: 'on'
- condition: state
entity_id: binary_sensor.open_close_sensor_front_door
state: 'off'
for:
seconds: 75
- condition: and
conditions:
- condition: state
entity_id: cover.garage_door_opener
state: 'closed'
- condition: template
value_template: "{{ states('input_select.house_mode') != 'Home' }}"
action:
- service: notify.pushover
data_template:
target:
- Paul
- Tracy
title: "Person in Driveway"
message: "{{ as_timestamp (now()) | timestamp_custom('%I:%M %p') }} on {{ now().strftime('%d %b %Y') }}"
data:
file:
path: '/home/homeassistant/.homeassistant/www/tmp/front_door_latest.jpg'
So those are the items I think work best, just not sure of the exact order for the conditions. Bonus if I can maybe have the garage door open when I’m home only be for the 1st hour of being open. If its open longer, I probably forgot to close it (although I have seperate alerts for that and prob would have closed it anyway)
Nice Idea. Definitely appreciate the thought. For my setups I really like to try to automate as much as possible and avoid even have to open the app for most things. The garage door condition is really a stretch goal since it’s not very often. I do like the lovelace! thanks, I might end up adding that to my UI for other areas
I guess another possibility that might suit is using a wait_template either in the automation, or calling a script and have it do the waiting. You could also include whether that script is already running as a condition to avoid multiple triggering:
Replying to my own post. Thanks for the tips, it helped me to think this out a bit slower. Untested for the moment, but I believe this will work for the condition
- condition: or
- condition: state
entity_id: cover.garage_door_opener
state: 'closed'
- condition: and
conditions:
- condition: state
entity_id: cover.garage_door_opener
state: 'open'
- condition: template
value_template: "{{ states('input_select.house_mode') != 'Home' }}"
- condition: and
conditions:
- condition: state
entity_id: cover.garage_door_opener
state: 'open'
- condition: template
value_template: "{{ (as_timestamp(now())- as_timestamp(states.cover.garage_door_opener.last_changed)) < 1800 }}"
- condition: template
value_template: "{{ states('input_select.house_mode') == 'Home' }}"
I have an input select that changes based on presence sensors. It’s set to Home, Away, night, or extended away.
Basically I have a driveway that runs by my front door. I have a doorbell camera. The motion sensor on my doorbell camera does not work with HA. I have another motion sensor at my front door. Also my garage is right next to my front door.
Bottom line. I want a picuture when someone comes to my front door, but dont need pictures of myself, haha. So if someone walks up to the door, I’ll get a picture. But If I open the door and walk out past the doorbell, I will not (or at least thats the goal). Same thing goes for my garage. If I opened my garage and I’m home, then I dont need a picutre of me walking out of my garage. Of course if my garage is open for some reason and I’m not home, then I’d want a picutre.
To be honest, I’m just playing with this automation/condition to try to improve it from 95% happy to 99% happy. it already does what I want other than the occasional picture of myself.
The front door condition has been there for weeks, and has worked exactly as expected. The garage door part is what I wanted to add, and in real life that happens like once a week or so.
What I’m still hearing is that you don’t want photos of yourself when you are home, only when you are not home. If you are home then when you step out the front door or the garage door, no photo is sent to you.
The condition would be that you must be ‘not_home’ for at least 5 minutes. In other words, after you set the input.select to ‘not_home’, you have a 5-minute window to exit the house (via any door) without having a photo sent to you. Beyond 5 minutes of ‘not home’, the condition will allow photos to be sent to you.
Does that sound like what you want?
What’s unavoidable is that when you return to your house (that is set to ‘not_home’), your arrival will be detected and a photo will be sent. The only way to suppress that is to set the input.select to ‘home’ prior to arriving within range of the motion sensor (that might not be very practical).
You got it.
Actually the input select changes when I’m about 100 meters from home, and if everything is working, It would have changed to home before I could hit the motion sensor. I do like the idea of maybe one more condition for the few times I would set off the motion, garage would be closed, and I just got home. Thanks for the idea.