diff --git a/devicetypes/smartthings/ecobee-sensor.src/ecobee-sensor.groovy b/devicetypes/smartthings/ecobee-sensor.src/ecobee-sensor.groovy index 6110a27..381f6fc 100644 --- a/devicetypes/smartthings/ecobee-sensor.src/ecobee-sensor.groovy +++ b/devicetypes/smartthings/ecobee-sensor.src/ecobee-sensor.groovy @@ -20,7 +20,6 @@ metadata { capability "Temperature Measurement" capability "Motion Sensor" capability "Refresh" - capability "Polling" } tiles { @@ -68,6 +67,6 @@ def refresh() { void poll() { log.debug "Executing 'poll' using parent SmartApp" - parent.pollChild(this) + parent.pollChild() } diff --git a/devicetypes/smartthings/ecobee-thermostat.src/ecobee-thermostat.groovy b/devicetypes/smartthings/ecobee-thermostat.src/ecobee-thermostat.groovy index eb245d6..8c190b2 100644 --- a/devicetypes/smartthings/ecobee-thermostat.src/ecobee-thermostat.groovy +++ b/devicetypes/smartthings/ecobee-thermostat.src/ecobee-thermostat.groovy @@ -20,7 +20,6 @@ metadata { capability "Actuator" capability "Thermostat" capability "Temperature Measurement" - capability "Polling" capability "Sensor" capability "Refresh" capability "Relative Humidity Measurement" @@ -134,9 +133,7 @@ def refresh() { void poll() { log.debug "Executing 'poll' using parent SmartApp" - - def results = parent.pollChild(this) - generateEvent(results) //parse received message from parent + parent.pollChild() } def generateEvent(Map results) { diff --git a/smartapps/smartthings/ecobee-connect.src/ecobee-connect.groovy b/smartapps/smartthings/ecobee-connect.src/ecobee-connect.groovy index d66e7c0..b077c43 100644 --- a/smartapps/smartthings/ecobee-connect.src/ecobee-connect.groovy +++ b/smartapps/smartthings/ecobee-connect.src/ecobee-connect.groovy @@ -463,29 +463,33 @@ def pollChildren(child = null) { } // Poll Child is invoked from the Child Device itself as part of the Poll Capability -def pollChild(child){ +def pollChild(){ - if (pollChildren(child)){ - if (!child.device.deviceNetworkId.startsWith("ecobee_sensor")){ - if(atomicState.thermostats[child.device.deviceNetworkId] != null) { - def tData = atomicState.thermostats[child.device.deviceNetworkId] - log.info "pollChild(child)>> data for ${child.device.deviceNetworkId} : ${tData.data}" - child.generateEvent(tData.data) //parse received message from parent - } else if(atomicState.thermostats[child.device.deviceNetworkId] == null) { - log.error "ERROR: Device connection removed? no data for ${child.device.deviceNetworkId}" - return null + def devices = getChildDevices() + + if (pollChildren()){ + devices.each { child -> + log.info "***found $child" + if (!child.device.deviceNetworkId.startsWith("ecobee_sensor")){ + if(atomicState.thermostats[child.device.deviceNetworkId] != null) { + def tData = atomicState.thermostats[child.device.deviceNetworkId] + log.info "pollChild(child)>> data for ${child.device.deviceNetworkId} : ${tData.data}" + child.generateEvent(tData.data) //parse received message from parent + } else if(atomicState.thermostats[child.device.deviceNetworkId] == null) { + log.error "ERROR: Device connection removed? no data for ${child.device.deviceNetworkId}" + return null + } } } } else { - log.info "ERROR: pollChildren(child) for ${child.device.deviceNetworkId} after polling" + log.info "ERROR: pollChildren()" return null } } void poll() { - def devices = getChildDevices() - devices.each {pollChild(it)} + pollChild() } def availableModes(child) {