I have an automation that is supposed to unlock my front door if my Apple Watch or iPhone are within range of any of three bluetooth proxies. It seems to work sometimes, but mostly reports that the automation has unlocked the front door when in fact it is still locked.
The trigger is if a Reolink camera senses motion or a person. It then checks to see if the room where the door is has no motion in it, and if the door is closed.
The idea is that I only want the automation to unlock the door if there is no one present in the room where the door is or if the door is closed. This is intended to differentiate when I am inside or outside and within the range of the bluetooth proxy. I’m using Bermuda Trilateration.
The reason I have three rooms as conditions for my Apple Watch or iPhone is that the devices may report being in the vicinity of any of those three rooms when I am near the front door (ie workshop, garage or kitchen).
I have set up a notification to my iPhone if the automation runs to completion. Despite that being the last step in the automation, it often sends the notification even if the action to unlock the door has not been successful.
I can’t figure out why the behavior is inconsistent. Sometimes the door unlocks, sometimes it doesn’t.
If I approach the door, I get a notification from Reolink that the camera has detected motion. This happens very consistently, the camera motion sensing seems to work very well. If I test the various conditions in the automation, they all pass. But the door mostly remains locked, despite the notification being sent that the door is unlocked.
I am wondering if this is a timing issue or if there is another way to structure the automation such that the door actually unlocks when all the conditions are met.
Here is the YAML for the automation. I created the automation using the UI.
alias: Apple Watch or iPhone Unlock Workshop Door
triggers:
- trigger: state
entity_id:
- binary_sensor.reolink_driveway_person
- binary_sensor.reolink_driveway_motion
to: "on"
enabled: true
conditions:
- condition: or
conditions:
- condition: state
entity_id: sensor.applewatch_area
attribute: area_id
state: workshop
- condition: state
entity_id: sensor.applewatch_area
attribute: area_id
state: garage
- condition: state
entity_id: sensor.applewatch_area
attribute: area_id
state: kitchen
- condition: state
entity_id: sensor.10063b1e9a3e020d_area
attribute: area_id
state: workshop
- condition: state
entity_id: sensor.10063b1e9a3e020d_area
attribute: area_id
state: garage
- condition: state
entity_id: sensor.10063b1e9a3e020d_area
attribute: area_id
state: kitchen
enabled: true
- condition: state
entity_id: binary_sensor.workshop_presence_sensor_motion
state: "off"
enabled: true
- condition: state
entity_id: binary_sensor.workshop_motion_sensor_motion_2
state: "off"
enabled: true
- condition: state
entity_id: binary_sensor.workshop_entry
state: "off"
enabled: true
actions:
- device_id: lock device id
domain: lock
entity_id: lock entity id
type: unlock
enabled: true
- action: my_iphone
metadata: {}
data:
message: Reolink Person or Motion detected, unlocked workshop door
title: Workshop unlocked
mode: single