mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-11 21:03:07 +00:00
Compare commits
2 Commits
MSA-1792-2
...
MSA-1791-1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b22dafbdf8 | ||
|
|
2bf9f92614 |
@@ -7,24 +7,21 @@
|
||||
*/
|
||||
|
||||
metadata {
|
||||
definition (name: "BeSense Motion Sensor", namespace: "BeSense Sensors", author: "BeSense") {
|
||||
definition (name: "BeSense Motion Sensor", namespace: "BeSense Handler", author: "BeSense") {
|
||||
capability "Motion Sensor"
|
||||
capability "Sensor"
|
||||
capability "Battery"
|
||||
capability "Tamper Alert"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
fingerprint mfr: "0214", prod: "0002", model: "0002", deviceJoinName: "Besense Motion Sensor" // Besense motion sensor
|
||||
fingerprint mfr: "0214", prod: "0002", model: "0002", deviceJoinName: "Besense Motion Sensor" // Besense motion +
|
||||
|
||||
}
|
||||
|
||||
simulator {
|
||||
status "inactive": "command: 3003, payload: 00"
|
||||
status "active": "command: 3003, payload: FF"
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -34,15 +31,12 @@ metadata {
|
||||
state("inactive", label:'no motion', icon:"st.motion.motion.inactive", backgroundColor:"#27CC73", nextState:"active")
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
valueTile("battery", "device.battery", inactiveLabel: false, decoration: "flat") {
|
||||
state("battery", label:'${currentValue}% battery', unit:"")
|
||||
}
|
||||
|
||||
main "motion"
|
||||
details(["motion", "battery", "tamper"])
|
||||
details(["motion", "battery"])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,30 +55,6 @@ def parse(String description) {
|
||||
return result
|
||||
}
|
||||
|
||||
def zwaveEvent(physicalgraph.zwave.commands.alarmv2.AlarmReport cmd)
|
||||
{
|
||||
def map = [:]
|
||||
map.name = "tamper"
|
||||
map.value = cmd.alarmLevel == 255 ? "tampered" : "secured"
|
||||
if (map.value == "tampered") {
|
||||
map.value = "tampered"
|
||||
map.descriptionText = "$device.displayName has been tampered with"
|
||||
map.isStateChange = "true"
|
||||
map.display = "true"
|
||||
log.debug "tampered: $map"
|
||||
}
|
||||
else {
|
||||
map.value = "secured"
|
||||
map.descriptionText = "$device.displayName is secured"
|
||||
map.isStateChange = "true"
|
||||
map.display = "true"
|
||||
log.debug "secure: $map"
|
||||
|
||||
}
|
||||
|
||||
createEvent(map)
|
||||
}
|
||||
|
||||
def sensorValueEvent(value) {
|
||||
if (value) {
|
||||
createEvent(name: "motion", value: "active", descriptionText: "$device.displayName detected motion")
|
||||
@@ -142,4 +112,5 @@ def zwaveEvent(physicalgraph.zwave.commands.batteryv1.BatteryReport cmd) {
|
||||
}
|
||||
state.lastbat = new Date().time
|
||||
[createEvent(map), response(zwave.wakeUpV1.wakeUpNoMoreInformation())]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user