How do I add Nest Thermostat into ST?

Any android users having any luck with this updating without hitting refresh? I’ve tried all the listed device types and none update the current state of the nest. The only way to get current state is to hit refresh.

You’ll probably need to add something like Pollster

1 Like

Hi guys,

This is my first post here @ ST. I just want to thank luisv for his set of instructions. They worked flawlessly for me and were really easy to follow.

Is there any method for getting the Nest to update in real time? I have to refresh my device windo to get the current state. Is that jsut a display issue or does it not report to Smartthings unless you force it to?

I have a Nest that only servers heat. I can’t seem to get rid of Auto & Cool option. What do i need to omit to make those options unavailable?

Thank you

Also is there a way to move the “Refresh” tile up?

Pollster works great! It is not real time updates but every 5 minutes which meets my needs just fine.

In the code there should be detals line (for me around line 148) and looks something like this:

        details(["temperature", "thermostatMode",  "thermostatFanMode", "TempUp", "TempDown", //"coolSliderControl", 
    "coolingSetpoint", "TempUpHeat", "TempDownHeat", "heatingSetpoint", "humidity", "presence", "refresh"]) }

You can reorder them and remove what you don’t what displayed.

For the Auto/Cool/Heat you should be able to just delete the ones you don’t want from this section:

        standardTile("thermostatMode", "device.thermostatMode", inactiveLabel: false, decoration: "flat") {
        state "heat", label:'', action:"thermostat.heat", icon: "st.thermostat.heat", backgroundColor: '#E14902'
        state "cool", label:'', action:"thermostat.cool", icon: "st.thermostat.cool", backgroundColor: '#003CEC'
        state "range", label:'', action:"thermostat.auto", icon: "st.thermostat.auto", backgroundColor: '#000000'
        state "off", label:'', action:"thermostat.off", icon: "st.thermostat.heating-cooling-off"
    }

That part worked well, I was able to move the “refresh” up. Thank you!

My code looks like this

    standardTile("thermostatMode", "device.thermostatMode", inactiveLabel: true, decoration: "flat") {
        state("auto", action:"thermostat.off", icon: "st.thermostat.auto")
        state("off", action:"thermostat.cool", icon: "st.thermostat.heating-cooling-off")
        state("cool", action:"thermostat.heat", icon: "st.thermostat.cool")
        state("heat", action:"thermostat.auto", icon: "st.thermostat.heat"

If i remove “auto” and “cool” it just goes to “off” and i’m unable to change the state anymore, but the nest online shows “cool” so its out of whack.

Well it looks a little more complicated than I thought. Reading through the logic I think I see the issue.

There is a method that expects each action to be after the previous, here is what it looks like:

def setThermostatMode(mode) {
log.debug "mode is $mode"
// rotate through 4 options heat,cool, range, off
switch (mode)
{
case 'heat' : 
mode = "cool" 
break
case 'cool' : 
mode = "range"
break
case 'range' : 
mode = "off" 
break
case 'off' : 
mode = "heat" 
break
default : 
mode = "off" 
break
}

Removing the modes you don’t want should make it work. I think this is what you are looking for:

def setThermostatMode(mode) {
log.debug "mode is $mode"
// rotate through 2 options heat,, off
switch (mode)
{
case 'heat' : 
    mode = "off" 
break
case 'off' : 
    mode = "heat" 
break
default : 
    mode = "off" 
break
}

Genius THANK YOU!

I also had to modify

        state("off", action:"thermostat.heat", icon: "st.thermostat.heating-cooling-off")
        state("heat", action:"thermostat.off", icon: "st.thermostat.heat")

So it scrolls through off / heat only properly.

Glad it worked out. With Polling integration with Nest Thermostat is pretty good.

So… What is the full coding to get this up and running ?
I am sooooooo lost now hahaha.
Forgive me I’m also new.

Just use the device type here: https://github.com/smartthings-users/device-type.nest
and add pollster to get updates ("Pollster" - A SmartThings Polling Daemon) I set mine for every 10 minutes.

1 Like

Thanks for the pollster tip, didn’t realized I needed for smartthings to update the nest’s current state. Works great now. However, presence is still not updating. The nest app shows auto-away, smartthings shows present. Am I missing something? I would like to get this working so I can use nest a presence detector when smartthings is set to away mode.

I think I see the issue. The code only looks for away and not auto-away. Not sure how complicated it will be to update, probably not too bad. It will require some logic changes.

Well at least you identified the issue. What line did you notice the issue on? I have no idea how to program using groovy, but can easily cut and paste code if someone writes it…lol. :smile:

Looked at the Nest API and is has 4 away states: Home,Away, auto-away and unknown. I have a feeling that this was changed in the last 6 months or so, and this device in Smartthings still happened to work mostly. To be honest I am not sure why Present is working. I am guessing if its not away its Present.

Around line 533 is the logic to set presence. It may be simple as changing this

if (data.structure.away == 'away') {

to

 if (data.structure.away == 'away' || data.structure.away == 'auto-away' ) {

Can’t test it right now, I have a Giant Dog that triggers Nest Presence sensors.

NEST API:
https://developer.nest.com/documentation/api-reference

Thanks! I created a test device with the new code. Oddly, I just noticed smartthings would not detect even away mode if I used the nest/nest app to change states. It started working as soon as I changed to away within smartthings, then it didn’t matter what device/app I used, it detected the presence state perfectly. I wonder if that was the issue even with auto-away. Guess I’ll find out tomorrow when I’m at work. I’ll report back. Thanks again for the help!

Okay, seems like both nest devices (with and without the codes you suggested) accurately updated themselves to away when the nest changed to auto-away. My smart home nest presence monitor also started working all of a sudden. I am getting notifications any time nest detects a change in the presence state. Looks like all I had to do was initially change the nests state within the smartthings app. After that it began polling the correct state regardless of where I changed it…odd.

1 Like

Its weird. I noticed some timing issues with Nest and API reporting. I have been tinkering with the idea of making a smart app for Nest, so the polling will be automatic.