Compare commits

..

1 Commits

Author SHA1 Message Date
Andres
11501f4c31 MSA-1792: Hi smartthings team,
We  made the handler with tamper and motion alarm and we update the fingerprint for our hardware Besense.
Regards,
Andres.
2017-02-17 21:11:06 -08:00

View File

@@ -7,21 +7,24 @@
*/
metadata {
definition (name: "BeSense Motion Sensor", namespace: "BeSense Handler", author: "BeSense") {
definition (name: "BeSense Motion Sensor", namespace: "BeSense Sensors", 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 +
fingerprint mfr: "0214", prod: "0002", model: "0002", deviceJoinName: "Besense Motion Sensor" // Besense motion sensor
}
simulator {
status "inactive": "command: 3003, payload: 00"
status "active": "command: 3003, payload: FF"
}
@@ -31,12 +34,15 @@ 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"])
details(["motion", "battery", "tamper"])
}
}
@@ -55,6 +61,30 @@ 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")
@@ -112,5 +142,4 @@ def zwaveEvent(physicalgraph.zwave.commands.batteryv1.BatteryReport cmd) {
}
state.lastbat = new Date().time
[createEvent(map), response(zwave.wakeUpV1.wakeUpNoMoreInformation())]
}
}