Skip to content

Commit

Permalink
Change time in runIn method, add chime off event
Browse files Browse the repository at this point in the history
  • Loading branch information
MGoralczykS committed Jul 22, 2020
1 parent 41a9eb2 commit 413978f
Showing 1 changed file with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ def both() {
on()
}

def chime() {
on()
}

def ping() {
def cmds = [
encap(zwave.basicV1.basicGet())
Expand Down Expand Up @@ -202,26 +206,27 @@ def zwaveEvent(physicalgraph.zwave.commands.notificationv3.NotificationReport cm
case 0x09: //TAMPER
sendEvent(name: "tamper", value: "detected")
sendEvent(name: "alarm", value: "both")
runIn(10, "clearTamper")
runIn(2, "clearTamperAndAlarm")
break
case 0x01: //ON
if (state.lastTriggeredSound == 1) {
createEvent([name: "alarm", value: "both"])
createEvent([name: "chime", value: "chime"])
sendEvent(name: "chime", value: "chime")
sendEvent(name: "alarm", value: "both")
} else {
setActiveSound(state.lastTriggeredSound)
}
break
case 0x00: //OFF
resetActiveSound()
createEvent([name: "tamper", value: "clear"])
createEvent([name: "alarm", value: "off"])
sendEvent(name: "tamper", value: "clear")
sendEvent(name: "alarm", value: "off")
sendEvent(name: "chime", value: "off")
break
}
}
}

def clearTamper() {
def clearTamperAndAlarm() {
sendEvent(name: "tamper", value: "clear")
sendEvent(name: "alarm", value: "off")
}
Expand Down

0 comments on commit 413978f

Please sign in to comment.