From 71d2b89a3709b332f32aff70ca75b2415c73609e Mon Sep 17 00:00:00 2001 From: Yaima Valdivia Date: Mon, 29 Feb 2016 14:15:56 -0800 Subject: [PATCH] Ecobee multiple sensors fix https://smartthings.atlassian.net/browse/DVCSMP-1511 --- .../ecobee-sensor.src/ecobee-sensor.groovy | 11 ++++++++++- .../ecobee-connect.src/ecobee-connect.groovy | 16 ++++++++++------ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/devicetypes/smartthings/ecobee-sensor.src/ecobee-sensor.groovy b/devicetypes/smartthings/ecobee-sensor.src/ecobee-sensor.groovy index 2753e9b..a945352 100644 --- a/devicetypes/smartthings/ecobee-sensor.src/ecobee-sensor.groovy +++ b/devicetypes/smartthings/ecobee-sensor.src/ecobee-sensor.groovy @@ -26,7 +26,16 @@ metadata { valueTile("temperature", "device.temperature", width: 2, height: 2) { state("temperature", label:'${currentValue}°', unit:"F", backgroundColors:[ - [value: 31, color: "#153591"], + // Celsius + [value: 0, color: "#153591"], + [value: 7, color: "#1e9cbb"], + [value: 15, color: "#90d2a7"], + [value: 23, color: "#44b621"], + [value: 28, color: "#f1d801"], + [value: 35, color: "#d04e00"], + [value: 37, color: "#bc2323"], + // Fahrenheit + [value: 40, color: "#153591"], [value: 44, color: "#1e9cbb"], [value: 59, color: "#90d2a7"], [value: 74, color: "#44b621"], diff --git a/smartapps/smartthings/ecobee-connect.src/ecobee-connect.groovy b/smartapps/smartthings/ecobee-connect.src/ecobee-connect.groovy index 0ab4aa4..ea32f56 100644 --- a/smartapps/smartthings/ecobee-connect.src/ecobee-connect.groovy +++ b/smartapps/smartthings/ecobee-connect.src/ecobee-connect.groovy @@ -235,6 +235,7 @@ def connectionStatus(message, redirectUrl = null) { def getEcobeeThermostats() { log.debug "getting device list" + atomicState.remoteSensors = [] def requestBody = '{"selection":{"selectionType":"registered","selectionMatch":"","includeRuntime":true,"includeSensors":true}}' @@ -251,7 +252,7 @@ def getEcobeeThermostats() { if (resp.status == 200) { resp.data.thermostatList.each { stat -> - atomicState.remoteSensors = stat.remoteSensors + atomicState.remoteSensors = atomicState.remoteSensors == null ? stat.remoteSensors : atomicState.remoteSensors << stat.remoteSensors def dni = [app.id, stat.identifier].join('.') stats[dni] = getThermostatDisplayName(stat) } @@ -273,11 +274,14 @@ def getEcobeeThermostats() { Map sensorsDiscovered() { def map = [:] - atomicState.remoteSensors.each { - if (it.type != "thermostat") { - def value = "${it?.name}" - def key = "ecobee_sensor-"+ it?.id + "-" + it?.code - map["${key}"] = value + log.info "list ${atomicState.remoteSensors}" + atomicState.remoteSensors.each { sensors -> + sensors.each { + if (it.type != "thermostat") { + def value = "${it?.name}" + def key = "ecobee_sensor-"+ it?.id + "-" + it?.code + map["${key}"] = value + } } } atomicState.sensors = map