I get a latitude and longitude from Life360. How do I get the zone when the device is in a zone defined in Home Assistant??
When a device is in a zone its state will be the name of that zone. (Well, except for “Home”, in which case the actual state will be home
, although it will still show as “Home” in most places in the UI.)
That works. I built a zone around where my wife was shopping and the state was always “not-home”. I added another zone along her route home and when she entered it, state popped up with the zone name. I don’t know why the first zone didn’t work. I wonder if it’s because she was already in the zone when I created it and the zone state only changes upon entering the zone?
It’s not the “zone state” that really matters here so much. It’s the state of the device tracker entity. And its state only changes when it gets an update from its source (in this case the Life360 server, which by default is queried every 10 seconds), and something actually changes. If the device did not move, and its battery level hasn’t changed, and…, then it’s possible its state (I mean the whole state, including attributes) does not change for a while. If while it’s not changing you add a zone “around it”, that in itself won’t cause the device’s state to change. But the next time anything changes in the data from the server, its state will update, and if at that time it is inside a zone, then the state will change to the name of the zone (or “home
” if it is in the “Home” zone.)