How do I add Nest Thermostat into ST?

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.

That would stream line things a bit and cut the need for pollster. BTW smartthings presence detection via nest has been working great all day. Even with auto-away enabled.

My main issue is with the protects. I have 9, polling every minute. So I make 13,000 calls a day. Would be better if it was a single poll for all nest devices. The smartapp will just be the service manager, and would communicate to the device.

This garage door solution uses something like that, just need to take the time to do it.

My Nest Thermostat integration stopped working with the latest app update. That, and when I click on Nest Thermostat in the app, it crashes. This really sucks since all of my routines have thermostat functions in them… ugh, I love and hate you Smartthings.

Same issue here. I tried adding my new nest gen 3 to ST. The Nest adds and ST shows that it is communicating with the nest, but when I try and open the device in the app, the app crashes.

Is there a way to add functionality directly into the device type so that a routine can change it to away when you leave and home when you’re back?

I tried the ‘Change Nest Mode’ SmartApp but it would erratically change the Nest mode even if the home mode hadn’t changed.

I don’t think you can set “away” as part of a routine. Routines have preset actions. turn off lights or set temp. Away is not one of them. What I do is just drop the temp to my Away setting when I do a “Goodbye”, for me that’s close enough.

1 Like

Yeah, that’s what I setup last night, going to give that a try. Thanks!