Skip to content

Commit d69abb6

Browse files
committed
Merge pull request SmartThingsCommunity#385 from SmartThingsCommunity/rich-simulated-thermostat
Adding multiAttributeTile definition to Simulated Thermostat device type handler
2 parents 7429ecc + 358cf26 commit d69abb6

File tree

1 file changed

+47
-16
lines changed

1 file changed

+47
-16
lines changed

devicetypes/smartthings/testing/simulated-thermostat.src/simulated-thermostat.groovy

Lines changed: 47 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2014 SmartThings
2+
* Copyright 2015 SmartThings
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
55
* in compliance with the License. You may obtain a copy of the License at:
@@ -15,18 +15,48 @@ metadata {
1515
// Automatically generated. Make future change here.
1616
definition (name: "Simulated Thermostat", namespace: "smartthings/testing", author: "SmartThings") {
1717
capability "Thermostat"
18+
capability "Relative Humidity Measurement"
1819

1920
command "tempUp"
2021
command "tempDown"
2122
command "heatUp"
2223
command "heatDown"
2324
command "coolUp"
2425
command "coolDown"
25-
command "setTemperature", ["number"]
26+
command "setTemperature", ["number"]
2627
}
2728

28-
tiles {
29-
valueTile("temperature", "device.temperature", width: 1, height: 1) {
29+
tiles(scale: 2) {
30+
multiAttributeTile(name:"thermostatMulti", type:"thermostat", width:6, height:4) {
31+
tileAttribute("device.temperature", key: "PRIMARY_CONTROL") {
32+
attributeState("default", label:'${currentValue}', unit:"dF")
33+
}
34+
tileAttribute("device.temperature", key: "VALUE_CONTROL") {
35+
attributeState("default", action: "setTemperature")
36+
}
37+
tileAttribute("device.humidity", key: "SECONDARY_CONTROL") {
38+
attributeState("default", label:'${currentValue}%', unit:"%")
39+
}
40+
tileAttribute("device.thermostatOperatingState", key: "OPERATING_STATE") {
41+
attributeState("idle", backgroundColor:"#44b621")
42+
attributeState("heating", backgroundColor:"#ffa81e")
43+
attributeState("cooling", backgroundColor:"#269bd2")
44+
}
45+
tileAttribute("device.thermostatMode", key: "THERMOSTAT_MODE") {
46+
attributeState("off", label:'${name}')
47+
attributeState("heat", label:'${name}')
48+
attributeState("cool", label:'${name}')
49+
attributeState("auto", label:'${name}')
50+
}
51+
tileAttribute("device.heatingSetpoint", key: "HEATING_SETPOINT") {
52+
attributeState("default", label:'${currentValue}', unit:"dF")
53+
}
54+
tileAttribute("device.coolingSetpoint", key: "COOLING_SETPOINT") {
55+
attributeState("default", label:'${currentValue}', unit:"dF")
56+
}
57+
}
58+
59+
valueTile("temperature", "device.temperature", width: 2, height: 2) {
3060
state("temperature", label:'${currentValue}', unit:"dF",
3161
backgroundColors:[
3262
[value: 31, color: "#153591"],
@@ -39,51 +69,51 @@ metadata {
3969
]
4070
)
4171
}
42-
standardTile("tempDown", "device.temperature", inactiveLabel: false, decoration: "flat") {
72+
standardTile("tempDown", "device.temperature", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
4373
state "default", label:'down', action:"tempDown"
4474
}
45-
standardTile("tempUp", "device.temperature", inactiveLabel: false, decoration: "flat") {
75+
standardTile("tempUp", "device.temperature", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
4676
state "default", label:'up', action:"tempUp"
4777
}
4878

49-
valueTile("heatingSetpoint", "device.heatingSetpoint", inactiveLabel: false, decoration: "flat") {
79+
valueTile("heatingSetpoint", "device.heatingSetpoint", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
5080
state "heat", label:'${currentValue} heat', unit: "F", backgroundColor:"#ffffff"
5181
}
52-
standardTile("heatDown", "device.temperature", inactiveLabel: false, decoration: "flat") {
82+
standardTile("heatDown", "device.temperature", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
5383
state "default", label:'down', action:"heatDown"
5484
}
55-
standardTile("heatUp", "device.temperature", inactiveLabel: false, decoration: "flat") {
85+
standardTile("heatUp", "device.temperature", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
5686
state "default", label:'up', action:"heatUp"
5787
}
5888

59-
valueTile("coolingSetpoint", "device.coolingSetpoint", inactiveLabel: false, decoration: "flat") {
89+
valueTile("coolingSetpoint", "device.coolingSetpoint", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
6090
state "cool", label:'${currentValue} cool', unit:"F", backgroundColor:"#ffffff"
6191
}
62-
standardTile("coolDown", "device.temperature", inactiveLabel: false, decoration: "flat") {
92+
standardTile("coolDown", "device.temperature", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
6393
state "default", label:'down', action:"coolDown"
6494
}
65-
standardTile("coolUp", "device.temperature", inactiveLabel: false, decoration: "flat") {
95+
standardTile("coolUp", "device.temperature", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
6696
state "default", label:'up', action:"coolUp"
6797
}
6898

69-
standardTile("mode", "device.thermostatMode", inactiveLabel: false, decoration: "flat") {
99+
standardTile("mode", "device.thermostatMode", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
70100
state "off", label:'${name}', action:"thermostat.heat", backgroundColor:"#ffffff"
71101
state "heat", label:'${name}', action:"thermostat.cool", backgroundColor:"#ffa81e"
72102
state "cool", label:'${name}', action:"thermostat.auto", backgroundColor:"#269bd2"
73103
state "auto", label:'${name}', action:"thermostat.off", backgroundColor:"#79b821"
74104
}
75-
standardTile("fanMode", "device.thermostatFanMode", inactiveLabel: false, decoration: "flat") {
105+
standardTile("fanMode", "device.thermostatFanMode", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
76106
state "fanAuto", label:'${name}', action:"thermostat.fanOn", backgroundColor:"#ffffff"
77107
state "fanOn", label:'${name}', action:"thermostat.fanCirculate", backgroundColor:"#ffffff"
78108
state "fanCirculate", label:'${name}', action:"thermostat.fanAuto", backgroundColor:"#ffffff"
79109
}
80-
standardTile("operatingState", "device.thermostatOperatingState") {
110+
standardTile("operatingState", "device.thermostatOperatingState", width: 2, height: 2) {
81111
state "idle", label:'${name}', backgroundColor:"#ffffff"
82112
state "heating", label:'${name}', backgroundColor:"#ffa81e"
83113
state "cooling", label:'${name}', backgroundColor:"#269bd2"
84114
}
85115

86-
main("temperature","operatingState")
116+
main("thermostatMulti")
87117
details([
88118
"temperature","tempDown","tempUp",
89119
"mode", "fanMode", "operatingState",
@@ -101,6 +131,7 @@ def installed() {
101131
sendEvent(name: "thermostatMode", value: "off")
102132
sendEvent(name: "thermostatFanMode", value: "fanAuto")
103133
sendEvent(name: "thermostatOperatingState", value: "idle")
134+
sendEvent(name: "humidity", value: 53, unit: "%")
104135
}
105136

106137
def parse(String description) {

0 commit comments

Comments
 (0)