From bc9a169ac804537eb8f72ebf90dfd5bbd6589fbf Mon Sep 17 00:00:00 2001 From: PKacprowiczS Date: Fri, 18 Sep 2020 17:17:27 +0200 Subject: [PATCH] Moved to querying energy usage after power report --- .../qubino-flush-2-relay.groovy | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/devicetypes/qubino/qubino-flush-2-relay.src/qubino-flush-2-relay.groovy b/devicetypes/qubino/qubino-flush-2-relay.src/qubino-flush-2-relay.groovy index 0ca6adcc5a2..69e4bc8b560 100644 --- a/devicetypes/qubino/qubino-flush-2-relay.src/qubino-flush-2-relay.groovy +++ b/devicetypes/qubino/qubino-flush-2-relay.src/qubino-flush-2-relay.groovy @@ -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 = [:] @@ -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") { @@ -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)) } }