From 6aa0ff97b3c0d5a6b44e6bd9e04bdc2ade092493 Mon Sep 17 00:00:00 2001 From: Kevin Shuk Date: Fri, 4 Nov 2016 15:18:18 -0700 Subject: [PATCH] Fix CHF-453 on ZigBee switch power * original Health check implementation did not send refresh() commands to hub and thus the device. This fixes that problem. * updated() does not have its return value processed as a list of hub commands. These must be sent explicitly * Explicit returns rock --- .../zigbee-switch-power.src/zigbee-switch-power.groovy | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/devicetypes/smartthings/zigbee-switch-power.src/zigbee-switch-power.groovy b/devicetypes/smartthings/zigbee-switch-power.src/zigbee-switch-power.groovy index d86de90..c118fe6 100644 --- a/devicetypes/smartthings/zigbee-switch-power.src/zigbee-switch-power.groovy +++ b/devicetypes/smartthings/zigbee-switch-power.src/zigbee-switch-power.groovy @@ -84,18 +84,20 @@ def refresh() { def configure() { log.debug "in configure()" - configureHealthCheck() + return configureHealthCheck() } def configureHealthCheck() { Integer hcIntervalMinutes = 12 - refresh() sendEvent(name: "checkInterval", value: hcIntervalMinutes * 60, displayed: false, data: [protocol: "zigbee", hubHardwareId: device.hub.hardwareID]) + return refresh() } def updated() { log.debug "in updated()" - configureHealthCheck() + // updated() doesn't have it's return value processed as hub commands, so we have to send them explicitly + def cmds = configureHealthCheck() + cmds.each{ sendHubCommand(new physicalgraph.device.HubAction(it)) } } def ping() {