Possibility of changing Person state manualy

Should be usefull to have the possibility of changing state of any “Person” manualy (from home to not_home and viceversa).
In my case, in example, if i go away from my “home zone” I want to put my state on not_home. without wait the “consider home” delay of my device tracker.

Thanks for your time

You can create a binary_sensor that links to your person to achieve this.

Hi Petro,
yes of course, but in this case I would have:

1 “binary sensor”, that contains 1 “person”, that contains all “device tracker”.

I think that locically it doesn’t have too much sense.
What do you think about?

Thanks for you answer

How do you imagine this to work? After manually changing the person state, at what point should the person entity start again to automatically update the state? Can you not just reduce the “consider home” time?

Go to developer tools state list, click on your person, scroll to the top, put whatever you want in the state box, click the ‘set state’ button.

You can use the Home Assistant API.
The way I do it is by creating a person entity but don’t assign any trackers. That way HA won’t try to change it.
I then use NodeRed to track where ppl are on my property based on the WIFI access point they are connected to. That location is passed using the Home Assistant API of /api/states/person.personname to update their state. This lets me to set the person state to anything (like Barn, House, Garage, etc) not just home/not_home.

May I ask why you write the state to a person entity and not to a sensor entity? Just curious as you don’t get any advantage of using the person entity, but you get the disadvantage that you are no longer able to use the presence detection logic of the person integration.

Hi @Burningstone,
in my mind the “entity person” continues to follow it’s normal behavior: all device tracker state in OR condition.

So if I force “Person state” to not_home it return on home when a device tracker switch in state “home”.

Consider this case: I go to work and when I go out from my “home zone” my “person entity” switch to “not_home” IMMEDIATELY.
When I come back my device tracker swith to “home” and “person entity” follow him

Hi @PCRx,
I founded this solution but it’s a work around.
I wrote this post to understand if we have to apply this trick or if there is a possibility to introduce the feature to change manualy the “person state”.

Thanks for your answer

Sure, It’s for ease of use. When someone connects to the network I simply add them as a person in the HA UI. NodeRed uses the person entity and begins tracking them automatically to update their location no matter where they are on my property. I use it to track a couple dozen ppl over a dozen locations.
Some ppl are “regulars” and always have a person entity. Others are “random” so I add/delete them as necessary. The person list makes it easy to manage everyone directly from the HA interface.

Read through the person integration documentation, it’s not a simple OR of device trackers.

I don’t know how it exactly works, but I could imagine that if you switch the person to “not_home” manually while your device tracker is still showing “home” due to the consider_home setting, that the person will get set back automatically to “home” a few seconds later. You’d need to try. Leave home, change the state to “not_home” with the method suggested by @mf_social and check whether it stays at “not_home” or switches back to “home”.

1 Like

Ok, I see, thanks for the explanation.

You can create custom device trackers using device_tracker.see. Using that you might be able to get the behavior you want. Basically either have automation or UI that triggers calls to device_tracker.see and add that device tracker entity to your person as one of its tracked devices.

I haven’t tried this myself so I can’t say for certain if it would work. Your person entity would have multiple devices so I don’t know exactly how HA handles situations where one device says home and one device says not_home but it could be worth a try.

One caveat with this service, the device tracker entities created by device_tracker.see do not restore after a restart, they disappear until the next time device_tracker.see is called. So if you do try this idea out make sure to test that behavior. Hopefully HA is smart enough to ignore the device tracker when it doesn’t exist and not set the state of the person to unknown.

it depends on wheter you are home or not home and on the type of device tracker (gps, ble etc.), the person documentation explains it in detail. You need to set the source type to a stationary device tracker type (ble, router) for this to work in this case, because it has priority while you are home, meaning if it changes to not_home, the person changes to not_home no matter what the other device tracker shows. I use an MQTT device tracker for this and I just post “home” or “not_home” to the MQTT topic to update it. This devixe tracker will also persist after a restart.

1 Like

Oh that’s neat. Yea that does seem way better, I should look into switching over to that in my own use cases for device_tracker.see. Thanks!

Hi @Burningstone,
I tried to set manually my “person state” to “not_home”, but how you said, after 2 minutes it returned to “home”.

At this point my proposal is inapplicable without a deep refactor.

Thanks to all

Then I suggest using the MQTT Device Tracker with source type “ble”, publish “not_home” to the topic with a script, start the script with a button in the frontend.

In the end I resolved using the service device_tracker.see for set my ‘local’ device tracker to ‘not_home’ when I go away from ‘home zone’.
Thanks to all!