Better Device Identification

Hello Community,

Long time follower, first time poster here - very much a noob!

I’m part way through putting my first dashboard together using Mushroom. I would like to have a simple card that counts the number of people home at any point in time.

To that end, I’ve put the following code together below into a helper which gives me an “incorrect” answer. A number of the family have second phones for work or tablets which never leave home etc so the number I get from my code is artificially too high:

{{ states.device_tracker | selectattr(‘state’, ‘eq’, ‘home’)
| map(attribute=‘entity_id’)
| list | count }}

So my question is - how best do I exclude these additional devices? is it a simple exclude type statement (possibly via a group) in the above code? Ideally, I want the be able to read the state from the devices that are attached to Life360 for which I’ve installed the integration. It doesn’t appear however that there are any attributes for Life360 that allow selection.

Any guidance would very much appreciated.

Why not use the person entities then?

Associate the relevant trackers with the person, track the person.

1 Like

Set up your person entities like Tinkerer said, then use the state of zone.home which will be the count of known person entities present in the zone.

1 Like

If I can associate the person with the life360 entity then that will absolutely work.

Thank you kindly :grinning: