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())

Where
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])

and

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

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

EDIT:
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.

Thank you for your time. I’m still facing issues here, though. I was messing around with changing the hard-coded payload into other things, and passing in a number instead of a string in the payload showed a more accurate error:

groovy.lang.MissingMethodException: No signature of method: physicalgraph.zigbee.Zigbee.command() is applicable for argument types: (java.lang.Integer, java.lang.Integer, java.lang.Integer, java.util.LinkedHashMap) values: [258, 5, 0, [destEndpoint:2]] Possible solutions: command(java.lang.Object, java.lang.Object, [Ljava.lang.String;), command(java.lang.Object, java.lang.Object, java.lang.String), command(java.lang.Object, java.lang.Object, java.lang.String, java.util.Map) @line 133 (setSecondaryPosition)

This at least looks like an accurate error. But as soon as I changed it back to a string through any means of toString, String.format, hardcoded string, etc. I get

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)

This just does not make any sense to me. I give it an integer and it tells me it wants it as a string. I give it as a string, and it tells me it can’t find the constructor. This is very frustrating, and I cannot figure out how or why this is happening.

Actually, I see what you mean now. The zcl.ZCLMessage seems like a lower-level function and is probably failing on something there.

Does the fact that this is a virtual device change anything? Do virtual device connections need anything special in the configuration to work?

The zigbee command will only work on a ZigBee device which has been paired with the hub

Thank you, that clears up a lot. So, given this, will it just always throw that error for any time someone tests with a virtual device? Would I need to set up a virtual hub again and pair it to that to stop the errors, or do I just ignore the errors until I can use my hub again?