How to change zigbee group binding from automation?

Hi,

Is it possible to change zigbee group bindings from automation in ZHA?

In my scenario I want to use IKEA Tradfri remote’s left/right arrows to choose the lights I’m controlling.

I was able to do it in zigbee2mqtt quite easily by sending mqtt messages. Now, after switching to ZHA I can’t find a way to do it. I’ve tried sending various zigbee commands to different groups, but nothing worked.

Choosing binding group from ‘Manage Clusters’ works fine.

Best,
Tomasz

As far as I know, ZHA doesn’t currently offer a means of doing that (i e. no service call to perform that function). Go to Developer Tools > Services, type zha. and it will list all available services for the ZHA integration.

For more information: Binding and Unbinding

Looks like it’s a matter of exposing binding related API functions here:

I’ll have a look into it, if I find some spare time.

“zha-toolkit” can be used to achieve zigpy API/CLI and Zigbee low-level stuff that does not yet support, other than that this would probably have to be a feature request for Home Assistant’s ZHA developers.

https://community.home-assistant.io/t/zha-toolkit-toolkit-providing-low-and-high-level-zigbee-commands-through-zha-zigpy/373346

This question needs clarification: you want to change the bindings OR you want to send a command to a certain group from HA?

As suggested, zha-toolkit can change bindings, and you can also change several binding when you open your ZHA integratino from ‘/config/integrations’ , then “CONFIGURE”.
You’ll get:

where you can create groups and add/remove elements from a group after clicking on the group.

I do not know you Tradfri remote control, but if you can the tradfri can be used to select the group that you want to send the command from the remote to, then ou have to create groups so that you group lights in a certain group and your remote as well. I suppose that you remote functions may be bound to different groups, so that you can select one group and another. I do not know how that works exactly on the remote. Maybe adding the remote to multiple groups is enough so that it knows it it bound to all those groups and it may just let you walk through the groups with the buttons.

Objects can be in multiple groups so they will react to commands from any group they are in.

Now you also found “Binding group” in “Manage Clusters”, so that is for the same thing.

If you want to use your remote to trigger an automation in HA, you can detect the button in HA by observing zha events, and that can trigger an automation which could change some state value.
Then you could use that state value to know what you do when you are controlling your devices, from HA and you do not need to use the bindings for that.

Now you can send a zigbee group command using zha itself, there is a service for that:

service: zha.issue_zigbee_group_command
data:
  group: 3
  cluster_id: 0
  command: 0

This would send command 0 to all cluster 0 of the devices in group 3. You can use that in an automation.