Presence detection, Owntracks, HA Zones and automation confusion

Hey Guys,
Im hoping someone could clear this up for me,

I have AsusWRT and owntracks combined in a devicetracker and I have HA Zones configured, one for home and one for work. (Not owntracks Regions)

In HA where have the device tracker displayed it will show me as Home, Away and Work based on where I am - this is all working fine, Cool!

Now I want to write Automation, however the device tracker shows its states as Home and Not_home.

How do I access the state that says i’m at Work?

I spent a ages writing and testing different automation to see what the works and doesn’t but i’m stumped.

Interesting - my device tracker shows my custom zone states. Perhaps ensure you’re using the same capitalization? Not sure if it makes a difference here, but it does in other areas so might be worth a shot!
image

Hmm, it could be a problem with my automation code, I can see a capitalization error. Ill fix that and see if that make the difference.

My device tracker shows the same thing on the states page ‘Work’ but the automation only seems to run when I use ‘home’, ‘not_home’ .

This works and triggers when I leave:
trigger:
- platform: state
entity_id: device_tracker.fletch_phone
from: ‘home’
to: ‘not_home’

This doesn’t run when i get to work even though the device tracker has up dated to work (Could be capitalization)
trigger:
- platform: state
entity_id: device_tracker.fletch_phone
to: ‘work’

If the trigger code looks sound ill do some more tests and see if I can work it out.

Hey guys
Just to update when ended up working for me so that it might help someone else.

for the automation of a device_tracker time when the display says Home then use ‘home’ as the state, when away use ‘not_home’ and when in a zone use the zone name eg ‘Work’

in Automation…

  • alias: Mark as home
    trigger:

    • platform: state
      entity_id: device_tracker.phone
      to: ‘home’
      action:
    • service: input_select.select_option
      data:
      entity_id: input_select.status_dropdown
      option: ‘Home’
  • alias: Mark as at Work
    trigger:

    • platform: state
      entity_id: device_tracker.phone
      to: ‘Work’
      action:
    • service: input_select.select_option
      data:
      entity_id: input_select.status_dropdown
      option: ‘Work’
  • alias: Mark as Away
    trigger:

    • platform: state
      entity_id: device_tracker.phone
      to: ‘not_home’
      action:
    • service: input_select.select_option
      data:
      entity_id: input_select.status_dropdown
      option: ‘Away’

Yep, this is what I found as well.

I wrote a custom integration for Life360. Life360 has “places”, which are effectively equivalent to HA Zones. Of course, in Life360 I had a “Home” place. The Device Tracker component will accept a location name from the platform implementation. But I had to make sure, in my Life360 platform implementation, to change “Home” to “home”, otherwise it messed up the Device Tracker component. All other “place” names were fine, including None (i.e., not in any Life360 “place.”)

So now I have three different "Home"s: HA’s location, a Home Zone, and Life360’s Home Place. But they all correspond to “home” (all lower case) for the device_tracker state. LOL!

But, bottom line, yes, for the device_tracker state, “home” is for the location defined for your HA system (and your Home Zone if you have one defined), “not_home” for anywhere that is not in a Zone, and the Zone’s exact name (with correct capitalization) when you’re in a Zone.