Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
/**
* Aeon Door/Window Sensor
*
* Author: SmartThings
* Date: 2013-04-23
*/
// for the UI
metadata {
// 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"
}
main "contact"
details "contact"
}
}
// Parse incoming device messages to generate events
def parse(String description) {
def result = []
def cmd = zwave.parse(description, [0x20: 1, 0x84: 1])
if (cmd) {
result << createEvent(zwaveEvent(cmd))
if( cmd.CMD == "8407" ) { result << new physicalgraph.device.HubAction(zwave.wakeUpV1.wakeUpNoMoreInformation().format()) }
}
log.debug "Parse returned ${result}"
return result
}
def zwaveEvent(physicalgraph.zwave.commands.wakeupv1.WakeUpNotification cmd)
{
[descriptionText: "${device.displayName} woke up", isStateChange: false]
}
def zwaveEvent(physicalgraph.zwave.commands.basicv1.BasicSet cmd) {
[name: "contact", value: cmd.value ? "open" : "closed"]
}
def zwaveEvent(physicalgraph.zwave.commands.switchbinaryv1.SwitchBinaryReport cmd) {
[name: "contact", value: cmd.value ? "open" : "closed"]
}
def zwaveEvent(physicalgraph.zwave.Command cmd) {
// Handles all Z-Wave commands we aren't interested in
[:]
}
// handle commands
def configure() {
log.debug "Executing 'configure'"
// TODO: handle 'configure' command
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment