How to give Custom Name to State (Zone) Reported by Device Tracker

This is a very similiar question to that posed in June 2020 by wormuths (Device Tracker Custom State Names), which unfortunately didn’t have responses.

Problem: I wished to detect whenever I (or my wife) entered our subdivision. As I couldn’t solve the problem with overlapping zones (Subdivision and Home), I had to expand the radius of my Home zone to be some 400 meters. This works great, but is not granular enough to tell me whether somebody is actually at home - I just see them as ‘Home’ when they could be 1/4 mile away at the subdivsion gate! Currently, on my Person entity card, they’re shown as either ‘away’ or ‘home’. I’d like to configure the entity card such their status is shown as follows:

  • If status == Home, then simply rename it to “In Subdivision” (because they’re somewhere in the Home zone)
  • If Status == Away, then leave it as that
  • If Status == Home AND the phone reports a connection to my WiFi (Phone entity’s Connection-type and SSID values) then rename them to “At Home”, or simply “Home”

Any thoughts on how this could be achieved, or even if it is possible?

Thanks.

You could put that logic in an MQTT Device Tracker. Alternatively If you use a tracker associated with your router, it will take precedence over those from GPS. I’m not a bit fan of router trackers though because (allegedly) modern phones can disconnect from wifi when idle, and they can take a while to realise you’ve left. You could alternatively use an MQTT tracker that does its own gps logic but is set to source ‘router’ to take precedence. Personally, I use Espresense devices in the house, which are cheap, fast and accurate (but I only have iPhones to track).

Regardless you can’t really set the state of a device tracker to something of your choosing and expect it to make sense to “person” because that only expects two states - home and away. Even if you set the state to “subdivision”, you would need to set this as either payload_home or payload_not_home.

Thanks, Michael.

I subscribed to the Nabu Casa cloud so I could have the companion app detect when I entered the subdivision and thus give me early warning of when I or my wife arrived home. (I was using Apple’s Home app to do the same, but that has a fixed ‘home’ radius, which was way too small - I only got the notifications as she was pulling into the garage!). HA gives me more flexibility to set my home radius to something useful.

Well, if I can’t ‘tailor’ the state, I may go with Plan-B, which is to add another ‘helper’ ‘toggle’ entity that I can set true if HA detects my phone is on my WiFi, and false if not. I can then display that as a secondary trait for the person, sorta like:

Person 1: Home/Away. #from HA Person entity
Person 1 In House: True/False # based on WiFi detection

It would be nice if I could simply rename my Home zone to Subdivision, but then HA would then automatically create another Home zone that would screw things up.