As far as I can tell, at this point in time, there does not seem to be any advantage to using the person component if you’re already using my custom composite tracker to combine multiple device trackers. And, honestly, right now, if you only have one device tracker, I don’t see a reason to use the person component either. But I don’t think they’re done adding features to the person component, so my opinion may change in the future.
If that’s true, then yes, at that point it might become useful. But are you sure? I would think that user accounts would do that, which are different from person entities.
Released 1.10.0
This adds a new, optional feature whereby updates from GPS-based trackers will only be used if movement is detected. Specifically, the update will only be used if the circle defined by the new GPS coordinates & accuracy does not overlap the circle defined by the previous GPS coordinates & accuracy. This can be helpful if using “input” trackers that correspond to physically different devices and one or more of them are, e.g., left at home.
To use the new feature add the following to your config:
require_movement: true
I really hope I’m not being stupid here…
Twice today my composite has marked me as away and I can’t work out why.
My composite uses three entities all correctly showing me home all the time since yesterday evening.
Life360
Google Maps
Unifi router
@pnbruckner After som more expansive testing I really love the implementation You made possible! Thanks.
Now I just have to learn not to restart my Home Assistant when I’m not home, as that seems to default to the device marked as home, every time. Thats more of a “me error” than any thing else.
Thanks!
Sorry, I was on vacation/holiday and just got back. Do you have debug enabled at least for custom_components.composite.device_tracker
? If so, you should see messages in home-assistant.log indicating when the composite tracker updates and from which other tracker it is updating. E.g.:
2019-08-09 08:43:27 DEBUG (SyncWorker_4) [custom_components.composite.device_tracker] Updating device_tracker.phil from device_tracker.google_maps_xxx
If you find the message that corresponds to the same time as when the composite changes to the wrong state, then you’ll know which “input” tracker it got that state from and you can then look more closely at that one.
No problem.
It hasn’t happened again, (or at least I haven’t noticed it!) so I am thinking it was a glitch somewhere.
Thanks for getting back to me.
You’re welcome!
When the integration first starts it will attempt to update the composite tracker based on the current state of the input trackers. The only way (I think) that the tracker will be set to home is if one of the input trackers is home at that point. As I just mentioned above, if you enable debug you can see when the composite is updated and from which input tracker it is updated.
In case it does happen again, make sure debug is enabled for at least the composite device_tracker, and maybe for the others as well. Then if/when it happens save home-assistant.log with the details of what happened. It would be good to know why this occurs.
It happens when I restart Home Assistant and one of the trackers are located at home. If I’m not misreading your statement that’s normal?
In that case it’s only an issue as long as I still set up automations when I’m not at home. Hopefully I won’t be tinkering forever (although it’s way to funny).
Yes, if when HA (re)starts one of the input trackers is home, then it’s completely normal for the composite tracker to also be home. If that input tracker should not be home at that point, then that’s where the problem lies – i.e., in that “input” tracker, not the composite.
So, is that what you’re experiencing after a restart? I.e., one of the input trackers’ state is home when it shouldn’t be? If so, out of curiosity, what type of tracker is it? Any idea why its state is home when it shouldn’t be?
Nope, sorry for the confusion. One of my phones were laying at home still turned on. So my question was originally if this was normal even though the one I was carrying had the latest update. It’s logical though that the require movement tag would reset after a restart.
Thank you for clarifying!
I am trying to move this to HACS but can’t find it.
What address and type should I be using to add the custom repository.
Added and working. Thanks
Tried to set up a new tracker with just a nmap tracker and a Bluetooth tracker.
Based on docs
If only non-GPS-based devices are in use, then the composite device will be ‘home’ if any of the watched devices are ‘home’/‘on’, and will be ‘not_home’ only when all the watched devices are ‘not_home’/‘off’.
I expect this to be home if either of them are home but this does not seem to be the case and composite tracker shows as away most of the time as if either one is away it shows as away.
Am I miss understanding anything.
Your expectations are correct.
What are the source_type
attributes for the device_tracker
entities the composite tracker is using? Are you seeing any warnings/errors?
You may want to set the logger
level to debug
for custom_components.composite
.
It’s been a while since I’ve had anything to say about this component - it just works.
But I have a request.
My recent issues with google have meant that very often for a minute or two (or more) the only device tracker reporting ‘home’ was a router based one. This means that the composite has no lat/long info so my reverse geo-code sensor can’t do its thing which means my cameras based on the device tracker show a location somewhere in central Europe (I believe, the headquarters of Here Maps which is what I use for reverse geocoding.
Would it be possible to have the composite populate the lat/long with that of the zone in which the router based trackers are located?
I hope that makes sense…
It should already be doing this, at least in some circumstances.
If a non-GPS based tracker changes state to home
, and if it contains GPS data (some do, which would typically just be taken from HA’s location configuration), it will be used. If it does not have GPS data, then it will use the existing GPS data of the composite tracker if that data is in zone.home
. In either case it will change the source_type
to gps
to make sure the component level code uses the GPS data.
So, let’s say a GPS based tracker comes home. At that point the composite tracker should contain that GPS data. Now let’s say that GPS based tracker stops updating for a while. During that period if a non-GPS based tracker changes state and is now home, and it does not itself contain GPS data, the composite tracker should retain the GPS data it had from the last update of the GPS-based tracker.
Also, if a non-GPS based tracker changes state and is now home, and it does have GPS data, it will be used, regardless of what GPS data was available before.
Now let’s say the last update of the GPS-based tracker was somewhere other than home, and it stops updating, and during that time a non-GPS based tracker changes state and is now home, but does not contain GPS data itself, then the composite will change to home, but will not have any GPS data. Is this last scenario the one you’re asking about?
The reason I wrote it to work this way was I didn’t want to just use the home location from HA’s configuration when any non-GPS based tracker changed to home. Otherwise, if a GPS-based tracker was still updating, the GPS location would keep bouncing back and forth to where the device really was and the center of the home location. Yet I didn’t want the GPS data to go away either when a non-GPS based tracker changed to home if there was still valid GPS data from a GPS-based device.
I suppose one thing I could do is to add a test that checks if a non-GPS based tracker changes to home AND the previous state of the composite was not home, AND if the non-GPS based tracker does not have GPS data, then use HA’s home location configuration data. That seems to make sense and might satisfy your request. What do you think?
As I understand it, router based trackers are always considered in zone.home
. Is that not the case? For your router based trackers, do they contain latitude & longitude attributes?