Help! zigbee.command() not working

I just managed to finish one dth yesterday after months of being unable to find a solution to my problem. Now that I had thought I finally figured out how to fix my issues, I moved on to another dth for a different device. I call zigbee.command() exactly the same way, going as far as to copy-paste in all the functions and the call itself, but no matter what I do, I still get the error

groovy.lang.GroovyRuntimeException: Could not find matching constructor for: physicalgraph.zigbee.zcl.ZCLMessage(null, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.util.ArrayList, java.util.ArrayList, java.util.ArrayList, java.lang.Integer)

The call I’m making is simply

zigbee.command(getCLUSTER_WINDOW_COVERING(), getATTRIBUTE_POSITION(), hexData, getENDPOINT1())

getCLUSTER_WINDOW_COVERING() returns 0x0102
getATTRIBUTE_POSITION() returns 0x05
hexData is the integer parameter
and getENDPOINT1 is [destEndpoint:0x01]

I tried using import physicalgraph.zigbee.zcl.DataType but that didn’t fix it, and my other dth didn’t need it anyways. What’s going on? I even deleted the dth and made a new one with the same code and it still didn’t fix the issue.

Your functions aren’t returning what you’re expect them to return. There are 10 parameters being passed. Note that Groovy is a dynamically typed language so you need to be careful that your functions return the correct values

That’s definitely what it looks like, but I am completely clueless as to how that’s possible. I did a printout of each of the values individually, using the same functions and got:

Window cluster: 0102
Attr position: 05
hexData: 00
Endpoint: [destEndpoint:1]

Despite the error printout saying the first value is null, none of these above values are null. All of these values seem right. I even hard coded the values and put them through zigbee.convertToHexString() to be

zigbee.command(zigbee.convertToHexString(0x0102,4), zigbee.convertToHexString(0x05,2), hexData, [destEndpoint:0x02])


zigbee.command("0102", "05", hexData, [destEndpoint:"01"])

And I’m still getting the exact same error for both of these.

Just wanted to add this in in case it helps, but another weird thing is that the error points to the last line of code before the zigbee.command function, regardless of where it’s placed. But I know it’s the zigbee.command function, since the error disappears once the line is removed.

This isn’t a valid command. Try this instead:

zigbee.command(0x0102, 0x05, hexData as String, [destEndpoint: 0x02])

I just tried that (it gives the same error), as well as

zigbee.command(0x0102, 0x05, "00", [destEndpoint: 0x02])

But this hard-coded payload one seems to break the dth entirely. It either won’t respond, will disappear from the location, or will appear, but with the sliders missing.

That’s not related to the DTH. It’s a mobile app server issue.

This is the correct method format since you’re no longer seeing an runtime constructor exception, if the device isn’t responding check your parameters, configuration, bindings, endpoints etc.