I am not quite sure how to go about sharing a custom device type with another user. I havent signed up to a GitHub account yet, although I did find some useful code there. So below is the custom parse method. I don’t claim it is the best code in the world, but it works, and hell it has been 20 years since I did any programming…
def parse(String description) {
def result
def hubact //used for a hubaction when the toggle switch is toggled
log.debug “About to parse: ${description}”
def cmd = zwave.parse(description, [0x26: 1, 0x70: 2, 0x72: 2])
//log.debug "Parsed to cmd: ${cmd}"
//if the toggle switch is toggled on, define a hubaction to switch the dimmer on
//and change the parsed command to be a switchmultilevelreport action
if ("${cmd}" == "BasicSet(value: 255)") {
hubact = response(zwave.basicV1.basicSet(value: 0x63).format())
description = "zw device: 02, command: 2603, payload: 63"
cmd = zwave.parse(description, [0x26: 1, 0x70: 2, 0x72: 2])
log.debug "command changed to ${cmd}"
}
//if the toggle switch is toggled off, define a hubaction to switch the dimmer off
//and change the parsed command to be a switchmultilevelreport action
if ("${cmd}" == "BasicSet(value: 0)") {
hubact = response(zwave.basicV1.basicSet(value: 0x00).format())
description = "zw device: 02, command: 2603, payload: 00"
cmd = zwave.parse(description, [0x26: 1, 0x70: 2, 0x72: 2])
log.debug "command changed to ${cmd}"
}
def item1 = [
canBeCurrentState: false,
linkText: getLinkText(device),
isStateChange: false,
displayed: false,
descriptionText: description,
value: description
]
if (cmd) {
result = createEvent(cmd, item1)
}
else {
item1.displayed = displayed(description, item1.isStateChange)
result = [item1]
}
if (hubact) {
result << hubact
}
//log.debug "Parse returned ${result}"
result
}