Zone enter is firing even though from_state and to_state show I never left the zone

Hi guys -

I have an automation that fires when I come home while connected to carplay.

The trigger is configured to fire when I enter the zone (home_entering – the name is silly but I kept it - it’s just the equivalent of home).

The last few times I’ve gone to the garage to leave, the automation has fired as I leave. I thought maybe this was due to GPS accuracy and the system thinking I was leaving the zone and coming back while I’m on the cusp, but the Changed Variables info in the Trace shows that the from_state and to_state both show me at home.

So, I can’t figure out why the automation is firing.

The Changed Variables trace info (anonymized) is below. Any ideas?
Thanks!

this:
  entity_id: automation.zzzz_enters_home_connected_to_car
  state: 'on'
  attributes:
    id: '1737212895837'
    last_triggered: '2025-05-08T20:52:28.079796+00:00'
    mode: single
    current: 0
    friendly_name: zzzz_enters_home_on_carplay
  last_changed: '2025-04-18T13:12:45.463227+00:00'
  last_reported: '2025-05-08T20:52:28.083395+00:00'
  last_updated: '2025-05-08T20:52:28.083395+00:00'
  context:
    id: 01JTRTQJSFGQZ6QZ63K75AEAWV
    parent_id: 01JTRTQJSC5W229GBYBF5TKZN5
    user_id: null
trigger:
  id: '0'
  idx: '0'
  alias: null
  platform: zone
  entity_id: person.zzzz
  from_state:
    entity_id: person.zzzz
    state: home
    attributes:
      editable: true
      id: zzzz
      device_trackers:
        - device_tracker.ha_app_iphone
        - device_tracker.iphone
      latitude: xxxxx
      longitude: xxxx
      gps_accuracy: 18
      source: device_tracker.ha_app_iphone
      user_id: 3266b21bdc2745f1a82d6e42a5c3fa51
      friendly_name: zzzzz
    last_changed: '2025-05-08T20:52:17.553654+00:00'
    last_reported: '2025-05-08T21:08:43.049516+00:00'
    last_updated: '2025-05-08T21:08:43.049516+00:00'
    context:
      id: 01JTRVNAX9J50XE4R2N05NHMVA
      parent_id: null
      user_id: null
  to_state:
    entity_id: person.zzzz
    state: home
    attributes:
      editable: true
      id: zzzz
      device_trackers:
        - device_tracker.ha_app_iphone
        - device_tracker.iphone
      latitude: xxxxx
      longitude: xxxxx
      gps_accuracy: 5
      source: device_tracker.ha_app_iphone
      user_id: 3266b21bdc2745f1a82d6e42a5c3fa51
      friendly_name: zzzzzzz
    last_changed: '2025-05-08T20:52:17.553654+00:00'
    last_reported: '2025-05-08T22:37:34.374311+00:00'
    last_updated: '2025-05-08T22:37:34.374311+00:00'
    context:
      id: 01JTS0R196QWYHXBNZYQFRFKJC
      parent_id: null
      user_id: null
  zone:
    entity_id: zone.home_entering
    state: '0'
    attributes:
      latitude: xxxxx
      longitude: xxxxx
      radius: 19
      passive: true
      persons: []
      editable: true
      icon: mdi:map-marker
      friendly_name: home_entering
    last_changed: '2025-04-18T13:12:31.833914+00:00'
    last_reported: '2025-04-18T13:12:31.833914+00:00'
    last_updated: '2025-04-18T13:12:31.833914+00:00'
    context:
      id: 01JS4GF1ASHR2ZG1FX4DQET4XY
      parent_id: null
      user_id: null
  event: enter
  description: person.zzzz entering home_entering

People probably need to see the automation too in order to help you.

I don’t know what the cause is, though it does seem likely that it’s GPS related. As a precaution you could add a template condition to block executing the actions if the to and from states are the same:

condition: template
value_template: "{{ trigger.to_state.state != trigger.from_state.state }}"
1 Like

Add a map card to your dashboard and set hours to show to [something].
Then the map will show what happened to your device tracker at that time when the automation triggered.

Most likely your home zone is too small.

This is so useful for debugging! Thanks!

Good call on the template condition – I like that better than making the zone bigger because I sometimes drive by on the street and don’t want it to fire.

@WallyR – thanks. I didn’t include it because the animation itself didn’t have anything interesting – I’m only interested in why it triggered. And the entirety of the trigger is zone enter:

triggers:

  • trigger: zone
    entity_id: person.zzzzz
    zone: zone.home_entering
    event: enter

That’s it.

Thanks to all. Open to other info - seems odd to have an enter trigger fire when from and to_states are the same.

We need it to understand the traces.