Zha.issue_zigbee_cluster_command does not work as expected

Tags: #<Tag:0x00007f3f14c094a0>

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