Group for Device Tracker Devices

Dear all, I would like to create a device group to group my mobile devices together and use the group as a trigger. The devices are presented in the form of device tracker, i.e. However I tried all categories in the Group but none of it allows me to select my device as entity. Could someone give me an idea how to do this?

Thanks a lot.

Welcome, this is something that will need to be done in yaml and can’t be done via the Ui at present.

You will need a file editor installed, check here:

Then you can create a group in your config.yaml

1 Like

Thank you rossk. Hopefully we can complete this in UI in the future. It would be more user friendly, especially for those with less knowledge on coding like me


Hi there @rossk,

I’ve tried to do that adding this to my configuration.yaml:

  - platform: group
    name: "Smartphones"
      - device_tracker.device1
      - device_tracker.device2
      - device_tracker.device3

When I test the yaml I get the error that config is not valid:

Platform error - No module named  ''

What am I doing wrong?

Any ideas folks?

Same error here :confused:

Configure it properly… :upside_down_face:

You have an extra : after entities.

The “Old-Style” groups that work with device tracker entities are configured under the top-level key group not device_tracker:

    name: "Smartphones"
      - device_tracker.device1
      - device_tracker.device2
      - device_tracker.device3

Depending on exactly what you are trying to do, you may also want to take a look at the Composite Device Tracker custom integration.

1 Like

thx @Didgeridrew , i’ll look into this.

I tried to create an old-style group using device_tracker entities, and it seems to be created fine, but I can’t seem to reference it in a card or anything?

I’m not sure how to determine the entity id for it? Should it be

group:                                         #domain
  smartphones:                                 #object_id
    name: "Our Smartphones"
      - device_tracker.device1
      - device_tracker.device2
      - device_tracker.device3

An entity_id follows the pattern domain.object_id. In the example above, the entity_id will be group.smartphones.

I actually figured out what I did wrong. I’m using a separate package yaml file to declare my custom resources and I accidentally renamed it from *.yaml to *.json. Operator error. I renamed the file back and everything works as expected. Sorry for bothering you with the dumb mistake on my part :slight_smile:

1 Like

Is there a way to configure Composite, that the status is only “home” if all devices/entities are “home”?

Not that I know of, you would need to use the legacy Group integration.

Please, can you explain how to use the legacy group integration in a way, that the groups can be assigned to persons?

Sorry, I should have been more clear. You can’t assign a group entity to a person, only device_trackers can be assigned to a person. The group is just a method to get the as to whether they are all home. That could be used in an automation to control a device_tracker entity.

  - platform: state
    entitiy_id: group.all_devices
condition: []
  - service: device_tracker.see
    dev_id:  all_devices
    location_name: "{{ trigger.to_state.state }}"

You shouldn’t need to set up an entity beforehand, calling the device_tracker.see service with a new dev_id should create a new device_tracker entity that can then be added to your person.

Thanks for the explanation. Am I right that I can’t create such a group of device_trackers within the UI but in YAML?

Yes that is correct, it must be configured in YAML.

1 Like