First of all, I want to thank everyone who has shared their code for this device, I certainly couldn’t do it myself.
I am trying to get a Zipato PH-PSM02.US quad sensor to work. I am getting a different problem. I started with the code in this discussion, inserted the no motion report configuration line, uncommented all of the log.debug statements, assigned the code as its device handler, left the device with the tamper switch out so it’s in test mode, and clicked Configure in the IOS app. I get this series of errors whenever an event occurs:
d8c01599-29a2-4ebc-9a6b-5dfa7f5aa2c3 2:51:08 AM: error java.lang.NullPointerException: Cannot get property 'value' on null object @ line 118
d8c01599-29a2-4ebc-9a6b-5dfa7f5aa2c3 2:51:08 AM: debug PSM02: Catchall reached for cmd: SecurityMessageEncapsulation(commandByte: [4, 3, 128, 3, 100, 9, 113, 5, 0, 0, 0, 255, 7, 8, 0, 5, 49, 5, 3, 1, 13, 6, 49, 5], commandClassIdentifier: 143, commandIdentifier: 1, reserved13: 0, secondFrame: false, sequenceCounter: 1, sequenced: true)}
d8c01599-29a2-4ebc-9a6b-5dfa7f5aa2c3 2:51:08 AM: debug PSM02 Parsed CMD: SecurityMessageEncapsulation(commandByte: [4, 3, 128, 3, 100, 9, 113, 5, 0, 0, 0, 255, 7, 8, 0, 5, 49, 5, 3, 1, 13, 6, 49, 5], commandClassIdentifier: 143, commandIdentifier: 1, reserved13: 0, secondFrame: false, sequenceCounter: 1, sequenced: true)
d8c01599-29a2-4ebc-9a6b-5dfa7f5aa2c3 2:51:08 AM: debug PSM02 Parse called with zw device: 13, command: 98C1, payload: 11 8F 01 04 03 80 03 64 09 71 05 00 00 00 FF 07 08 00 05 31 05 03 01 0D 06 31 05
The line 118 reference is to this line:
statusTextmsg = "Door is ${device.currentState('contact').value}, temp is ${device.currentState('temperature').value}°, and illuminance is ${device.currentState('illuminance').value} LUX."
It seems to insist on encrypting the communications (SecurityMessageEncapsulation), which isn’t handled in this code. I couldn’t find any parameter related to enabling or disabling secure communications, so I dug into that command. The Zipato docs say:
This device supports the security function. When the device is
included with a security controller, the device will auto switch to
the security mode. In the security mode, the following commands
need to be wrapped in Security Command Classes to communicate,
otherwise there will be no response.
COMMAND_CLASS_BATTERY
COMMAND_CLASS_NOTIFICATION_V4
COMMAND_CLASS_ASSOCIATION_V2
COMMAND_CLASS_CONFIGURATION
COMMAND_CLASS_SENSOR_BINARY_V2
COMMAND_CLASS_SENSOR_MULTILEVEL_V5
COMMAND_CLASS_WAKE_UP_V2
so I tried to accommodate that. I found a routine that’s at least related to decoding secure z-wave commands, and I looked up the secure commands listed above to get the appropriate hex codes. I added this code to the handler:
// Devices that support the Security command class can send messages in an
// encrypted form; they arrive wrapped in a SecurityMessageEncapsulation
// command and must be unencapsulated
def zwaveEvent(physicalgraph.zwave.commands.securityv1.SecurityMessageEncapsulation cmd) {
def encapsulatedCommand = cmd.encapsulatedCommand([0x80: 1, 0x71: 3, 0x85: 2, 0x70: 1, 0x30: 2, 0x31: 5, 0x84: 2])
// can specify command class versions here like in zwave.parse
if (encapsulatedCommand) {
return zwaveEvent(encapsulatedCommand)
}
}
I think that got me a step closer, but I hit a wall again. Now I get this error:
d8c01599-29a2-4ebc-9a6b-5dfa7f5aa2c3 11:41:14 AM: error java.lang.NullPointerException: Cannot get property 'value' on null object @ line 118
d8c01599-29a2-4ebc-9a6b-5dfa7f5aa2c3 11:41:14 AM: debug PSM02: Catchall reached for cmd: MultiCmdEncap(numberOfCommands: 4)}
d8c01599-29a2-4ebc-9a6b-5dfa7f5aa2c3 11:41:14 AM: debug PSM02 Parsed CMD: SecurityMessageEncapsulation(commandByte: [4, 3, 128, 3, 100, 9, 113, 5, 0, 0, 0, 255, 7, 8, 0, 5, 49, 5, 3, 1, 24, 6, 49, 5], commandClassIdentifier: 143, commandIdentifier: 1, reserved13: 0, secondFrame: false, sequenceCounter: 1, sequenced: true)
d8c01599-29a2-4ebc-9a6b-5dfa7f5aa2c3 11:41:14 AM: debug PSM02 Parse called with zw device: 13, command: 98C1, payload: 11 8F 01 04 03 80 03 64 09 71 05 00 00 00 FF 07 08 00 05 31 05 03 01 18 06 31 05
So now it’s MultiCmdEncap that is failing? There was a question about this command in the forum, but it wasn’t answered:
https://community.smartthings.com/t/how-to-parse-multicmdencap/31269
Can anyone give me some direction? Is the security mode new or do I need to change some configuration? Thanks.