Composite Device Tracker Platform

Released 1.7.0

Add time_as option to control time zone in which time attributes are displayed, and possibly add new time_zone attribute with the name of the time zone in which the device is located.

BREAKING CHANGE from earlier beta releases: time_as option replaces times_as_local & times_as. Choices for time_as are now: utc, local, device_or_utc and device_or_local.

See full documentation for details.

Hi,

Under 86.x it seems that the binary_sensor and a router sensor is no longer properly factored in. I often have it being the correct enter/exit sensor but it seems the composite sensor hangs onto the IOS app location even if it’s slow to update.

So what was working really nicely seems to have deteriorated slightly.

Any ideas why?

I can’t imagine how the composite tracker’s behavior could have changed due to an update in HA. By design, when a GPS tracker has been seen, all router and binary_sensor entities will no longer change the composite entity from home. To put that another way, once a GPS based tracker has been seen (no matter how long ago), only the home/on states of router trackers and binary_sensors will be used. That hasn’t changed.

And there was quite a bit of discussion around this behavior. But, it was mostly centered around router trackers. Maybe it does make sense for a binary_sensor’s off state to change the composite entity’s state. Unfortunately, I’m not sure what to change it to, especially if the composite already has GPS coordinates. It’s easy to use the home zone’s coordinates when a router changes to home, or a binary_sensor changes to on, but what do you do when a binary_sensor changes to off? Do you just change the state to not_home and throw away the GPS data? This might require a bit more thought.

Anyway, I’m still on 0.84.6, so I suppose it is possible some change in 0.85.x or 0.86.x has had an effect, but my guess is the change you’re seeing is more related to the binary_sensor and/or router tracker.

If you can provide more details of what’s happening with the “input” devices and exactly how the composite is responding, and how you think it should, that would be helpful. Otherwise, not sure what to tell you.

I’m digging but it appears to be related to the iOS app now ignoring iBeacon exits.

I suspect that because the iOS tracker is not properly updating on home zone exit it’s a ripple effect and not the fault of the composite tracker.

So this means my HomeKit enter/exits are more critical as they become the next most foolproof leaving the home zone indicator.

If you want to let the binary_sensor’s ‘off’ state change the composite to not_home, then you can try changing this code (at line 213):

                if not self._use_non_gps_data(state):
                    return

to:

                if (source_type != SOURCE_TYPE_BINARY_SENSOR and
                        not self._use_non_gps_data(state)):
                    return

I haven’t tested this, but in theory it should work. If you do try it, let me know how it goes and if it helps.

Hi, I am having trouble to get the tracker working. I am using NMAP and Life360 trackers combined but as soon as my iphone goes to sleep it disconnects from wifi and composite tracker goes to ‘not_home’ mode. Am I missing anything or this is the default behavior? Here is my device tracker looks like.

  - platform: nmap_tracker
    hosts:
      - 192.168.10.111 #iphone7
    interval_seconds: 60

  - platform: life360
    username: !username
    password: !password
    prefix: life360
    show_as_state: driving, moving, places
    driving_speed: 18
    max_gps_accuracy: 200
    time_as: device_or_local
    max_update_wait:
      minutes: 45

  - platform: composite
    name: my_composite
    entity_id:
      - device_tracker.life360_user1
      - device_tracker.iphone7_nmap
    time_as: local

And following logbook entries include nmap, composite tracker and automations.

Logbook Showing entries for
January 27, 2019

9:40 PM
Notify Person State has been triggered
9:40 PM
User1 Status changed to Just Left
9:40 PM
user1 home turned off
9:40 PM
Mark person as just left has been triggered
9:40 PM
User1 Away has been triggered
9:40 PM
user1 composite is away
9:40 PM
USER1 NMAP is away

Thanks

If the entity_id device_tracker.life360_user1 isn’t correct (misspelled, whatever), or if it has not been seen since HA restarted, then when device_tracker.iphone7_nmap changes to not_home, so will the composite tracker. It would be helpful to know the history of device_tracker.life360_user1, device_tracker.iphone7_nmap and device_tracker.my_composite. E.g.:

