Ok, I’ve had a chance to work on this a bit, and I like what it’s doing At least now I can guess that if the log shows a door sensor “tampered” and then “open” odds are fairly good the sensor just fell off. Especially if there is no motion in the house.
Edit: Still having issues clearing the Alarm once triggered, so there’s still something not quite right here. I’ll update it when I figure out what I’m doing wrong.
Edit2: fixed. use sendEvent not createEvent in reset code. Updated below Duh.
Modified Device UI - Normal state:
Tampered state:
At least for the Aeon device, it sends the Tamper alarm message when the tamper switch is activated (ie, it falls off) but does not send a secure message when its tamper switch is depressed. I’ve coded the device so the “tampered” state is a button - pressing it resets the alarm value to secure. Once you put your sensor back on the door, tap the button…
Changes from generic Z-Wave Door/Window Sensor.
Replace metadata() section
metadata {
// Automatically generated. Make future change here.
// add support for Aeon Labs DSB04100-ZWUS tamper sensor
definition (name: "Z-Wave Door/Window Sensor With Tamper", namespace: "smartthings", author: "SmartThings") {
capability "Contact Sensor"
capability "Sensor"
capability "Battery"
capability "Configuration"
capability "Alarm"
fingerprint deviceId: "0x2001", inClusters: "0x30,0x80,0x84,0x85,0x86,0x72"
fingerprint deviceId: "0x07", inClusters: "0x30"
fingerprint deviceId: "0x0701", inClusters: "0x5E,0x86,0x72,0x98", outClusters: "0x5A,0x82"
command "reset" // reset tamper state
}
// simulator metadata
simulator {
// status messages
status "open": "command: 2001, payload: FF"
status "closed": "command: 2001, payload: 00"
}
// UI tile definitions
tiles {
standardTile("contact", "device.contact", width: 2, height: 2) {
state "open", label: '${name}', icon: "st.contact.contact.open", backgroundColor: "#ffa81e"
state "closed", label: '${name}', icon: "st.contact.contact.closed", backgroundColor: "#79b821"
}
valueTile("battery", "device.battery", inactiveLabel: false, decoration: "flat") {
state "battery", label:'${currentValue}% battery', unit:""
}
standardTile("tamper", "device.alarm") {
state("secure", label:'secure', icon:"st.locks.lock.locked", backgroundColor:"#ffffff")
state("tampered", label:'tampered', action:"reset", icon:"st.locks.lock.unlocked", backgroundColor:"#53a7c0")
}
main "contact"
details(["contact", "battery", "tamper"])
}
}
and replace zwaveEvent(physicalgraph.zwave.commands.sensoralarmv1.SensorAlarmReport cmd) function with these two functions:
// add tamper alarm
// The Aeon seems to only send the tampered message
// Make the TAMPER tile a button. Pressing it clears the Tamper state
def zwaveEvent(physicalgraph.zwave.commands.sensoralarmv1.SensorAlarmReport cmd)
{
if (cmd.sensorState) {
createEvent(name: "alarm", value: "tampered", descriptionText: "$device.displayName has been tampered with")
}
else {
createEvent(name: "alarm", value: "secure", descriptionText: "$device.displayName is secure")
}
}
def reset() {
sendEvent(displayed: true, isStateChange: true, name: "alarm", value: "secure", descriptionText: "$device.displayName reset to secure")
}
// end tamper alarm