Merge pull request #624 from Yaima/master

Fixed Ecobee polling
This commit is contained in:
Yaima
2016-03-11 13:02:15 -08:00
3 changed files with 19 additions and 19 deletions

View File

@@ -20,7 +20,6 @@ metadata {
capability "Temperature Measurement" capability "Temperature Measurement"
capability "Motion Sensor" capability "Motion Sensor"
capability "Refresh" capability "Refresh"
capability "Polling"
} }
tiles { tiles {
@@ -68,6 +67,6 @@ def refresh() {
void poll() { void poll() {
log.debug "Executing 'poll' using parent SmartApp" log.debug "Executing 'poll' using parent SmartApp"
parent.pollChild(this) parent.pollChild()
} }

View File

@@ -20,7 +20,6 @@ metadata {
capability "Actuator" capability "Actuator"
capability "Thermostat" capability "Thermostat"
capability "Temperature Measurement" capability "Temperature Measurement"
capability "Polling"
capability "Sensor" capability "Sensor"
capability "Refresh" capability "Refresh"
capability "Relative Humidity Measurement" capability "Relative Humidity Measurement"
@@ -134,9 +133,7 @@ def refresh() {
void poll() { void poll() {
log.debug "Executing 'poll' using parent SmartApp" log.debug "Executing 'poll' using parent SmartApp"
parent.pollChild()
def results = parent.pollChild(this)
generateEvent(results) //parse received message from parent
} }
def generateEvent(Map results) { def generateEvent(Map results) {

View File

@@ -463,29 +463,33 @@ def pollChildren(child = null) {
} }
// Poll Child is invoked from the Child Device itself as part of the Poll Capability // Poll Child is invoked from the Child Device itself as part of the Poll Capability
def pollChild(child){ def pollChild(){
if (pollChildren(child)){ def devices = getChildDevices()
if (!child.device.deviceNetworkId.startsWith("ecobee_sensor")){
if(atomicState.thermostats[child.device.deviceNetworkId] != null) { if (pollChildren()){
def tData = atomicState.thermostats[child.device.deviceNetworkId] devices.each { child ->
log.info "pollChild(child)>> data for ${child.device.deviceNetworkId} : ${tData.data}" log.info "***found $child"
child.generateEvent(tData.data) //parse received message from parent if (!child.device.deviceNetworkId.startsWith("ecobee_sensor")){
} else if(atomicState.thermostats[child.device.deviceNetworkId] == null) { if(atomicState.thermostats[child.device.deviceNetworkId] != null) {
log.error "ERROR: Device connection removed? no data for ${child.device.deviceNetworkId}" def tData = atomicState.thermostats[child.device.deviceNetworkId]
return null 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 { } else {
log.info "ERROR: pollChildren(child) for ${child.device.deviceNetworkId} after polling" log.info "ERROR: pollChildren()"
return null return null
} }
} }
void poll() { void poll() {
def devices = getChildDevices() pollChild()
devices.each {pollChild(it)}
} }
def availableModes(child) { def availableModes(child) {