Created
August 1, 2014 01:19
-
-
Save mckeed/6cbbca94632e53949d0c to your computer and use it in GitHub Desktop.
Intermatic Switch SmartThings Device Type
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
metadata { | |
// Automatically generated. Make future change here. | |
definition (name: "Intermatic Switch", namespace: "mckeed", author: "Duncan") { | |
capability "Actuator" | |
capability "Switch" | |
capability "Refresh" | |
capability "Sensor" | |
fingerprint inClusters: "0x25" | |
} | |
// simulator metadata | |
simulator { | |
status "on": "command: 2003, payload: FF" | |
status "off": "command: 2003, payload: 00" | |
// reply messages | |
reply "2001FF,delay 100,2502": "command: 2503, payload: FF" | |
reply "200100,delay 100,2502": "command: 2503, payload: 00" | |
} | |
// tile definitions | |
tiles { | |
standardTile("switch", "device.switch", width: 2, height: 2, canChangeIcon: true) { | |
state "on", label: '${name}', action: "switch.off", icon: "st.switches.switch.on", backgroundColor: "#79b821" | |
state "off", label: '${name}', action: "switch.on", icon: "st.switches.switch.off", backgroundColor: "#ffffff" | |
} | |
standardTile("refresh", "device.switch", inactiveLabel: false, decoration: "flat") { | |
state "default", label:'', action:"refresh.refresh", icon:"st.secondary.refresh" | |
} | |
main "switch" | |
details(["switch","refresh",]) | |
} | |
} | |
def parse(String description) { | |
def result = null | |
def cmd = zwave.parse(description, [0x20: 1, 0x70: 1]) | |
if (cmd) { | |
result = createEvent(zwaveEvent(cmd)) | |
} | |
log.debug "Parse returned ${result?.descriptionText}" | |
return result | |
} | |
def zwaveEvent(physicalgraph.zwave.commands.basicv1.BasicReport cmd) { | |
[name: "switch", value: cmd.value ? "on" : "off", type: "physical"] | |
} | |
def zwaveEvent(physicalgraph.zwave.commands.basicv1.BasicSet cmd) { | |
[name: "switch", value: cmd.value ? "on" : "off", type: "physical"] | |
} | |
def zwaveEvent(physicalgraph.zwave.commands.switchbinaryv1.SwitchBinaryReport cmd) { | |
[name: "switch", value: cmd.value ? "on" : "off", type: "digital"] | |
} | |
def zwaveEvent(physicalgraph.zwave.commands.hailv1.Hail cmd) { | |
[name: "hail", value: "hail", descriptionText: "Switch button was pressed", displayed: false] | |
} | |
def zwaveEvent(physicalgraph.zwave.commands.manufacturerspecificv2.ManufacturerSpecificReport cmd) { | |
if (state.manufacturer != cmd.manufacturerName) { | |
updateDataValue("manufacturer", cmd.manufacturerName) | |
} | |
} | |
def zwaveEvent(physicalgraph.zwave.Command cmd) { | |
// Handles all Z-Wave commands we aren't interested in | |
[descriptionText:"$device.displayName: $cmd", displayed:false] | |
} | |
def on() { | |
delayBetween([ | |
zwave.basicV1.basicSet(value: 0xFF).format(), | |
zwave.switchBinaryV1.switchBinaryGet().format() | |
]) | |
} | |
def off() { | |
delayBetween([ | |
zwave.basicV1.basicSet(value: 0x00).format(), | |
zwave.switchBinaryV1.switchBinaryGet().format() | |
]) | |
} | |
def refresh() { | |
delayBetween([ | |
zwave.switchBinaryV1.switchBinaryGet().format(), | |
zwave.manufacturerSpecificV1.manufacturerSpecificGet().format() | |
]) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment