Hi huntb,
I created my own device type exactly like the “SmartSense Virtual Momentary Contact Switch”. Here’s my code:
/**
* SmartSense Virtual Momentary Contact Switch, Better Momentary
*
* Author: SmartThings, jsconst@gmail.com
* Date: 2013-03-07,2014-02-03
*/
metadata {
// simulator metadata
simulator {
status "on": "command: 2003, payload: FF"
status "off": "command: 2003, payload: 00"
// reply messages
reply "2001FF,2502,delay 2000,200100,2502": "command: 2503, payload: FF"
reply "200100,2502": "command: 2503, payload: 00"
}
// tile definitions
tiles {
standardTile("switch", "device.switch", width: 2, height: 2, canChangeIcon: true) {
state "off", label: 'Push', action: "momentary.push", icon: "st.unknown.thing.thing-circle", backgroundColor: "#ffffff"
state "on", label: 'Push', action: "switch.off", icon: "st.unknown.thing.thing-circle", backgroundColor: "#53a7c0"
}
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])
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.switchbinaryv1.SwitchBinaryReport cmd) {
[name: "switch", value: cmd.value ? "on" : "off", type: "digital"]
}
def zwaveEvent(physicalgraph.zwave.Command cmd) {
// Handles all Z-Wave commands we aren't interested in
[:]
}
def push() {
def cmds = [
zwave.basicV1.basicSet(value: 0xFF).format(),
zwave.switchBinaryV1.switchBinaryGet().format(),
"delay 2000",
zwave.basicV1.basicSet(value: 0x00).format(),
zwave.switchBinaryV1.switchBinaryGet().format()
]
}
def on() {
push()
}
def off() {
[
zwave.basicV1.basicSet(value: 0x00).format(),
zwave.switchBinaryV1.switchBinaryGet().format()
]
}
def poll() {
zwave.switchBinaryV1.switchBinaryGet().format()
}
def refresh() {
zwave.switchBinaryV1.switchBinaryGet().format()
}
I only changed the standardTile element for the text “Push”, icon, and color. Saved it, published it for myself, and changed the device type in the IDE to what I created above.
If you already changed the icon via the phone app to anything other than the default, you’ll need to exclude the MIMOlite and rejoin the hub for the icon you called for in that element to take effect. I learned that the hard way.
Here’s how everything turned out:
Overhead light Switch, Opener Button, and SmartSense Multi indicating open/close status:
https://picasaweb.google.com/lh/photo/V4SMv2yDlyx35vH-xaHZXtMTjNZETYmyPJy0liipFm0?feat=directlink