I used this handler:
/**
*/
metadata {
definition (name: âGreenWaveâ, namespace: âgreenwaveâ, author: âMichaâ) {
capability âSwitchâ
capability âEnergy Meterâ
capability âPower Meterâ
capability âRefreshâ
capability âConfigurationâ
capability âActuatorâ
capability âSensorâ
command "reset"
(1..6).each { n ->
attribute "switch$n", "enum", ["on", "off"]
attribute "power$n", "number"
attribute "energy$n", "number"
command "on$n"
command "off$n"
command "reset$n"
}
fingerprint deviceId: "0x1001", inClusters: "0x25,0x32,0x27,0x70,0x85,0x72,0x86,0x60", outClusters: "0x82"
}
// simulator metadata
simulator {
status âonâ: âcommand: 2003, payload: FFâ
status âoffâ: âcommand: 2003, payload: 00â
status âswitch1 onâ: âcommand: 600D, payload: 01 00 25 03 FFâ
status âswitch1 offâ: âcommand: 600D, payload: 01 00 25 03 00â
status âswitch6 onâ: âcommand: 600D, payload: 06 00 25 03 FFâ
status âswitch6 offâ: âcommand: 600D, payload: 06 00 25 03 00â
status âpowerâ: new physicalgraph.zwave.Zwave().meterV1.meterReport(
scaledMeterValue: 30, precision: 3, meterType: 4, scale: 2, size: 4).incomingMessage()
status âenergyâ: new physicalgraph.zwave.Zwave().meterV1.meterReport(
scaledMeterValue: 200, precision: 3, meterType: 0, scale: 0, size: 4).incomingMessage()
status âpower1â: âcommand: 600D, payload: 0100â + new physicalgraph.zwave.Zwave().meterV1.meterReport(
scaledMeterValue: 30, precision: 3, meterType: 4, scale: 2, size: 4).format()
status âenergy2â: âcommand: 600D, payload: 0200â + new physicalgraph.zwave.Zwave().meterV1.meterReport(
scaledMeterValue: 200, precision: 3, meterType: 0, scale: 0, size: 4).format()
// 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â
}
valueTile(âpowerâ, âdevice.powerâ, decoration: âflatâ) {
state âdefaultâ, label:â${currentValue} Wâ
}
valueTile(âenergyâ, âdevice.energyâ, decoration: âflatâ) {
state âdefaultâ, label:â${currentValue} kWhâ
}
standardTile(âresetâ, âdevice.energyâ, inactiveLabel: false, decoration: âflatâ) {
state âdefaultâ, label:âreset kWhâ, action:âresetâ
}
standardTile(ârefreshâ, âdevice.powerâ, inactiveLabel: false, decoration: âflatâ) {
state âdefaultâ, label:ââ, action:ârefresh.refreshâ, icon:âst.secondary.refreshâ
}
standardTile(âswitch1â, âswitch1â, width: 2, height: 2, canChangeIcon: true) {
state âonâ, label: â${name}â, action: âswitch1.offâ, icon: âst.switches.switch.onâ, backgroundColor: â#79b821â
state âoffâ, label: â${name}â, action: âswitch1.onâ, icon: âst.switches.switch.offâ, backgroundColor: â#ffffffâ
}
/*(1..6).each { n ->
standardTile("switch$n", "switch$n", canChangeIcon: true) {
state "off", label: '${name}', action: "on$n", icon: "st.switches.switch.off", backgroundColor: "#ffffff"
state "on", label: '${name}', action: "off$n", icon: "st.switches.switch.on", backgroundColor: "#79b821"
}
valueTile("power$n", "power$n", decoration: "flat") {
state "default", label:'${currentValue} W'
}
valueTile("energy$n", "energy$n", decoration: "flat") {
state "default", label:'${currentValue} kWh'
}
}
*/
main([âswitchâ, âpowerâ, âenergyâ, âswitch1â, âswitch2â, âswitch3â, âswitch4â, âswitch5â, âswitch6â])
details([âswitchâ,âpowerâ,âenergyâ,
âswitch1â,âpower1â,âenergy1â,
âswitch2â,âpower2â,âenergy2â,
âswitch3â,âpower3â,âenergy3â,
âswitch4â,âpower4â,âenergy4â,
âswitch5â,âpower5â,âenergy5â,
âswitch6â,âpower6â,âenergy6â,
ârefreshâ,âresetâ])
}
}
def parse(String description) {
def result = null
if (description.startsWith(âErrâ)) {
result = createEvent(descriptionText:description, isStateChange:true)
} else if (description != âupdatedâ) {
def cmd = zwave.parse(description, [0x60: 3, 0x32: 3, 0x25: 1, 0x20: 1])
if (cmd) {
result = zwaveEvent(cmd, null)
}
}
log.debug âparsed â${description}â to ${result.inspect()}â
result
}
def endpointEvent(endpoint, map) {
if (endpoint) {
map.name = map.name + endpoint.toString()
}
createEvent(map)
}
def zwaveEvent(physicalgraph.zwave.commands.multichannelv3.MultiChannelCmdEncap cmd, ep) {
def encapsulatedCommand = cmd.encapsulatedCommand([0x32: 3, 0x25: 1, 0x20: 1])
if (encapsulatedCommand) {
if (encapsulatedCommand.commandClassId == 0x32) {
// Metered outlets are numbered differently than switches
Integer endpoint = cmd.sourceEndPoint
if (endpoint > 2) {
zwaveEvent(encapsulatedCommand, endpoint - 2)
} else if (endpoint == 0) {
zwaveEvent(encapsulatedCommand, 0)
} else {
log.debug(âIgnoring metered outlet $endpoint msg: $encapsulatedCommandâ)
}
} else {
zwaveEvent(encapsulatedCommand, cmd.sourceEndPoint as Integer)
}
}
}
def zwaveEvent(physicalgraph.zwave.commands.basicv1.BasicReport cmd, endpoint) {
def map = [name: âswitchâ, type: âphysicalâ, value: (cmd.value ? âonâ : âoffâ)]
def events = [endpointEvent(endpoint, map)]
def cmds =
if (endpoint) {
cmds += delayBetween([2,0].collect { s â encap(zwave.meterV3.meterGet(scale: s), endpoint) }, 1000)
if(endpoint < 4) cmds += [âdelay 1500â, encap(zwave.basicV1.basicGet(), endpoint + 1)]
} else if (events[0].isStateChange) {
events += (1âŠ4).collect { ep â endpointEvent(ep, map.clone()) }
cmds << âdelay 3000â
cmds += delayBetween((0âŠ4).collect { ep â encap(zwave.meterV3.meterGet(scale: 2), ep) }, 800)
}
if(cmds) events << response(cmds)
events
}
def zwaveEvent(physicalgraph.zwave.commands.switchbinaryv1.SwitchBinaryReport cmd, endpoint) {
def map = [name: âswitchâ, value: (cmd.value ? âonâ : âoffâ)]
def events = [endpointEvent(endpoint, map)]
def cmds =
if (!endpoint && events[0].isStateChange) {
events += (1âŠ4).collect { ep â endpointEvent(ep, map.clone()) }
cmds << âdelay 3000â
cmds += delayBetween((1âŠ4).collect { ep â encap(zwave.meterV3.meterGet(scale: 2), ep) })
}
if(cmds) events << response(cmds)
events
}
def zwaveEvent(physicalgraph.zwave.commands.meterv3.MeterReport cmd, ep) {
def event = [:]
def cmds =
if (cmd.scale < 2) {
def val = Math.round(cmd.scaledMeterValue*100)/100.0
event = endpointEvent(ep, [name: âenergyâ, value: val, unit: [âkWhâ, âkVAhâ][cmd.scale]])
} else {
event = endpointEvent(ep, [name: âpowerâ, value: Math.round(cmd.scaledMeterValue), unit: âWâ])
}
if (!ep && event.isStateChange && event.name == âenergyâ) {
// Total strip energy consumption changed, check individual outlets
(1âŠ4).each { endpoint â
cmds << encap(zwave.meterV2.meterGet(scale: 0), endpoint)
cmds << âdelay 400â
}
}
cmds ? [event, response(cmds)] : event
}
def zwaveEvent(physicalgraph.zwave.commands.manufacturerspecificv2.ManufacturerSpecificReport cmd, ep) {
updateDataValue(âMSRâ, String.format(â%04X-%04X-%04Xâ, cmd.manufacturerId, cmd.productTypeId, cmd.productId))
null
}
def zwaveEvent(physicalgraph.zwave.Command cmd, ep) {
log.debug â${device.displayName}: Unhandled ${cmd}â + (ep ? " from endpoint $ep" : ââ)
}
def onOffCmd(value, endpoint = null) {
[
encap(zwave.basicV1.basicSet(value: value), endpoint),
âdelay 500â,
encap(zwave.switchBinaryV1.switchBinaryGet(), endpoint),
âdelay 3000â,
encap(zwave.meterV3.meterGet(scale: 2), endpoint)
]
}
def on() { onOffCmd(0xFF) }
def off() { onOffCmd(0x0) }
def on1() { onOffCmd(0xFF, 1) }
def on2() { onOffCmd(0xFF, 2) }
def on3() { onOffCmd(0xFF, 3) }
def on4() { onOffCmd(0xFF, 4) }
def on5() { onOffCmd(0xFF, 5) }
def on6() { onOffCmd(0xFF, 6) }
def off1() { onOffCmd(0x0, 1) }
def off2() { onOffCmd(0x0, 2) }
def off3() { onOffCmd(0x0, 3) }
def off4() { onOffCmd(0x0, 4) }
def off5() { onOffCmd(0x0, 5) }
def off6() { onOffCmd(0x0, 6) }
def refresh() {
delayBetween([
zwave.basicV1.basicGet().format(),
zwave.meterV3.meterGet(scale: 0).format(),
zwave.meterV3.meterGet(scale: 2).format(),
encap(zwave.basicV1.basicGet(), 1) // further gets are sent from the basic report handler
])
}
def resetCmd(endpoint = null) {
delayBetween([
encap(zwave.meterV2.meterReset(), endpoint),
encap(zwave.meterV2.meterGet(scale: 0), endpoint)
])
}
def reset() {
delayBetween([resetCmd(null), reset1(), reset2(), reset3(), reset4(), reset5(), reset6()])
}
def reset1() { resetCmd(1) }
def reset2() { resetCmd(2) }
def reset3() { resetCmd(3) }
def reset4() { resetCmd(4) }
def reset5() { resetCmd(5) }
def reset6() { resetCmd(6) }
def configure() {
def cmds = [
zwave.configurationV1.configurationSet(parameterNumber: 101, size: 4, configurationValue: [0, 0, 0, 1]).format(),
zwave.configurationV1.configurationSet(parameterNumber: 102, size: 4, configurationValue: [0, 0, 0x79, 0]).format(),
zwave.configurationV1.configurationSet(parameterNumber: 112, size: 4, scaledConfigurationValue: 90).format(),
]
[5, 8, 9, 10, 11].each { p â
cmds << zwave.configurationV1.configurationSet(parameterNumber: p, size: 2, scaledConfigurationValue: 5).format()
}
[12, 15, 16, 17, 18].each { p â
cmds << zwave.configurationV1.configurationSet(parameterNumber: p, size: 1, scaledConfigurationValue: 50).format()
}
cmds += [
zwave.configurationV1.configurationSet(parameterNumber: 111, size: 4, scaledConfigurationValue: 15*60).format(),
zwave.configurationV1.configurationSet(parameterNumber: 4, size: 1, configurationValue: [1]).format(),
]
delayBetween(cmds) + âdelay 5000â + refresh()
}
private encap(cmd, endpoint) {
if (endpoint) {
if (cmd.commandClassId == 0x32) {
// Metered outlets are numbered differently than switches
if (endpoint < 0x80) {
endpoint += 2
} else {
endpoint = ((endpoint & 0x7F) << 2) | 0x80
}
}
zwave.multiChannelV3.multiChannelCmdEncap(destinationEndPoint:endpoint).encapsulate(cmd).format()
} else {
cmd.format()
}
}
And created virtual switches for the 6 nodes with this smartapp:
[[RELEASE] Virtual / Physical Switch Sync]