Hey all,
Wonder if some talented person could assist me here.
I have a plug which supports an "Auto off" parameter, and the code is stopping the switch updating on/off due to this. Its a driver ported from ST and pretty much all is working bar this.
This is my error.
dev:26252019-05-28 04:29:38.740 pm errorjava.lang.NullPointerException: Cannot invoke method and() on null object on line 492 (parse)
and the code for that section. Currently my param is set to 60 seconds (just to test).
/**
* zwaveEvent( COMMAND_CLASS_SWITCH_BINARY (0x25) : SWITCH_BINARY_REPORT (0x03) )
*
* The Binary Switch Report command is used to advertise the status of a device with On/Off or Enable/Disable
* capability.
*
* Action: Raise switch event and log an info message if state has changed.
* Schedule autoOff() if an autoOffTime is configured.
*
* cmd attributes:
* Short value 0xFF for on, 0x00 for off
*
* Example: SwitchBinaryReport(value: 255)
**/
def zwaveEvent(hubitat.zwave.commands.switchbinaryv1.SwitchBinaryReport cmd) {
logger("zwaveEvent(): Switch Binary Report received: ${cmd}","trace")
def result = []
def switchValue = (cmd.value ? "on" : "off")
def switchEvent = createEvent(name: "switch", value: switchValue)
if (switchEvent.isStateChange) logger("Switch turned ${switchValue}.","info")
result << switchEvent
if ( switchEvent.isStateChange & (switchValue == "on") & (state.autoOffTime > 0) ) {
logger("Scheduling Auto-off in ${state.autoOffTime} seconds.","info")
runIn(state.autoOffTime,autoOff)
}
return result
}
This being line 492
if ( switchEvent.isStateChange & (switchValue == "on") & (state.autoOffTime > 0) ) {
TIA!