zwaveInfo and state

Hi all,

I am very new to writing Z wave driver using Groovy. I am trying to migrate a device handler code from ST to Hubitat. Both state.MSR and zwaveInfo.mfr return null value. Any idea what is happening? Thanks.

The platform does not set those values to anything on its own, so the ST DTH (I assume it's the same there, though my memory on that is faint at this point...) would have had to set them to something. Same on Hubitat. Is there some place in your code that is doing so but not working? If so, you'll have to troubleshoot that. What you're looking for will probably come into the parse() method (through either a get or the device sending it on its own for some reason) and is conventionally (though not required) delegated therein to an overloaded zwaveEvent() method, one of which should accept an object for the specific command class and version you're looking for (hubitat.zwave.commands.manufacturerspecificv2.ManufacturerSpecificReport, for example, or another version) as the result of zwave.parse().

If you aren't setting these values anywhere, then that's why. But it's hard to say more without seeing the code. If you're familiar with DTHs/drivers and Z-Wave, that should at least get you started.

Thanks for your reply. You are right, the manufacturespecicificv2 updates state.MSR with this:

def msr = String.format("%04X-%04X-%04X", cmd.manufacturerId, cmd.productTypeId, cmd.productId)
updateDataValue("MSR", msr)

However, I can't figure where zwaveInfo.mfr gets updated. In fact, zwaveInfo is a null object which I don't see where it gets created. The error in the log is something like this:
errorjava.lang.NullPointerException: Cannot get property 'mfr' on null object on line

Ah, I missed the reference to zwaveInfo in the OP (did see state). As far as I know, that is an ST-specific method getZwaveInfo() that is not implemented on Hubitat. But if you have a zwaveEvent() method (or really however you want to do this; this is convention) that takes a v2 MSR as a parameter (and, to be safe, specified this command class version for this command class when zwave.parse() was called instead of relying on the defaults), then the information you need will likely come in to that report. If that's already happening, then the updateDataValue() code that's there should write it the "Data" row under the "Device Details" section on the device page in the Hubitat admin UI. You can read it with the corresponding call, getDataValue("MSR"). Hopefully everything is working and that's just the one piece you'll need. :slight_smile: