Create group in custom component


I have created a custom component which define 3 mqtt sensors.

I would like to create a group automatically with the 3 sensors.

And if possible add this group to another group.

How can I code that ?

Has someone an example ?


I’d be interested in this. Want to modify the hadockermon custom component to put everything it finds in a docker group

I did search a lot in the forum but didn’t find any clue.

There’s not really a way currently, and most of the suggestions i did find were bad practice.

Went with naming the entities with a prefix while retaining the friendly name so that in the new Lovelace ui you create a group with an entity filter finding all entities with that prefix