Automation to trigger if device away from home for 1 hour or more

As the title suggests, I am looking to create an automation to trigger if a device is away from home for 1 hour or more. I have the automation setup to turn off my son’s plugs when he leaves the house and it works but I need it to wait for an hour before it does, just in case he nips to the shop or something.

Does anyone have any ideas how I could add it to this automation?

alias: Dylan sockets off
description: ""
trigger:
  - platform: state
    entity_id:
      - device_tracker.dooz
    from: home
    for:
      hours: 0
      minutes: 0
      seconds: 0
condition: []
action:
  - type: turn_off
    device_id: 284edb890243c648e9e611b028d08bdf
    entity_id: switch.dylans_socket_s1
    domain: switch
  - type: turn_off
    device_id: 284edb890243c648e9e611b028d08bdf
    entity_id: switch.dylans_socket_s2
    domain: switch
mode: single

Have you tried this?

Yes. That just turns them off for an hour I believe, not wait.

Actually, I may be a complete clown. I will check this now

Nope, the device must be away from home (or any other state e.g. "charging) for one hour to trigger, it has nothing to do with the action. :slight_smile:

He has left the house and it hasn’t triggered yet so fingers crossed

Yes, to test the automation send him out for an hour, enjoy the pease :rofl: Alternatively just put a smaller time span for example 5 minutes :slight_smile:

Turns out I am a complete and utter fool as it was just as you said. HOW DID I MISS THAT??

Thank you for pointing it out.