Out of Bounds on a get

Trying to get a supposed available parameter for a device and getting an error. There are 2 parameters and the other 1 works fine. But the 2nd one throws this error:

warn Exception ‘java.lang.IndexOutOfBoundsException: toIndex = 4’ encountered parsing 'cmd: 7006, payload: 02 02 00’
debug parse() >> zwave.parse(zw device: 58, command: 7006, payload: 02 02 00 )

It throws the error at this command: def cmd = zwave.parse(description, [0x20: 1, 0x26: 1, 0x70: 1])

If I try another parameter that is not supposed to be available at all, I get the same response except the toIndex value is 3 and the payload looks like this: "payload: 03 00)

If I try an invalid parameter on other types of devices I just get a parse return of an empty string.

Any thoughts on what I’m missing?

Anyone have any thoughts on this? Should I open a ticket to smartthings? Or will they just reject it because it’s not an official “works with smartthings” device? I can’t figure what it could possibly be from a code perspective - getting a parameter is pretty basic and I’ve done it a ton otherwise. :slight_smile:

Well, just to report back, I finally figured this whole thing out. The z-wave spec says a configuration report format is [command class] [event code] [parameter number] [parameter size (1, 2, or 4)] [value in as many bytes as the size calls for]

In the above, the event code 06 is for a configuration report and the first 02 is the parameter. But the second 02 tells SmartThings to expect two more bytes - then it only gets 1. That’s because the parameter is actually only 1 byte long.

Now, of course, this makes perfect sense as the “toIndex = 4” is telling me that when it got to the 4 byte of the payload it blew up because it wasn’t there.

I reported the issue back to the manufacturer and in the meantime just built a little routine into the parse method to fix the size when it gets that specific report.

Having the z-wave spec is kinda cool for this - wish I had seen it sooner.