mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-04-07 06:13:07 +01:00
Fixed Ecobee polling
https://smartthings.atlassian.net/browse/DVCSMP-1511 Ecobee was polling once per device, creating multiple API calls. Now it is polling once at the smartapp level every 5 minutes and sending the response to each child device.
This commit is contained in:
@@ -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()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user