mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-08 05:31:56 +00:00
DHF-7 Z-Wave Lock: Add scheduled checks in case ping() is missed
This commit is contained in:
@@ -152,6 +152,10 @@ def zwaveEvent(physicalgraph.zwave.commands.securityv1.SecurityCommandsSupported
|
|||||||
|
|
||||||
def zwaveEvent(DoorLockOperationReport cmd) {
|
def zwaveEvent(DoorLockOperationReport cmd) {
|
||||||
def result = []
|
def result = []
|
||||||
|
|
||||||
|
unschedule(followupStateCheck)
|
||||||
|
unschedule(stateCheck)
|
||||||
|
|
||||||
def map = [ name: "lock" ]
|
def map = [ name: "lock" ]
|
||||||
if (cmd.doorLockMode == 0xFF) {
|
if (cmd.doorLockMode == 0xFF) {
|
||||||
map.value = "locked"
|
map.value = "locked"
|
||||||
@@ -365,7 +369,7 @@ def zwaveEvent(UserCodeReport cmd) {
|
|||||||
code = state["set$name"] ?: decrypt(state[name]) ?: "****"
|
code = state["set$name"] ?: decrypt(state[name]) ?: "****"
|
||||||
state.remove("set$name".toString())
|
state.remove("set$name".toString())
|
||||||
} else {
|
} else {
|
||||||
map = [ name: "codeReport", value: cmd.userIdentifier, data: [ code: code ] ]
|
map = [ name: "codeReport", value: cmd.userIdentifier, data: [ code: code ], isStateChange: true ]
|
||||||
map.descriptionText = "$device.displayName code $cmd.userIdentifier is set"
|
map.descriptionText = "$device.displayName code $cmd.userIdentifier is set"
|
||||||
map.displayed = (cmd.userIdentifier != state.requestCode && cmd.userIdentifier != state.pollCode)
|
map.displayed = (cmd.userIdentifier != state.requestCode && cmd.userIdentifier != state.pollCode)
|
||||||
map.isStateChange = true
|
map.isStateChange = true
|
||||||
@@ -456,11 +460,12 @@ def zwaveEvent(physicalgraph.zwave.commands.timev1.TimeGet cmd) {
|
|||||||
def zwaveEvent(physicalgraph.zwave.commands.basicv1.BasicSet cmd) {
|
def zwaveEvent(physicalgraph.zwave.commands.basicv1.BasicSet cmd) {
|
||||||
// The old Schlage locks use group 1 for basic control - we don't want that, so unsubscribe from group 1
|
// The old Schlage locks use group 1 for basic control - we don't want that, so unsubscribe from group 1
|
||||||
def result = [ createEvent(name: "lock", value: cmd.value ? "unlocked" : "locked") ]
|
def result = [ createEvent(name: "lock", value: cmd.value ? "unlocked" : "locked") ]
|
||||||
result << response(zwave.associationV1.associationRemove(groupingIdentifier:1, nodeId:zwaveHubNodeId))
|
def cmds = [
|
||||||
if (state.assoc != zwaveHubNodeId) {
|
zwave.associationV1.associationRemove(groupingIdentifier:1, nodeId:zwaveHubNodeId).format(),
|
||||||
result << response(zwave.associationV1.associationGet(groupingIdentifier:2))
|
"delay 1200",
|
||||||
}
|
zwave.associationV1.associationGet(groupingIdentifier:2).format()
|
||||||
result
|
]
|
||||||
|
[result, response(cmds)]
|
||||||
}
|
}
|
||||||
|
|
||||||
def zwaveEvent(physicalgraph.zwave.commands.batteryv1.BatteryReport cmd) {
|
def zwaveEvent(physicalgraph.zwave.commands.batteryv1.BatteryReport cmd) {
|
||||||
@@ -530,11 +535,18 @@ def unlockwtimeout() {
|
|||||||
lockAndCheck(DoorLockOperationSet.DOOR_LOCK_MODE_DOOR_UNSECURED_WITH_TIMEOUT)
|
lockAndCheck(DoorLockOperationSet.DOOR_LOCK_MODE_DOOR_UNSECURED_WITH_TIMEOUT)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* PING is used by Device-Watch in attempt to reach the Device
|
|
||||||
* */
|
|
||||||
def ping() {
|
def ping() {
|
||||||
refresh()
|
runIn(30, followupStateCheck)
|
||||||
|
secure(zwave.doorLockV1.doorLockOperationGet())
|
||||||
|
}
|
||||||
|
|
||||||
|
def followupStateCheck() {
|
||||||
|
runEvery1Hour(stateCheck)
|
||||||
|
stateCheck()
|
||||||
|
}
|
||||||
|
|
||||||
|
def stateCheck() {
|
||||||
|
sendHubCommand(new physicalgraph.device.HubAction(secure(zwave.doorLockV1.doorLockOperationGet())))
|
||||||
}
|
}
|
||||||
|
|
||||||
def refresh() {
|
def refresh() {
|
||||||
|
|||||||
Reference in New Issue
Block a user