How to send a notification when a device is not home at a certain time

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

Thanks in advance for any help.

This should point you in the right direction.

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.

Sorry I don’t have time to write out the code for you at the moment, but you’ll want

Trigger: time at 15:15:00
Condition: device_tracker_daughter is not_home
Condition: weekday: - mon -tue -wed -thu -fri
Action: notify pushbullet

Thanks everyone. I got this working

This is what I ended up with:

    - 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