zigpy / zha

Zigbee Home Automation
Apache License 2.0
25 stars 22 forks source link

Migrate groups from coordinator entities to actual devices #149

Open puddly opened 2 months ago

puddly commented 2 months ago

The issues @dmulcahey brought up in https://github.com/zigpy/zha/issues/47 regarding platforms are interesting corner cases that crop up when Zigbee functionality doesn't translate directly to Home Assistant platforms (e.g. a light and a switch both have OnOff clusters and can form a Zigbee group).

One way we can work around this is by turning groups into actual devices: this would allow automations to "turn on" the group device as a whole and the primary entity would be controlled, regardless of its platform. It would also allow the primary entity to switch platforms depending on group composition, which would open up the possibility of heterogeneous groups (1 fan, 1 light, 1 switch) or single-device groups.

Thoughts?

dmulcahey commented 2 months ago

One way we can work around this is by turning groups into actual devices:

I would suggest that if we go down this path that it is contained in the HA side only since that is the only place where this distinction really makes a difference. They are only linked to a device to take advantage of device actions / conditions / triggers.

which would open up the possibility of heterogeneous groups

I like this idea but I also think it could lead to confusion… it holds up well when clusters are the same but toss a fan into the group and now turn on / off semantics get kinda funky. Exposing zigbee scenes may make more sense? Or just avoiding the zigbee scene complexity and advising folks to use the HA scene functionality…

It would also allow the primary entity to switch platforms depending on group composition

This may be considered an undesirable / destructive action by the users? Folks may not be pleased if they are leveraging / targeting the entity in an automation or a script and we change it out from under them because they added another device to the group.