I’m trying to setup an automation that detects if i have been home for at leat 10 minutes (adds a bit of hysteresis with multiple devices)
I am getting false readings for the following code in my automation:
condition: state
entity_id: device_tracker.oneplus_8_pro
state: home
for:
hours: 0
minutes: 10
seconds: 0
If i query the last time the device tracker changed status vs current time:
{{states("device_tracker.oneplus_8_pro")}}
{{ as_timestamp(states.device_tracker.oneplus_8_pro.last_changed) | timestamp_custom('%Y/%m/%d %H:%M:%S')}}
{{now()}}
I get the following:
home
2023/03/19 15:32:16
2023-03-19 15:35:10.847759-05:00
The timestamps and the testing I am doing in the automation matches the timestamps for querying the last_change status. It does not match when the device was last changed to “home”. In other words, it thinks i have been home for 3 minutes when the history logs show i have been home for 3 hours.
The history logbook shows the following logs:
oneplus 8 pro was detected at home
12:51:30 PM - 3 hours ago
oneplus 8 pro was detected away
12:43:05 PM - 3 hours ago
I believe some other status change is causing this to report the wrong result.