Add a newly detected device to a group

I’m not sure if this is possible yet, but I have a devices view that I’d like to add two groups to. One of which is a family or “home” devices; devices that belong to me and don’t leave the house. The second is a “visitors” group which new devices are added to. Currently I have this as group.all_devices but I’d like to exclude any devices that are in the “home” group. I thought I could use an automation with an action that adds the new entity to a group but not sure how to do this, any ideas?

Ooooh that could be interesting. A process that takes any new devices and places them in a particular group based on either name or entity_type. If you don’t like it there, you could modify the group easily enough later, and since it wouldn’t be a new device anymore, it wouldn’t get moved out of the new group you put it in.

So in addition to your use case, if I created a device that starts with my son’s name, then as soon as HA sees that device, if it’s not in a group, it adds it to a group of my choice which in this case would be a group of all the devices associated with his room.

I like that idea…

Are you opposed to an appdaemon app to do it?

Maybe not, on second thought they probably don’t re-write the groups file as the app closes down, so any changes we made dynamically wouldn’t be in the groups file the next time we start. Bummer.

No other ideas.

Pretty much! In my case, it wouldn’t be based on anything other than a new device/ip discovered by nmap. I’m not opposed to any ideas or even building something myself. If nothing exists that could do this already I’m thinking of modifying the HASS code myself.

I think the challenge would be that HA reads the group file at startup to build the group entities so somehow you would have to get any new group memberships you create into the groups.yaml file.