Composite Device Tracker Platform

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.

I must have said this in another topic, but I did send an e-mail to the person who wrote the Person component and told him about this code and said he should feel free to leverage it. I did not get a response. Feel free to make the same suggestion. I’d be happy if they benefited from my work to make the Person component better. One less thing for me to maintain. :wink:

1 Like

I’m not sure if this is a stupid question but how do we do that?
Your custom components are all exceptionally good and I would love to see this one especially (or the features it offers) become part of the core HA.

I’d miss your support though :slight_smile:

1 Like

Sad that no response… But not a surprise.

I’m pretty sure the person system was designed around who’s logged into home assistant and what area they are in. I.E. This is the foundation of displaying views/cards based on who is where. I.E. simple user access controls for the UI. I think that’s going to be the focus at first. Then all the other stuff will improve over time.

Well, as usual, when you get all the information it seems reasonable.

It is a shame no one communicated back to @pnbruckner or that the information given out with new features is often so sparse.

And yes, I know that (1) you are only passing on what you know or have heard/read and (2) that disseminating information is time consuming and not always high on the agenda of something like an open source ‘volunteer’ run project.