Show THERMOSTAT_MODE in device list instead of PRIMARY_CONTROL?

thermostat

(Raphael Hsieh) #1

Hi, I’m pretty new to SmartThings development. I’m trying to create my own Thermostat device handler.
I want to be able to toggle my thermostat mode from the device list without needing to click in to the actual device in my SmartThings app.

Is there any way to have the THERMOSTAT_MODE be displayed in my device list rather than the PRIMARY_CONTROL? Or even better, still have the temperature be shown in the device list. But change the color of the button depending on the thermostate mode ?

From what I’ve read the primary control is what dictates the color of the tile AS WELL AS what is displayed in the device list. How can I separate that ?


(Allan) #2

Wouldn’t you just change the “main” tile in the DTH from “temperature” to “mode”? Although this is going to potentially mess up your display of the actual device when you view it.


(Raphael Hsieh) #3

I figured it out.

In my PRIMARY_CONTROL tile, I just needed to add more states.
Where I used to have

tileAttribute("device.temperature", key: "PRIMARY_CONTROL") {
			attributeState("temp", label:'${currentValue}', unit:"dF", defaultState: true)
		}
...

I now have

tileAttribute("device.temperature", key: "PRIMARY_CONTROL") {
            attributeState("off", label:'${currentValue}', unit:"dF", action:"heat", nextState:"turningOn", defaultState: true)
            attributeState("on", label:'${currentValue}', unit:"dF", action:"off", backgroundColor:"#e86d13", nextState:"turningOff")
			attributeState("turningOff", label:'${currentValue}', unit:"dF", action:"heat", nextState:"turningOn")
			attributeState("turningOn", label:'${currentValue}', unit:"dF", action:"off", backgroundColor:"#e86d13", nextState:"turningOff")
		}
...

(Allan) #4

Although that might work I’m pretty sure it’s not correct and might cause some weird issues. Especially since your tile is still tied to temperature and your states of on, off, etc have units in Fahrenheit…


(Eric) #5

good to learn by doing, he got some feedback, posted a followup, maybe he’ll refine it too.

OP, below is the reference thread I use for 2-3 techniques to view a different default capability on the phone-app device list. Vseven already described one of these techniques. The simulator technique was still working for me, for a temperature+moisture sensor a couple days ago.

Sure would be nice to have the default capability changeable in the standard phone interface. I miss it again, every week or two.


(Raphael Hsieh) #6

yeah I struggled for the rest of the day. I actually ended up just creating a new tile to set as “Main” that just shows the thermostatOperatingState, and that will toggle the thermostatMode.
While I can’t see the termperature in the “device list”, I just created a new device that will show me the temperature…