Skip to content

Commit

Permalink
Moved to querying energy usage after power report
Browse files Browse the repository at this point in the history
  • Loading branch information
PKacprowiczS committed Sep 18, 2020
1 parent f55a93c commit bc9a169
Showing 1 changed file with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ def installed() {
addChildSwitches(state.numberOfSwitches)
}

schedule(new Date(), getEnergyUsage)
sendEvent(name: "checkInterval", value: 2 * 15 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID])
// Preferences template begin
state.currentPreferencesState = [:]
Expand Down Expand Up @@ -116,14 +115,6 @@ def updated() {
// Preferences template end
}

private getEnergyUsage() {
def cmds = []
for (def endpoint : 1..state.numberOfSwitches) {
cmds += encap(zwave.meterV3.meterGet(scale: 0x00), endpoint)
}
sendHubCommand(cmds)
}

def excludeParameterFromSync(preference){
def exclude = false
if (preference.key == "outputQ2SwitchSelection") {
Expand Down Expand Up @@ -265,11 +256,15 @@ private changeSwitch(endpoint, cmd) {
def zwaveEvent(physicalgraph.zwave.commands.meterv3.MeterReport cmd, ep = null) {
log.debug "Meter ${cmd}" + (ep ? " from endpoint $ep" : "")
if (ep == 1) {
createEvent(createMeterEventMap(cmd))
[
createEvent(createMeterEventMap(cmd)),
response(encap(zwave.meterV3.meterGet(scale: 0x00), 1))
]
} else if (ep) {
String childDni = "${device.deviceNetworkId}:$ep"
def child = childDevices.find { it.deviceNetworkId == childDni }
child?.sendEvent(createMeterEventMap(cmd))
response(encap(zwave.meterV3.meterGet(scale: 0x00), ep))
}
}

Expand Down

0 comments on commit bc9a169

Please sign in to comment.