Best practice for managing a group/sets of devices

Hi All,

I have a few Shelly switches deployed around my house with more coming (although I suspect my question applies to a lot of device types), and I am trying to work out the best way of dealing with them in HA. Specifically I have a couple of different scenarios that I am trying to find the best way for, mainly regarding how to avoid duplication.

Firstly, automations. I have a common automation that applies to all the devices that triggers based on an entity state change. Now I know I can list multiple entities in the trigger of the automation, or I can put all the entities in a group and trigger the automation based on the group state, but both of these approaches require me to remember to add an entitiy when I add another device. It would be better is the new entity was ‘discovered’ when I add the device, is there a best practice way of achieving this?

Secondly, lovelace dashboards. I have a template set of cards I display for each device. At the moment I need to duplicate the cards each time I add a device, but again it would be great if there is a way of ‘discovering’ the new device and automatically creating the additional elements. I know there is the auto-entity card, but it only seems to support using a single card type for the repeated elements. Is there another way I can handle this?

Appreciate any suggestions of recomendations you can provide. The scenarios above I have simplified, but hopfully they are enough of an example to demonstrait the reuse/repeat patterns I am trying to use with my config.

Cheers
Sam

If i understand your question correctly…
Only way i know of is in configuration.yaml add groups and your entities to the groups.

example:

light:
  - platform: group
    name: kitchen lights
    entities:
       - light.kitchen_light
       - light.kitchen_table
       - light.cabinet_lights

also make certian you have groups enabled in configuration.yaml too:

group: !include groups.yaml

In my example your group of lights will now be “kitchen lights”

1 Like

Yeas at least with groups you only have to add the new device in one place instead of all the automations and scripts.