Zha.issue_zigbee_cluster_command does not work as expected

I have got a Smartthings Zigbee siren and wanted to make a sound. Therefor I issued a zha.issue_zigbee_cluster_command. But for this command, zigpy needs 4 arguments.

Now it is so: in homeassistant/components/zha/api.py the arguments are defined as a string:

   SERVICE_ISSUE_ZIGBEE_CLUSTER_COMMAND: vol.Schema({
        vol.Required(ATTR_IEEE): convert_ieee,
        vol.Required(ATTR_ENDPOINT_ID): cv.positive_int,
        vol.Required(ATTR_CLUSTER_ID): cv.positive_int,
        vol.Optional(ATTR_CLUSTER_TYPE, default=IN): cv.string,
        vol.Required(ATTR_COMMAND): cv.positive_int,
        vol.Required(ATTR_COMMAND_TYPE): cv.string,
        vol.Optional(ATTR_ARGS, default=''): cv.string,
        vol.Optional(ATTR_MANUFACTURER): cv.positive_int,
    }),

And homeassistant/components/zha/core/device.py makes the following call:

response = await cluster.command(command, *args,
                                             manufacturer=manufacturer,
                                             expect_reply=True)

So it unpacks the arguments with *args. But since args is a string, the string is splittet into separate characters. “1234” becomes “1” “2” “3” “4”.

This means for my command

{
“ieee”:“d0:cf:5e:ff:fe:43:cc:75”
“endpoint_id”:1
“cluster_id”:1282
“cluster_type”:“in”
“command”:0
“args”: “4200”
}

I can only send 4 single digits, not 4 numbers. I think this is not good.
Instead of *args it would be better to use *args.split()

1 Like

As far as I know, args are not yet implemented properly

FYI, support for siren entities in ZHA integration component was now added to Home Assistant’s core:

https://github.com/home-assistant/core/pull/60920

https://community.home-assistant.io/t/zha-integration-to-use-siren-entity-platform-for-zigbee-sirens-doorbells-and-chimes/343075

That PR https://github.com/home-assistant/core/pull/60920 made it into the 2021.21 release so if your device is not seen as a siren (even after remove and re-join it) then it need that specific device will probably need a custom quirk in ZHA Device Handlers, see → https://www.home-assistant.io/integrations/zha#zha-exception-and-deviation-handling

1 Like