Basic automation with device tracker not working

Hi, I have successfully set up a wifi presence detection for my iPhone: The frontend indicates „Home“ and „Away“ correctly. However, the automation with the trigger „device leaves a zone“ set up with the GUI never triggers.
What am I missing? Do I need some yaml code in addition to the GUI entries?Many thanks for your help.

We are not mind readers, if you want help please follow the Community Guidelines by sharing the YAML configuration for your automation. You can access the automation’s configuration from the Automation editor by clicking the 3-dot menu at the top right hand corner, then select “Edit in YAML”. Copy everything and paste it here properly formatted.

Sorry, I have assumed using the GUI results in a predefined yaml code. Anyhow, thank you for looking into it.

alias: WW OFF if iP97 leaves zone home
description: ""
trigger:
  - platform: device
    device_id: 65ddf133e05356bed9f1044898c4f2cc
    domain: device_tracker
    entity_id: 8f583ea480de251164940995a3964f1a
    type: leaves
    zone: zone.home
condition: []
action:
  - type: turn_off
    device_id: 3d4e5097ec3b31764eadfa597d7a41e1
    entity_id: f75a3f33dac6e3cf6a2b51bc6309dfdd
    domain: switch
mode: single

Well that looks okay…

First, can you tell us how you are testing it and how you know it “never triggers”?

Second, in the automation editor there will be a button near the top right corner that says “Traces”. Click that to enter the debug trace menu for that automation. Are there any debug traces available that you can share?

The second column on the Automations-page (‘Last triggered’) says ‘Never’. ‘Traces’ indicates ‘No traces found’.
I am wondering whether the issue might be related to the wifi (non-gps) presence detection. On the other hand, when selecting the phone as trigger device, ‘phone leaves a zone’ looks to me as the appropriate trigger condition, as the other options are related to internet access.

Set up the automation with a state trigger on your phone’s state changing from 'home' to 'not_home'.

Entity-based state triggers are generally easier to troubleshoot than opaque device triggers.

1 Like

Yes, that is definitely a possible issue… assuming the Device trigger is using the Zone trigger “under the hood”.

Thanks a lot for your help, also to @Didgeridrew. It works now!

1 Like

Hey GWL,
Are you able to share the resultant yaml you used to get it working?
I also use wifi presence sensing.
thanks!