I have set up the HA app on the phones of my wife and I. The person tracking (and other functions) are working well. My problem starts when I use Node Red to configure automations based on the state of the person being tracked.
When using the Events State node to see whether a person is “home” or “not_home” the state randomly changes. I use Developer Tools to check the state of the person and it says the state is “Home”. Note the capital “H” in Home. So, I configure my Events State node “If State” to “is” and “Home” and everything works fine.
A couple of days later I notice that the automation has stopped working. When I check the person tracking in Developer Tools is says the Person State is “home” (note the lower case “h” in “home”.) So, I go back into Node Red and edit the “If State” of the Events State node to “home” with the lower-case “h” and everything works again. Obviously the configuration of the “If State” is case sensitive.
The problem is that some days later the Person State changes back to “Home” inside HA and the automation stops working again! This is driving me nuts. I have no idea why the state generated by HA changes from lower case to upper case and vice versa, randomly.
Any clues?
Take a look at the STATES tab on the Developer Tools page and look for zones. Do you have any zones whose friendly_name
is Home
, other than zone.home
?
I think you are on to something. I do have a zone named “Home”. I changed its friendly name to “Residence” and now my wife’s person tracker has a state of “Residence”, though mine still shows “Home”. Not sure why they are showing up differently, but I have something to work with now. Thanks for the clue.
If you don’t “manually” create a zone for home (i.e., zone.home
) the system will automatically create one for you based on the latitude/longitude in your system configuration. Either way that is the zone that is used to set your device trackers (& hence person entities) to little-H home
(no matter what that zone’s friendly_name
attribute is.)
If you don’t like the automatically created zone.home
you should override it. Either way, you should probably not create another zone that overlaps with zone.home
. You can, but if you do, it can interfer with setting your trackers/persons to home
.
Besides the zone you created with the name “Home” (and now changed to “Residence”), did you also see a zone whose entity_id is zone.home
?
Hi again. No, I didn’t have a zone called “home”, but there is a zone named after my street address, which appears to have been created back in the early days of setting up HA. It was not immediately editable, but I have been able to change the name in customizations and have now called it “home”. I also deleted the zone that I had created (residence) as it is effectively a duplication of the original zone.
It think I’m good now. Thanks.
To be clear, I’m not talking about the “friendly name” of the zone. I’m talking about the entity_id. When you look at the STATES tab of the Developer Tools page, are you sure you don’t see an entity whose entity_id is zone.home
(i.e., as shown in the first column labeled “Entity”)?
I’m guessing the one that you said was named after your street address, which you just changed to “home”, is the zone I’m talking about.
I don’t think you should override it’s name via customizations. I believe it gets its name from what you entered in the “Name of your Home Assistant installation” box at the top of the Configuration -> General page.
Bottom line, when a device is in zone.home
, its state is set to home
, regardless of what zone.home
's friendly name is.
At the very least, deleting the zone that overlaps with zone.home
is probably a good idea. As I said, you can do that, and some people have a good reason to do so (such as having a larger zone used in automations), but you have to understand how the overlapping zones work together.
yes, you are correct. After making the change in the customizations.yaml file, I restarted the system and it came back with a notification saying that the customization.yaml file could not be read (or something along those lines.) Further checking revealed that the original zone (named for my street address) was retained and the state of my two person trackers is now “home” with the lower case “h”.
I must learn to document things I change so that I can recall them later. Your note about overlapping zones jogged my memory and I remember creating the second zone (the one I called “Home” with a capital “H” and later changed to “Residence”) because I wanted to trigger one event when the person was within 200 metres of home and another set of events when the person was 50 metres from home. The result is what you have witnessed in this thread.
As it happens, since I have been using Node Red I have come up with better ways to do things and don’t need the concentric zones anymore.
Thanks for your assistance. The problem is solved and I have a better idea of what goes on, especially during the initial configuration of HA.
1 Like