grep 'new_state=<state device_tracker\.[^>]*' home-assistant.log -o

There will be sensitive data (such as GPS coordinates), so you probably won’t want to share all of it, at least not here. If you’re not sure how to interpret it, feel free to send it to me via private message.

I think you are right about it. I was playing around with few automations and between HA restarts, it may have lost its life360 status. Which might have caused false positive on composite tracker. I will keep an eye on logbook for few more days and monitor the behavior. Thanks for an awesome component. I was really tired of owntracks delayed/missed reporting and trying to find an alternative. Hopefully search is over!

1 Like

hi, im using this composite tracker to combine 3 device trackers, 2 gps based and 1 is network based.

is it possible to add picture to this composite tracker if i want to use it as a main device tracker same like we get for default device tracker and display in badge?

Yes, but currently you have to do it by manually editing known_devices.yaml. See the details here.

There is a new feature released in 0.88:

I haven’t looked at the details, and I’m still on 0.84.6, so I can’t really try it. But I’m interested in hearing if people think this new component would take the place of my custom component.

I just saw this. I’ve been using your custom component and it works very well. I will test this out to see how it works.

1 Like

I’ve only recently started using your component. Works well for my needs.

This new Person platform seems to be almost the same thing, but with a few extra built in features for HA to use. Guess it will work with the new Areas platform from the last release.

At first glance, it doesn’t show GPS accuracy, battery level, the list of devices, or source type. Everything else is there.

1 Like

As has been discussed, starting with HA 0.86, the folder layout in custom_components has changed. I’ve recently updated the installation instructions. custom_components.json (which is used by Custom Updater) has also been updated to be compatible with the new layout.

If you are installing this custom platform for the first time:

Then just follow the recently updated installation instructions

If you do not use Custom Updater, and are updating HA from before 0.86 to 0.86 or later:

Then you need to manually move/rename the file. The following Linux commands (or similar) should make the necessary changes:

# From config folder
cd custom_components
sudo -u homeassistant mkdir composite
sudo -u homeassistant mv device_tracker/composite.py composite/device_tracker.py

If you use Custom Updater, and are on a version of HA before 0.86:

Then you’ll need to update the following line in your configuration for custom_updater. Change:

  component_urls:
    - https://raw.githubusercontent.com/pnbruckner/homeassistant-config/master/custom_components.json

to:

  component_urls:
    - https://raw.githubusercontent.com/pnbruckner/homeassistant-config/master/custom_components_old.json

Once you update to HA 0.86 or later you should change it back.

If you use Custom Updater, and are on HA 0.86 or later:

Then you should be good to go. Just use the Custom Updater to install and/or update.

Note: You may need to clean up the old files after you install/update, if you care.

Thanks for this; but the devs made a comment that you also need to add a empty init.py in the integration folder for each component.

I’ve done that and it works for your component 2 days ago.

Did you try it without adding the empty __init__.py file? I’m not convinced it is required. But if it is, then that will complicate things greatly.

It seems to be ok without the init.py file added; and just the rename as you suggest.

1 Like

@pnbruckner I expect you are fed up with 0.88 but…

…any idea why I am being asked to remove time_as:?

image

  - platform: composite
    name: me_composite
    entity_id:
      - device_tracker.life360_me
      - device_tracker.google_maps_111111111111111
      - device_tracker.me_lg_g6_bluetooth
      - device_tracker.me_lg_g6_unifi
    times_as: device_or_local

Because you have times_as instead of time_as. Sorry, that was a change between the betas and the final release.

2 Likes

So this “persons” platform seems to suck pretty badly. It will not take anything besides device trackers into consideration. So it can not use a binary_sensor or input_boolean from HomeKit as a trigger.

It also does not cast the state as presence; so you get states like “not_home” and such. Means you need to be careful to catch them all.

It is too bad they just don’t ask to take your code and embed that for the persons feature but instead we will “go the long slow path” to get something working.