I have this automation that uses the Pi in the car to unlock the car when my phone comes within distance (by ESPresense). But it’s not supposed to do that when the car’s parked by the house (since it picks up on the phone when I’m inside the living room, close to that wall). Then only the beacon on the keys is supposed to unlock it, in another automation. Still, it reacts to my phone:
- id: '134629046235321422812'
alias: Mastiff's phone comes to the car
description: Unlock the car when Mastiff's phone comes within range
condition:
condition: not
conditions:
- condition: state
entity_id: sensor.mastiff_lock
state: "0"
- condition: state
entity_id: binary_sensor.hjemme
state: "off"
action:
data:
entity_id: lock.mastiff_lock
service: lock.unlock
trigger:
platform: state
entity_id: sensor.mastiff
from: 'not_home'
The way I define if the car is home is if the OpenWRT box (another Pi in the car) has connected to the house network (which is prioritized over the LTE modem connected to it). It pings 192.168.1.1 (the pfSense box in the house), and sets the Ping sensor to “At home”, or “Hjemme” in Norwegian. As far as I have found out the sensor should show “on” when the ping works and “off” when it doesn’t. Which means that with a “not” condition the state of the binary sensor should be set to “off”. But still it won’t behave. Any idea what I’m doing wrong here?