From f1a8d58c4006924e31090f331893a98978d064fd Mon Sep 17 00:00:00 2001 From: Donald Kirker Date: Tue, 11 Jul 2017 20:27:29 -0700 Subject: [PATCH] ICP-1267 Call lock state check code from installed() with precise timing to threduce chance that hub has gone back to pjoin mode thus blocking Z-Wave. --- .../zwave-lock.src/zwave-lock.groovy | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/devicetypes/smartthings/zwave-lock.src/zwave-lock.groovy b/devicetypes/smartthings/zwave-lock.src/zwave-lock.groovy index bbd9ac8..cd65d49 100644 --- a/devicetypes/smartthings/zwave-lock.src/zwave-lock.groovy +++ b/devicetypes/smartthings/zwave-lock.src/zwave-lock.groovy @@ -88,19 +88,21 @@ import physicalgraph.zwave.commands.usercodev1.* def installed() { // Device-Watch pings if no device events received for 1 hour (checkInterval) sendEvent(name: "checkInterval", value: 1 * 60 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID]) + + try { + if (!state.init) { + state.init = true + // Wait long enough for behind-the-scenes z-wave magic to finish, but be quick enough before hub goes back into inclusion and blocks us + response(["delay 2000"] + secureSequence([zwave.doorLockV1.doorLockOperationGet(), zwave.batteryV1.batteryGet()], 2200)) + } + } catch (e) { + log.warn "installed() threw $e" + } } def updated() { // Device-Watch pings if no device events received for 1 hour (checkInterval) sendEvent(name: "checkInterval", value: 1 * 60 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID]) - try { - if (!state.init) { - state.init = true - response(secureSequence([zwave.doorLockV1.doorLockOperationGet(), zwave.batteryV1.batteryGet()])) - } - } catch (e) { - log.warn "updated() threw $e" - } } def parse(String description) {