I don’t understand why this runs every time I walk away from my car.
The conditions should limit it.
id: '1627374681490'
alias: Andreas high accuracy walking home
description: ''
trigger:
- platform: numeric_state
entity_id: proximity.home
below: '200'
- platform: state
entity_id: sensor.andreas_bluetooth_connection
attribute: connected_paired_devices
condition:
- condition: or
conditions:
- condition: and
conditions:
- condition: state
entity_id: sensor.wifi_connection
state: <not connected>
- condition: numeric_state
entity_id: proximity.home
below: '200'
- condition: and
conditions:
- condition: template
value_template: >-
{{ '4E:C3:9E:5B:9C:86' in
trigger.from_state.attributes.connected_paired_devices }}
- condition: template
value_template: >-
{{ not '4E:C3:9E:5B:9C:86' in
trigger.to_state.attributes.connected_paired_devices }}
- condition: numeric_state
entity_id: proximity.home
below: '200'
- condition: state
entity_id: sensor.wifi_connection
state: <not connected>
action:
- delay:
hours: 0
minutes: 0
seconds: 3
milliseconds: 0
- service: notify.mobile_app_andreas
data:
message: command_high_accuracy_mode
title: turn_on
mode: single
proximity.home is currently about 48200
sensor.wifi_connection is currently <not connected>
sensor.andreas_bluetooth_connection does change when I walk away from the car and the mac address is the one I want it to trigger on.
Since the proximity is condition then it shouldn’t trigger, or is there something wrong with this condition?
This is the trace I get (I have never read one of these before).
I want the proximity and wifi connection to be “and”.
I do not want this to run when I walk away from my car and I’m more than 200 m from home. (and that is what it’s doing currently)
With your condition:
condition:
- condition: or
- condition: numeric_state
entity_id: proximity.home
below: '200'
- condition: state
entity_id: sensor.wifi_connection
state: <not connected>
if either one of these is true then it runs? And since wifi connection is not connected at the time I leave my car usually (only if I park right outside, which could happen but is unusual) then that will be true at 99% of the times.
I want it to trigger when I park at my normal parking spot (less than 200 m from home) or when I disconnect from car BT.
But conditions is less than 200 m and not connected to wifi (not when I park right outside).
The reason is that this turns on the high accuracy mode to follow me home and then I have an automation to turn it off when I connect to home wifi.
If it would trigger when I park right outside the house then it might turn on the high accuracy mode after I connect to home wifi and thus it will “never” turn off.
Check the state of sensor.wifi_connection and proximity.home at the time the automation ran (use the history page). Time according to the trace was 2 August 2021, 6:32:57
As both those two conditions would have to have been true (the others dont matter) for the automation to run.
Between the left point and the red marker there is no updates of the values.
Red marker is at 06:32:58
So proximity.home was 0 at the time even though high accuracy mode was enabled on the phone during the whole drive.
That explains why the automation ran. Now I have another problem to look in too.