Presence automation

Hi.

I would like to have my door unlock after I reach my home area and my ring doorbell dects movement (my lock only stays unlocked for 30 seconds so I don’t want it to unlock the moment I get close enough to my house it detects I’m home.) But I also only want the ring motion sensor to unlock my door when my presence changes from away to home. (I don’t want my door unlocking everytime some walks up to my door just because I’m home.)

In my head, I would need a loop function for this that is triggered when my presence is detected at being home. It looks like I would use the wait function for this but the documentation seems to indicate that is only for scripts (I guess I could call a script when my I am detected home…)

right now I have

  • alias: Unlock Because I’m home
    trigger:
    • platform: state
      entity_id: device_tracker.david_4de13167e3f04b2fab4d03170adce97a
      from: ‘not_home’
      to: ‘home’
      action:
    • service: lock.unlock
      entity_id: lock.door_lock

you don’t need a loop or script. With a simple automation, you just need to use the doorbell motion as a trigger and the presence detection (home) as a condition, then unlock door as the action.

Wouldn’t that make it so that if I’m home, the door will automatically unlock everytime the ring detects motion?

so you really want it to only unlock if your status went from away to home within the last minute or so… you should be able to do that with a timing condition

I’ll try that. Thank you.

I guess,alternatively, I can set it not to autolock - at least not using the door’s firmware. Then there is no race to the door or worry that I am getting to the door to quickly.

Not sure why I didn’t think of that sooner.

Set up a timing script for when the door is unlocked, lock it in 5 minutes.