TL;DR: Single-source car presence detection fails. Device trackers ghost you when car’s off. Frigate can’t tell your car from neighbors’. Person tracking thinks you drove when you walked. Solution: Layer three unreliable sources with priority logic + 60-second delays. Zero false positives from walking.
The Problem
I wanted reliable “car at home” detection for automations (trip tracking, smart charging, security). Every single-source approach failed spectacularly:
Device Tracker (WiFi): Works when car is ON (5% of time). Otherwise? Home Assistant thinks my car drove to Iceland.
Frigate Object Detection: Sees a car. Could be mine, neighbor’s, delivery van. Can’t distinguish.
Person Tracking: False positives every time I walked to the store. Garage door closed on me while I was in the car because system thought it left when I walked outside.
Lesson: Trust no single source.
The Solution: Three-Layer Priority System
Architecture
Priority A: Device Tracker → If WiFi/phone says “home” → 100% reliable (car is ON)
Priority B: Frigate Zone Occupancy → If camera sees car in parking zone → Visual confirmation (car parked, OFF)
Priority C: Person Tracking Heuristics → Fallback logic:
- Both people home → Car probably home
- One person away → Ambiguous → Default “away” (safe)
- Both away → Car definitely away
Why This Works
Each layer compensates for others’ weaknesses:
- Device tracker fails (car OFF) → Frigate covers it
- Frigate can’t see (dark/weather) → Person tracking fills in
- Person tracking false-triggers (walking) → Device/Frigate override
The Code
Part 1: Hybrid Car Presence Sensor
Click to expand full sensor code
- trigger:
# Force update every 5 min (prevents deadlock)
- platform: time_pattern
minutes: "/5"
# Device trackers (car powered on)
- platform: state
entity_id: device_tracker.my_car_phone
- platform: state
entity_id: device_tracker.my_car_wifi
# Frigate zone occupancy (car parked)
- platform: state
entity_id: binary_sensor.parking_zone_car_occupancy
- platform: state
entity_id: sensor.parking_zone_car_count
- platform: state
entity_id: sensor.parking_zone_car_active_count
# Person trackers (deadlock prevention)
- platform: state
entity_id: person.me
- platform: state
entity_id: person.spouse
binary_sensor:
- name: "Car Home"
unique_id: "my_car_home"
device_class: presence
icon: mdi:car-side
state: >-
{% set phone_home = is_state('device_tracker.my_car_phone', 'home') %}
{% set wifi_home = is_state('device_tracker.my_car_wifi', 'home') %}
{% if phone_home or wifi_home %}
true
{% else %}
{% set frigate_zone = is_state('binary_sensor.parking_zone_car_occupancy', 'on') %}
{% set frigate_count = states('sensor.parking_zone_car_count')|int(0) %}
{% if frigate_zone or frigate_count > 0 %}
true
{% else %}
{% set me_home = is_state('person.me', 'home') %}
{% set spouse_home = is_state('person.spouse', 'home') %}
{{ me_home and spouse_home }}
{% endif %}
{% endif %}
attributes:
decision_reason: >-
{% set phone_home = is_state('device_tracker.my_car_phone', 'home') %}
{% set wifi_home = is_state('device_tracker.my_car_wifi', 'home') %}
{% if phone_home %}
phone_tracker_home
{% elif wifi_home %}
wifi_tracker_home
{% else %}
{% set frigate_zone = is_state('binary_sensor.parking_zone_car_occupancy', 'on') %}
{% set frigate_count = states('sensor.parking_zone_car_count')|int(0) %}
{% if frigate_zone %}
frigate_zone_occupancy_on
{% elif frigate_count > 0 %}
frigate_car_count_{{ frigate_count }}
{% else %}
{% set me_home = is_state('person.me', 'home') %}
{% set spouse_home = is_state('person.spouse', 'home') %}
{% if me_home and spouse_home %}
both_persons_home_assume_car_home
{% elif not me_home and not spouse_home %}
both_persons_away_assume_car_away
{% else %}
one_person_away_assume_car_away
{% endif %}
{% endif %}
{% endif %}
Key feature: decision_reason attribute logs why the decision was made. Essential for debugging false triggers.
Part 2: Trip Start (Robust with 60s Delay)
Click to expand automation code
alias: Car - Trip Start (Robust)
triggers:
- entity_id: binary_sensor.my_car_home
to: "off"
for:
seconds: 60 # Prevents false positives from walking
trigger: state
conditions:
- condition: state
entity_id: input_boolean.car_trip_active
state: "off"
- condition: template
value_template: >
{{ not is_state('binary_sensor.my_car_home', 'on')
and (states('person.me') != 'home' or states('person.spouse') != 'home') }}
- condition: template
value_template: >
{% set reason = state_attr('binary_sensor.my_car_home', 'decision_reason') %}
{% set time_away = (as_timestamp(now()) - as_timestamp(states.binary_sensor.my_car_home.last_changed)) %}
{{ (reason in ['both_persons_away_assume_car_away', 'one_person_away_assume_car_away'])
or time_away > 60 }}
actions:
# Detect driver
- choose:
- conditions:
- condition: template
value_template: "{{ states('person.me') != 'home' and states('person.spouse') == 'home' }}"
sequence:
- action: input_select.select_option
target:
entity_id: input_select.car_driver
data:
option: me
- conditions:
- condition: template
value_template: "{{ states('person.spouse') != 'home' and states('person.me') == 'home' }}"
sequence:
- action: input_select.select_option
target:
entity_id: input_select.car_driver
data:
option: spouse
- conditions:
- condition: template
value_template: "{{ states('person.me') != 'home' and states('person.spouse') != 'home' }}"
sequence:
- action: input_select.select_option
target:
entity_id: input_select.car_driver
data:
option: both
- action: input_boolean.turn_on
target:
entity_id: input_boolean.car_trip_active
- action: logbook.log
data:
name: "Car Trip Started"
message: >
Driver: {{ states('input_select.car_driver') }},
Reason: {{ state_attr('binary_sensor.my_car_home', 'decision_reason') }}
mode: restart
Trade-off: Lose ~1 km tracking at trip start (60s @ 60 km/h). Gain zero false positives from walking.
Part 3: Trip End (5 Min Delay)
Click to expand automation code
alias: Car - Trip End (Robust)
triggers:
- entity_id: binary_sensor.my_car_home
to: "on"
for:
minutes: 5
trigger: state
conditions:
- condition: state
entity_id: input_boolean.car_trip_active
state: "on"
- condition: or
conditions:
- condition: state
entity_id: person.me
state: home
- condition: state
entity_id: person.spouse
state: home
- condition: template
value_template: >
{% set reason = state_attr('binary_sensor.my_car_home', 'decision_reason') %}
{{ reason in [
'phone_tracker_home',
'wifi_tracker_home',
'frigate_zone_occupancy_on',
'frigate_car_count_1',
'frigate_active_count_1'
]}}
actions:
- action: logbook.log
data:
name: "Car Trip Ended"
message: >
Driver: {{ states('input_select.car_driver') }},
Distance: {{ states('input_number.car_km_today') }} km
- action: input_boolean.turn_off
target:
entity_id: input_boolean.car_trip_active
mode: restart
Why 5 minutes? Distance accumulation stops when GPS stops moving. Delay only affects “trip active” boolean flip.
Testing & Validation: What to Monitor
Here’s what you should test to validate it works in your environment:
Critical Metrics to Track
1. False Positive Rate (Walking/Public Transport)
# Track: How often does trip start when you walk?
# Method: Check logbook after each walk to store
# Target: 0 false starts in first week
# Fix: Increase delay if false starts occur
2. Decision Reason Distribution
# Track: Which data source makes decisions?
# Method: Log decision_reason on every state change
# Expected distribution:
# - phone_tracker_home: ~10% (car powered on)
# - frigate_zone_occupancy_on: ~60% (car parked)
# - both_persons_home_assume: ~25% (heuristic fallback)
# - one_person_away_assume: ~5% (ambiguous states)
3. Frigate Detection Reliability
# Track: How often does Frigate see your car?
# Method: Check when car is parked vs sensor state
# Known issues:
# - Night/darkness → May need IR illumination
# - Snow/rain → Detection drops 5-10%
# - Camera angle → Adjust if <90% detection
4. Device Tracker Availability
# Track: Does device tracker connect reliably?
# Method: Monitor when car starts vs tracker home
# Common issues:
# - WiFi range → Extend if needed
# - Phone Bluetooth → Enable "stay connected"
# - Car's WiFi hotspot → Ensure auto-start
5. Trip Start/End Timing
# Track: Does trip start/end at right times?
# Test scenarios:
# âś“ Walk to mailbox (should NOT start trip)
# âś“ Drive to store (SHOULD start trip after 60s)
# âś“ Return home, park (SHOULD end after 5 min)
# âś“ Quick stop at gas station (should keep trip active)
Edge Cases to Test
Week 1: Basic Validation
- Walk around neighborhood → No false trip starts
- Drive to nearby location → Trip starts correctly
- Return home → Trip ends after 5 min
- One person leaves (walk), other stays → Car stays “home”
Week 2: Edge Cases
- Both take public transport → Car correctly stays “home”
- Car borrowed by friend → Sensor shows “away” (expected)
- Parking in garage vs driveway → Both locations detected
- Night parking → Frigate still detects (or falls back to heuristics)
Week 3: Environmental
- Rain/snow → Check Frigate detection rate
- Fog/darkness → Validate fallback logic works
- Strong wind (moving camera) → Adjust mounting if needed
- Visitor parks in same spot → Check false positive rate
Week 4: Failure Scenarios
- WiFi down → Person tracking compensates
- Frigate offline → Device tracker + person logic works
- Phone battery dead → Spouse’s phone keeps tracking
- Both phones dead → Sensor stuck until return (acceptable)
Red Flags (Tune Settings If…)
False trip starts > 1/week → Increase delay to 90-120 seconds
Frigate detection < 85% → Adjust camera angle or add lighting
Device tracker never connects → Check car WiFi/Bluetooth setup
Trip end too slow → Reduce 5-min delay to 2-3 minutes
“One person away” > 20% decisions → Tighten person tracking zones
Success Criteria
After 2-4 weeks of testing, you should have:
Zero false trip starts from walking
>95% successful trip detection
Known failure modes documented
Delays tuned to your environment
decision_reason distribution understood
Then you can confidently build automations on top of this sensor.
Use Cases
Trip distance tracking - GPS-based km accumulation, feeds into battery SoC estimates
Smart EV charging - Start charging during cheap hours only when car confirmed home
Pre-heat/cool - Climate control before departure, only if car actually home
Security alerts - Notify if car leaves when you’re home (theft/teen driver)
Parking occupancy - Multi-car households, know which spot is free
Driveway lighting - Turn on lights on arrival, not when walking outside
Maintenance reminders - Oil change alerts based on actual driving
Cost tracking - Fuel/electricity cost per trip
Setup Requirements
Prerequisites:
- Home Assistant with person tracking (Companion App)
- Frigate NVR with car object detection configured
- Device tracker for car (WiFi, Android Auto, Bluetooth)
- Basic YAML skills
Required Helpers:
input_boolean:
car_trip_active:
name: "Car Trip Active"
input_select:
car_driver:
name: "Current Driver"
options: [me, spouse, both]
Entity Mapping (replace with yours):
| Generic | Description | Your Entity |
|---|---|---|
device_tracker.my_car_phone |
Phone in car | device_tracker.YOUR_PHONE |
device_tracker.my_car_wifi |
Car WiFi tracker | device_tracker.YOUR_CAR |
binary_sensor.parking_zone_car_occupancy |
Frigate zone | binary_sensor.YOUR_ZONE_car_occupancy |
sensor.parking_zone_car_count |
Frigate count | sensor.YOUR_ZONE_car_count |
person.me |
Your person | person.YOUR_NAME |
person.spouse |
Partner person | person.SPOUSE_NAME |
Key Lessons
Trust No Single Source - Device trackers lie, Frigate hallucinates, person tracking assumes. Layer them.
Delays Prevent False Positives - 60s feels long when testing. It’s the difference between “works” and “broken”.
decision_reason is Gold - Saves hours of “why did it do that?” debugging. Log everything.
Validate in Critical Automations - High-stakes (charging, security) → Check decision_reason. Low-stakes (logging) → Accept any state.
False Positives > False Negatives - Missing 1 km? Fine. Starting trip when walking? Unacceptable.
Questions?
Solved this differently? Been betrayed by device trackers? Found ways to distinguish your car from neighbors’? Share in comments!
Pairs with my GPS battery monitoring for complete vehicle automation.
Tags: #presence-detection frigate automation #car-tracking #device-tracker #person-tracking

