Newb question Device Handler /fibaro-door-window-sensor-zw5-with-temperatureFibaro Door


(TD) #1

Given the Fibaro supplied device handler as an example:
Fibaro Device Handler

Given these two functions:

def zwaveEvent(physicalgraph.zwave.commands.manufacturerspecificv2.ManufacturerSpecificReport cmd) {
log.debug "manufacturerId: ${cmd.manufacturerId}"
log.debug "manufacturerName: ${cmd.manufacturerName}"
log.debug "productId: ${cmd.productId}"
log.debug “productTypeId: ${cmd.productTypeId}”
}

def zwaveEvent(physicalgraph.zwave.commands.manufacturerspecificv2.DeviceSpecificReport cmd) {
log.debug "deviceIdData: ${cmd.deviceIdData}"
log.debug "deviceIdDataFormat: ${cmd.deviceIdDataFormat}"
log.debug "deviceIdDataLengthIndicator: ${cmd.deviceIdDataLengthIndicator}"
log.debug “deviceIdType: ${cmd.deviceIdType}”

if (cmd.deviceIdType == 1 && cmd.deviceIdDataFormat == 1) {//serial number in binary format
	String serialNumber = "h'"

    cmd.deviceIdData.each{ data ->
    	serialNumber += "${String.format("%02X", data)}"
    }

    updateDataValue("serialNumber", serialNumber)
    log.debug "${device.displayName} - serial number: ${serialNumber}"
}

}

What in the world do I call to get the logs to show that information? From within the simulator or an app.
I know very basic and appreciate any help.
Regards
-TD


(TD) #2

Never mind, I figured it out. I picked the worst control in trying to understand this.The “Fibaro Door/Window Sensor ZW5 with Temperature” list above. You can try and call it all day long and it doesn’t report back. But if you use the the same code for the standard Z-wave switch handler it does work, in its poll function it calls ::
def poll() {
delayBetween([
zwave.switchBinaryV1.switchBinaryGet().format(),
zwave.manufacturerSpecificV1.manufacturerSpecificGet().format()
])
}
Wich calls ::
def zwaveEvent(physicalgraph.zwave.commands.manufacturerspecificv2.ManufacturerSpecificReport cmd) {
log.debug "manufacturerId: ${cmd.manufacturerId}"
log.debug "manufacturerName: ${cmd.manufacturerName}"
log.debug "productId: ${cmd.productId}"
log.debug “productTypeId: ${cmd.productTypeId}“
def msr = String.format(”%04X-%04X-%04X”, cmd.manufacturerId, cmd.productTypeId, cmd.productId)
updateDataValue(“MSR”, msr)
updateDataValue(“manufacturer”, cmd.manufacturerName)
createEvent([descriptionText: “$device.displayName MSR: $msr”, isStateChange: false])
}
In the simulator , because capability poll is set and the poll function is defined you can test it with the poll button which is what I was after. Why it does a V1 get and still calls the V2.ManufacturerSpecificReport escapes me but at least i’m making progress.