I wonder if anyone can help me with this problem?
I’m using schedule() within a device handler to run a command once per day. The command updates some device attributes and sends some z-wave commands to the physical device.
If the command is triggered from a tile action, then it executes as expected: I see the log messages in the IDE, the device attributes are updated, the command is sent, and a response from the device is received.
However, if the command is triggered by schedule(), then it executes at the right time, I see the log messages in the IDE, the device attributes are updated, BUT no command appears to be sent!
The following code demonstrates the issue:
def test() {
log.debug "test(): scheduling schedTest()"
schedule(now()+15000, schedTest) // Schedule in 15 seconds.
return schedTest() // Run immediatly
}
def schedTest() {
log.debug "schedTest()"
def cmds = []
sendEvent(name: "fault", value: "testFault", isStateChange: true)
cmds << zwave.versionV1.versionGet()
return cmds
}
When test() is triggered from a tile, we see the following in the IDE Log:
14:53:34: debug schedTest()
14:53:25: info Version Report: Application Version: 3.04, Z-Wave Protocol Version: 4.05, Z-Wave Library Type: 03 (Enhanced Slave)
14:53:25: trace zwaveEvent(): Version Report received: VersionReport(applicationSubVersion: 4, applicationVersion: 3, zWaveLibraryType: 3, zWaveProtocolSubVersion: 5, zWaveProtocolVersion: 4)
14:53:25: trace zwaveEvent(): CRC-16 Encapsulation Command received: Crc16Encap(checksum: 28444, command: 18, commandClass: 134, data: [3, 4, 5, 3, 4, 2, 1, 3, 4])
14:53:25: trace parse(): Parsing raw message: zw device: 0C, command: 5601, payload: 86 12 03 04 05 03 04 02 01 03 04 6F 1C
14:53:23: debug schedTest()
14:53:23: debug test(): scheduling schedTest()
Here we can see that when schedTest() is executed directly from test(), we get a VersionReport back from the device after ~2 seconds. Then schedTest() is triggered from schedule(), we get nothing back… (note the attribute is still updated from the sendEvent() call).
Anyone got any ideas?
I have tried wrapping the output from schedTest() in response(), but it makes no difference.
I’ve also tried removing the sendEvent(…) line, but this also makes no difference.
The really annoying thing is that this all seemed to work six months ago, but something seems to have changed…
Thanks, Z