Group known devices into one virtual device

Suppose this is a common question, but I didn’t find the answer using quick search, so sorry :slight_smile:

I wonder, if I have lot of presence detection sensor on my mobile phone (wifi connection, router ping, GRPS logger etc) - what’s the quickest way to display (and handle in events) my device in general?

How can I group all sensors into one user like this, displaying one name only?

Maybe this will help:

The point is: to group existing devices from known_devices.yml into one. So I can use physical device (my mobile phone with a bunch of sensors) in events instead of dozen separated sensors. Example: trigger “im home” when phone connects to home wifi, trigger “im at work” when phone enters specified coords.

Your idea seems cool but I see it quite difficult to implement (at least, I didn’t understand it well, sorry :). Because a lot of devices are not attached to MQTT directly.

Is this issue should be solved by using common practices? Just wondering.

You can’t, quite, do what you’re after trivially.

A group of the devices would be home or not_home. You’d use the device tracker of the phone for remote locations, and the group for home/away.

You could create a template sensor that draws on these to provide a merged view:

- platform: template
      friendly_name: "person1's location"
      value_template: '{% if is_state("group.person_person1", "not_home") -%} {{ states.sensor.person1s_time_to_home.attributes.duration }} to home{%- else -%} At {{ states("device_tracker.person1_mobile") }} {%- endif %}'

That’s one I use that displays the zone the person is in, or their travel time to home if they’re not in a zone. You could use a similar approach.