Open ryanwinter opened 7 months ago
I wholeheartedly concur. I experience the exact situation. I get it that mathematically one is not a group, but functionally, this logic breaks automations.
I have a dead smart bulb to replace in a vaulted ceiling fixture, one of two bulbs in a group... Had to change my UI and automations to be able to turn it off manually or automatically.
I agree it would be useful to avoid this kind of filtering for exactly this reason: if a group of size 2 has a device failure, it shouldn't result in destroying the whole group.
I'm wishing if this was implemented because so situations groups of 1 are automatically created. Perhaps a config option would work?
I've spent some time digging into the code. The assumption that groups have a minimum of 2 members is in a few places, so it's not super trivial to fix. There are tests that assume this as well, so it's taking a while to fix everything.
@agoode I would put your efforts on hold for a bit. This repository is not the ZHA you use in Home Assistant (yet) and not in a state to accept contributions and new features.
Ok, thanks! I did notice both repositories and assumed this one would eventually replace the one in HA.
OK... started thinking about this. Here is a challenge: you add a fan, a light, and a switch to a group. What platform should the group entity get created for? One of the reasons for the 2 device with entities from the same domain restriction is so we know what platform to create the entity for.
There are other edge cases as well... what happens when you have 1 light and 1 switch in a group? we could arbitrarily pick a platform to create the entity for... but then if you add another device for either platform we may swap the group entity platform and therefore the entity id... that would break stuff.
Let me know if I am not explaining this clearly and I'll try to table out some examples.
OK... started thinking about this. Here is a challenge: you add a fan, a light, and a switch to a group. What platform should the group entity get created for? One of the reasons for the 2 device with entities from the same domain restriction is so we know what platform to create the entity for.
There are other edge cases as well... what happens when you have 1 light and 1 switch in a group? we could arbitrarily pick a platform to create the entity for... but then if you add another device for either platform we may swap the group entity platform and therefore the entity id... that would break stuff.
Let me know if I am not explaining this clearly and I'll try to table out some examples.
? If there is only one device, it is clear which domain to choose. I do not see how this connects to the request to enable groups with one device member only.
And for your comment - I do not know if this is technically possible - on group creation one could select the domain the group is for and then can only add devices of that domain.
My situation here is that I have a group with 2 lights, and one of them failed so I ordered a new one from Ikea. However in the interim, because there was now only one light in the group, it was never discovered (from this logic) and therefor all my dashboards and automations that depended on that entity are broken.
My proposal would be to surface all groups, regardless of the number of members in situations like above.