There are automatic groups like group.all_devices
, group.all_lights
, and group.all_switches
. How are these generated programatically? I’ve been looking at https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/light/init.py for awhile, but I can’t see how it build them. I do see references to group.all_lights
, but wasn’t sure how it was created.
I actually found it as I was finishing writing it up:
- this creates a new EntityComponent https://github.com/home-assistant/home-assistant/blob/a4b8c3cab0b3e3a7613924492535c13cd39d3114/homeassistant/components/light/init.py#L170-L173
- EntityComponent is the thing that manages groups (the last arg is a group name): https://github.com/home-assistant/home-assistant/blob/a4b8c3cab0b3e3a7613924492535c13cd39d3114/homeassistant/helpers/entity_component.py
2 Likes
I just wanted to mention that I personally appreciate that every time you look for something, when you find it you share your links with everyone. It’s that kind of participation that makes this a great community. Thanks!
1 Like