I’m pretty new to this automation stuff, but one of the things I’d like to automate is to send me a notification if one of my kids isn’t home by a certain time after school. School lets out at 2:45 PM, so if they’re not home by 3:15 PM (we live 5 minutes away from the school) I’d like to get a notification.
How would I set something like that up?
This is what I have so far, just not sure how to add the time component in there. Oh and also only during weekdays of course as there’s no school on weekends
- alias: Detect if kids are not home from school by 3:15PM
trigger:
- platform: state
entity_id: device_tracker.daugther1_phone
to: home
action:
- service: notify.pushbullet
data:
title: "Kids are not home on time"
data_template:
message: >
{{trigger.entity_id.name}} is not home yet
In your case, I would use TIME as the trigger, as 3.15PM is when something should happen. Then you add a Condition as Weok pointed out, that checks if device_tracker.daugther1_phone is NOT HOME. If the above are True, the Action is performed.
- id: '3948729047239384'
alias: Detect if kids are home on time after school
trigger:
- platform: time
at: '15:15:00'
condition:
condition: and
conditions:
- condition: time
weekday:
- mon
- tue
- wed
- thu
- fri
- condition: or
conditions:
- condition: state
entity_id: device_tracker.kid1_phone
state: 'away'
- condition: state
entity_id: device_tracker.kid2_phone
state: 'away'
action:
- service: notify.pushbullet
data:
title: "{{condition.entity_id.friendly_name}} is not home yet"
data_template:
message: >
{{condition.entity_id.friendly_name}} is not home yet