How to install your Nest Thermostat on SmartThings

I will try to make it as simple as I can but please leave a comment if think that anything needs clarification.

  • Log in to SmartThings IDE
  • Go to “My Device Type” and click on “+New SmartDevice”
  • Create the Device type with the following values
  • Name: Nest Thermostat
  • Author:Β juano23@gmail.com
  • In the following page paste the code below
  • Go to “My Devices” and click on “+New Device”
  • Create the Device type with the following values
  • Name: Nest Thermostat
  • Device Network Id:Β 2323
  • Type: Nest Thermostat

Restart the SmartThings App and you should be able to see the new device πŸ™‚

Go to preferences, inside the device, you will be able to enter your user, password and serial number for the Nest you wish to control.Β 

You can create more than one device using the same device type just make sure to enter the serial number for each.Β 

If you like to collaborate please contact me atΒ juano23@gmail.com

/**
 *  Nest Direct
 *
 *  Author: dianoga7@3dgo.net
 *  Code: https://github.com/smartthings-users/device-type.nest
 */
 
preferences {
    input("username", "text", title: "Username", description: "Your Nest username (usually an email address)")
    input("password", "password", title: "Password", description: "Your Nest password")
    input("serial", "text", title: "Serial #", description: "The serial number of your thermostat")
}

 // for the UI
metadata {
    definition (name: "Nest Thermostat", namespace: "juano2310", author: "juano23@gmail.com") {
        capability "Polling"
        capability "Relative Humidity Measurement"
        capability "Thermostat"
        capability "Temperature Measurement"

        attribute "presence", "string"

        command "away"
        command "present"
        command "setPresence"
        command "range"
    }

    simulator {
        // TODO: define status and reply messages here
    }

    tiles {
        valueTile("temperature", "device.temperature", width: 2, height: 2, canChangeIcon: true) {
            state("temperature", label: '${currentValue}Β°', unit:"F", backgroundColors: [
                    [value: 31, color: "#153591"],
                    [value: 44, color: "#1e9cbb"],
                    [value: 59, color: "#90d2a7"],
                    [value: 74, color: "#44b621"],
                    [value: 84, color: "#f1d801"],
                    [value: 95, color: "#d04e00"],
                    [value: 96, color: "#bc2323"]
                ]
            )
        }
        standardTile("thermostatMode", "device.thermostatMode", inactiveLabel: false) {
            state("range", label:'${name}', action:"thermostat.off", icon: "st.Weather.weather14", backgroundColor: '#714377')
            state("off", label:'${name}', action:"thermostat.cool", icon: "st.Outdoor.outdoor19")
            state("cool", label:'${name}', action:"thermostat.heat", icon: "st.Weather.weather7", backgroundColor: '#003CEC')
            state("heat", label:'${name}', action:"range", icon: "st.Weather.weather14", backgroundColor: '#E14902')
        }
        standardTile("thermostatFanMode", "device.thermostatFanMode", inactiveLabel: false, decoration: "flat") {
            state "auto", label:'${name}', action:"thermostat.fanOn", icon: "st.Appliances.appliances11"
            state "on", label:'${name}', action:"thermostat.fanCirculate", icon: "st.Appliances.appliances11"
            state "circulate", label:'${name}', action:"thermostat.fanAuto", icon: "st.Appliances.appliances11"
        }
        controlTile("coolSliderControl", "device.coolingSetpoint", "slider", height: 1, width: 2, inactiveLabel: false) {
            state "setCoolingSetpoint", label:'Set temperarure to', action:"thermostat.setCoolingSetpoint",
            backgroundColors:[
                [value: 31, color: "#153591"],
                [value: 44, color: "#1e9cbb"],
                [value: 59, color: "#90d2a7"],
                [value: 74, color: "#44b621"],
                [value: 84, color: "#f1d801"],
                [value: 95, color: "#d04e00"],
                [value: 96, color: "#bc2323"]
            ]
        }
        valueTile("coolingSetpoint", "device.coolingSetpoint", inactiveLabel: false, decoration: "flat") {
            state "default", label:'${currentValue}Β°', unit:"F", backgroundColor:"#ffffff", icon:"st.appliances.appliances8"
        }
        valueTile("heatingSetpoint", "device.heatingSetpoint", inactiveLabel: false, decoration: "flat") {
            state "default", label:'${currentValue}Β°', unit:"F", backgroundColor:"#ffffff", icon:"st.appliances.appliances8"
        }
        valueTile("humidity", "device.humidity", inactiveLabel: false) {
            state "default", label:'${currentValue}% Humidity', unit:"Humidity"
        }
        standardTile("presence", "device.presence", inactiveLabel: false, decoration: "flat") {
            state "present", label:'${name}', action:"away", icon: "st.Home.home2"
            state "away", label:'${name}', action:"present", icon: "st.Transportation.transportation5"
        }
        standardTile("refresh", "device.thermostatMode", inactiveLabel: false, decoration: "flat") {
            state "default", action:"polling.poll", icon:"st.secondary.refresh"
        }
        main "temperature"
        details(["temperature", "coolingSetpoint", "heatingSetpoint", "coolSliderControl", "heatSliderControl", "thermostatMode", "presence", "thermostatFanMode", "humidity", "refresh"])
    }
}

// parse events into attributes
def parse(String description) {

}

// handle commands
def setHeatingSetpoint(temp) {
    def latestThermostatMode = device.latestState('thermostatMode')
    
    if (temp) {
        if (latestThermostatMode.stringValue == 'range') {
            api('temperature', ['target_change_pending': true, 'target_temperature_low': fToC(temp)]) {
                sendEvent(name: 'heatingSetpoint', value: temp)
            }
        } else if (latestThermostatMode.stringValue == 'cool') {
            api('temperature', ['target_change_pending': true, 'target_temperature': fToC(temp)]) {
                sendEvent(name: 'heatingSetpoint', value: temp)
            }
        }
    }
}

def setCoolingSetpoint(temp) {
    def latestThermostatMode = device.latestState('thermostatMode')
    
    if (temp) {
        if (latestThermostatMode.stringValue == 'range') {
            api('temperature', ['target_change_pending': true, 'target_temperature_high': fToC(temp)]) {
                sendEvent(name: 'coolingSetpoint', value: temp)
            }
        } else if (latestThermostatMode.stringValue == 'cool') {
            api('temperature', ['target_change_pending': true, 'target_temperature': fToC(temp)]) {
                sendEvent(name: 'coolingSetpoint', value: temp)
            }
        }
    }
}

def off() {
    setThermostatMode('off')
}

def heat() {
    setThermostatMode('heat')
}

def emergencyHeat() {
    setThermostatMode('heat')
}

def cool() {
    setThermostatMode('cool')
}

def range() {
    setThermostatMode('range')
}

def setThermostatMode(mode) {
    mode = mode == 'emergency heat'? 'heat' : mode
    
    api('thermostat_mode', ['target_change_pending': true, 'target_temperature_type': mode]) {
        sendEvent(name: 'thermostatMode', value: mode)
        poll()
    }
}

def fanOn() {
    setThermostatFanMode('on')
}

def fanAuto() {
    setThermostatFanMode('auto')
}

def fanCirculate() {
    setThermostatFanMode('circulate')
}

def setThermostatFanMode(mode) {
    def modes = [
        on: ['fan_mode': 'on'],
        auto: ['fan_mode': 'auto'],
        circulate: ['fan_mode': 'duty-cycle', 'fan_duty_cycle': 900]
    ]

    api('fan_mode', modes.getAt(mode)) {
        sendEvent(name: 'thermostatFanMode', value: mode)
    }
}

def away() {
    setPresence('away')
}

def present() {
    setPresence('present')
}

def setPresence(status) {
    log.debug "Status: $status"
    api('presence', ['away': status == 'away', 'away_timestamp': new Date().getTime(), 'away_setter': 0]) {
        sendEvent(name: 'presence', value: status)
    }
}

def auto() {
    log.debug "Executing 'auto'"
}

def poll() {
    log.debug "Executing 'poll'"
    api('status', []) {
        data.device = it.data.device.getAt(settings.serial)
        data.shared = it.data.shared.getAt(settings.serial)
        data.structureId = it.data.link.getAt(settings.serial).structure.tokenize('.')[1]
        data.structure = it.data.structure.getAt(data.structureId)
                
        data.device.fan_mode = data.device.fan_mode == 'duty-cycle'? 'circulate' : data.device.fan_mode
        data.structure.away = data.structure.away ? 'away' : 'present'
        
        log.debug(data.shared)
        
        def humidity = data.device.current_humidity
        def temperature = Math.round(cToF(data.shared.current_temperature))
        def temperatureType = data.shared.target_temperature_type
        def fanMode = data.device.fan_mode
        
        sendEvent(name: 'humidity', value: humidity)
        sendEvent(name: 'temperature', value: temperature, state: temperatureType)
        sendEvent(name: 'thermostatFanMode', value: fanMode)
        sendEvent(name: 'thermostatMode', value: temperatureType)
        
        def targetTemperature = Math.round(cToF(data.shared.target_temperature))
        def heatingSetpoint = '--'
        def coolingSetpoint = '--'
        
        if (temperatureType == "cool") {
            coolingSetpoint = targetTemperature
        } else if (temperatureType == "heat") {
            heatingSetpoint = targetTemperature
        } else if (temperatureType == "range") {
            coolingSetpoint = Math.round(cToF(data.shared.target_temperature_high))
            heatingSetpoint = Math.round(cToF(data.shared.target_temperature_low))
        }
        
        sendEvent(name: 'coolingSetpoint', value: coolingSetpoint)
        sendEvent(name: 'heatingSetpoint', value: heatingSetpoint)
        sendEvent(name: 'presence', value: data.structure.away)
    }
}

def api(method, args = [], success = {}) {
    if(!isLoggedIn()) {
        log.debug "Need to login"
        login(method, args, success)
        return
    }

    def methods = [
        'status': [uri: "/v2/mobile/${data.auth.user}", type: 'get'],
        'fan_mode': [uri: "/v2/put/device.${settings.serial}", type: 'post'],
        'thermostat_mode': [uri: "/v2/put/shared.${settings.serial}", type: 'post'],
        'temperature': [uri: "/v2/put/shared.${settings.serial}", type: 'post'],
        'presence': [uri: "/v2/put/structure.${data.structureId}", type: 'post']
    ]

    def request = methods.getAt(method)

    log.debug "Logged in"
    doRequest(request.uri, args, request.type, success)
}

// Need to be logged in before this is called. So don't call this. Call api.
def doRequest(uri, args, type, success) {
    log.debug "Calling $type : $uri : $args"

    if(uri.charAt(0) == '/') {
        uri = "${data.auth.urls.transport_url}${uri}"
    }

    def params = [
        uri: uri,
        headers: [
            'X-nl-protocol-version': 1,
            'X-nl-user-id': data.auth.userid,
            'Authorization': "Basic ${data.auth.access_token}"
        ],
        body: args
    ]

    try {
        if(type == 'post') {
            httpPostJson(params, success)
        } else if (type == 'get') {
            httpGet(params, success)
        }
    } catch (Throwable e) {
        login()
    }
}

def login(method = null, args = [], success = {}) {
    def params = [
        uri: 'https://home.nest.com/user/login',
        body: [username: settings.username, password: settings.password]
    ]

    httpPost(params) {response ->
        data.auth = response.data
        data.auth.expires_in = Date.parse('EEE, dd-MMM-yyyy HH:mm:ss z', response.data.expires_in).getTime()
        log.debug data.auth

        api(method, args, success)
    }
}

def isLoggedIn() {
    if(!data.auth) {
        log.debug "No data.auth"
        return false
    }

    def now = new Date().getTime();
    return data.auth.expires_in > now
}

def cToF(temp) {
    return temp * 1.8 + 32
}

def fToC(temp) {
    return (temp - 32) / 1.8
}

110 thoughts on “How to install your Nest Thermostat on SmartThings

  1. Anders

    Are you on Android? Just tried this and I think I see the new device, but it keeps crashing for me. Just emailed support about it.

    Reply
        1. juano2310

          Some of the functionalities are not fully developed on the Android version of the App. I think the best option is to contact support on this issue.

          Reply
  2. Stephen Study

    Ok, this is very cool (pun intended). So, how are you handling multiple Nest thermostats? We’ve got an upstairs and a downstairs Nest.

    Reply
      1. Stephen Study

        Thanks. I’d found the Dianoga project and I am successfully controlling both Nests with it. Thanks again.

        Reply
  3. taylorwc

    Terrific that you have published this. I’ve tried adding it to Smart Things–it looks like it is able to control the Nest mode (Cool, Heat, Away), but the tiles in the Smart Things app aren’t quite working. Won’t show current temp or how to adjust. Any pro tips?

    Reply
    1. juano2310

      Hi! The app is not polling automatically so you have to refresh manually. I included a tile that should help you with that. If that doesn’t fix it you might have to kill the app and open it again. I hope to include automatic polling in the future but I’m waiting until SmartThings introduce some changes that allow me to do so on demand.

      Reply
    2. juano2310

      Just checked with a college and the only thing you should do to allow the app to refresh automatically is to add polling to your device type when you define the capabilities. (Step 3 of the tutorial)

      Reply
  4. Glenn

    This seems counter-intuitive to me:

    state “cool”, label:’Cool’, action:”thermostat.heat”, icon: “st.Home.home1”
    state “heat”, label:’Heat’, action:”thermostat.cool”, icon: “st.Home.home1”

    Reply
    1. juano2310

      Hi Glenn, the idea is that the tile shows you what’s the state of the unit and also allows you to change it by tapping the tile. If you tap while is cool it will switch to heat calling the action that does so.

      Reply
    1. juano2310

      Hi! SmartThings and I are waiting for the official Nest API. The best way to follow changes and new implementation is by following me on twitter @juano2310:disqus and @smartthings. Thanks for the positive feedback πŸ™‚

      Reply
      1. johnleecurtis

        I get the following error:

        groovy.lang.MissingMethodException: No signature of method: script14072556387371694280729.metadata() is applicable for argument types: (script14072556387371694280729$_run_closure1) values: [script14072556387371694280729$_run_closure1@1f9de7a2]
        Possible solutions: getMetadata(), getState(), setState(java.lang.Object), metaClass(groovy.lang.Closure)

        What do I need to do to fix this?

        Reply
  5. Eric Kanas

    Hello, I keep getting this error, any suggestions?
    Error500: Internal Server ErrorURI/ide/device/saveReference Id590e44b4-8ff8-4e41-ae9c-94902b36e2a4DateThu Jan 30 14:19:11 UTC 2014Classgroovy.lang.MissingPropertyExceptionMessageNo such property: id for class: java.lang.Long

    Reply
          1. Eric Kanas

            Got it to work! Thanks for your help! Now if I can just find a way to control both my upstairs and downstairs thermostat! I am learning πŸ™‚ thanks for your help!

  6. Marcus Wilson

    First of all, this is awesome! Thank you so much! Second, when using the serial number method to add a second Nest, where do I put the code? I attempted adding it as a preference below the login info on your code and it did not work. I also tried using the exact code of Dianoga but that did not work either.

    Reply
    1. juano2310

      Hi! Use the device type from Dianoga and then create 2 new devices using that device type. In each device you will be able to enter the serial number of each of your nests

      Reply
  7. Jeffery Park

    Hi there, hope this isn’t too much of a noob question. I have a Lennox iComfort thermostat. It is a wifi touch screen that is controllable from my phone or their website. I was wondering if you think it would be possible to do something similar to your setup with the Nest maybe perhaps use it as a starting base. I guess I am wondering how your php code in the “middle man” is connecting with nest website? do they have these services open for this purpose or have you just made your code do what the links on their website/app are doing to control the thermostat? Or if you have any suggestions on where to start.

    Thanks for your time,
    Jeff

    Reply
      1. Jeffery Park

        Thanks,

        I didn’t find php but did find this: https://github.com/ut666/LennoxThermoPi Repo. looks like they have data being gathered. Least that is a start. I also found this: http://haroon.sis.utoronto.ca/rrd/scripts/myicomfort.pl

        Does any of this look like something is possible to you? Looks like more python code but the second link seems to have some set commands. However I don’t know python and not much php. Looks like I might be off to CodeAcademy for a bit to see what I can do.

        Reply
        1. juano2310

          Yes, it is definitely in the right direction. I think the second one outlines the commands better. It’s possible to do that within the SmartThings IDE without a middle man but it requires a good understanding of coding.

          Reply
  8. dj kosa

    Hello, Having trouble integrating my nest with smartthings. I do not have the ability to edit the code. When I create the device, I use nest thermostat as type, and enter n/a as device network id. The device is created but when I click edit I don’t have the ability to edit the code or enter a serial number or anything. Any ideas what I am doing wrong? thanks!

    Reply
    1. juano2310

      Hi, the code should be updated on the device type not the device. Also, if you can’t edit the device type, try to create a new one and then modify the device to point to the new device type. My integration doesn’t require the serial number because it only works with one device.
      Hope this helps!

      Reply
      1. dj kosa

        Just needed developer access. Now I have the correct buttons. I am having an issue though, when I paste the code and click save I get this error:

        org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
        script13993159638142014994265.groovy: 24: expecting anything but ”n”; got it anyway @ line 24, column 23.
        attribute β€œpresence”
        ^

        1 error

        Reply
  9. Ben

    I am not seeing anywhere to paste code…I also don’t see anywhere to put in an author. Also New SmartDevice is not there just my devices. Has Smartthings updated the UI?

    Reply
    1. dj kosa

      I was having the same issue. I had to click on my email in the upper right corner and there was a button to add developer account. I clicked it and I instantly got access granted. Then it will all make sense!

      Reply
  10. Topher

    Is there still an android bug not showing the temperature? It seems to be reporting the humidity and presence/away properly, It just doesn’t show the weather.

    Reply
  11. abdalah

    i can’t get this to work with the smarthings app idk what I’m doing wrong I’m kinda new at this can u assist me?

    Reply
  12. Levi Sickels

    groovy.lang.GroovyRuntimeException: Could not find matching constructor for: java.math.BigDecimal(java.util.ArrayList) @ line 108

    Reply
      1. juano2310

        Thanks for visiting the post πŸ™‚ Now that Nest opened their API we are working with SmartThings to launch on official integration. Stay tuned and thanks again!

        Reply
        1. axid022

          Any update on when ST will release official integration as I am getting fustrated trying to get this to work….lol

          Reply
  13. Chris Flores

    Mine isn’t working. It is added, but the device looks like this and I can’t control anything. Any idea what I did wrong?

    Reply
    1. juano2310

      Did you change the user and password in the code?
      Hopefully SmartThings will release the official integration soon since Nest opened their API.

      Reply
      1. Chris Flores

        I did change the username and password. Does it need to be all uppercase? I double checked the password by re-logging in.

        Reply
        1. juano2310

          No, no need for uppercase. Try changing the namespace to something else.
          Remember to kill the app and launch it again to apply the changes.

          Reply
          1. juano2310

            Line 18, you will see the variable namespace there. Replace “nest” with something else, for example “nestdevice”

          2. Chris Flores

            This isn’t working. Very frustrating. Not sure if I’m selecting all the right options. Published, Self Published, etc….

          3. juano2310

            Hi! I just posted the new code from Dianoga since there is no official release. Sorry for the inconvenience!

        2. Andy

          I have the exact same problem. I’ve changed the namespace to a unique one, and restarted the app, multiple times. I’ll be happy to try and debug this with you if you have any other ideas? I’m not too familiar with device types and how to debug them.

          Reply
          1. juano2310

            Hi Andy! I just posted the new code from Dianoga since there is no official release. Sorry for the inconvenience!

          2. Andy

            Thanks Juano, I actually managed to get the old version working. It would not update until I did it via the debug session online, and after that it worked. I also tweaked it to include the current status (Cooling, heating, fan running), and even managed to now crate an app that warns me IF it turns on Cooling OR Heating AND any of my windows are open… So lots of progress. I’ll have to merge in the changes to the driver sometime so you can all enjoy them.

    2. newzcore.com Recommendation

      Hey guys, I’m getting the same screen….so i’m a little confused on where exactly you would enter you user/pass/serial number. Thought it would be in the Preferences of my new Thermostat device within the SmartThings app, however I only greeted with the option to “Give your device a name” and “update icon”.

      I also attempted adding my user/passwd/serialNum to the preference section of the above code:

      input(“username”, blah@gmail.com“, title: “Username”, description: “Your Nest username (usually an email address)”)

      input(“password”, “somepassword”, title: “Password”, description: “Your Nest password”)

      input(“serial”, “02AA2838376654”, title: “Serial #”, description: “The serial number of your thermostat”)

      No luck! πŸ™

      Reply
      1. juano2310

        The code seams right. An other option is to delete the preference section and create constants like this def “username” = “blah@gmail.com” or to replace any appearance of settings.username with “blah@gmail.com”

        Reply
        1. newzcore.com Recommendation

          interesting…..seems its working to a degree.. when i check the event log for my device after sliding the temp to 73 degrees…I see this:

          2015-04-24 6:27:15.790 PM UTC
          moments agoCOMMANDsetCoolingSetpointsetCoolingSetpoint(73) command was sent to Downstairs Thermostat2015-04-24 5:33:28.864 PM UTC
          56 minutes agoCOMMANDsetCoolingSetpointsetCoolingSetpoint(0) command was sent to Downstairs Thermostat2015-04-24 5:33:13.283 PM UTC
          56 minutes agoCOMMANDfanOnfanOn command was sent to Downstairs Thermostat

          Reply
          1. newzcore.com Recommendation

            lol, that’s the hope…checking my firewall settings. This is my first setup and my nest just so happens to be the only device I have to play around with.. I’m getting commands out, but my none of the temp reading is showing. Anyone has had any firewall related issue with SmartThings?

          2. newzcore.com Recommendation

            Things are starting to look pretty bright now…Activity feed is updating, so is my temp reading….thank you may good sir.

        2. Fun-Home-Auto

          Juano or Others who can offer suggestions,

          Thank you for all your contribution to getting this to work.

          I recently purchased a 3rd Gen Nest, and I am trying to get it to work. I don’t know if there is something different with this version, but after following the simple instructions, I can not get the preferences button, or 3 dot toggle to provide me with fields to enter in my device login, pw, and SN.

          Can you offer any suggestions? I also tried inputting it into the Groovy code, but that did not work either. πŸ™

          My device, in the SmartThings app/Things, appears the same as the post by Chris Flores.

          This is what I did to the code, based on your suggestions above:

          preferences {
          input(“username=Johndoe@hotmail.com”)
          input(“password=Johndoeneedshelp”)
          input(“serial=***************”)
          }

          Reply
          1. Fun-Home-Auto

            I got it to work using the following code, and using the instructions on the page, which are the same as here. The difference is that this offered an editable preferences section, in device type.

            His code also fixes a cooling set point bug.

  14. stant6

    Hi I am trying to enable Z-Wave Inclusion on my Honeywell YTH8320ZW1007/U as the first step to make it connect to the Smartthings Hub and I always get “The Action Failed” message. The hub is in another room than the thermostat. Any ideas??

    Reply
    1. juano2310

      Is that device supported in SmartThing? If so, go to te smartthing’s app, add the device and this will enable discovery mode the. Try to pair it from your device πŸ™‚

      Reply
      1. stant6

        Hi Juan. Yes this thermostat is specifically supported by SmartThings. I went to the app to add it as you suggested. It searches forever w/o finding it. It says underneath the spinning search cog to follow the directions for the thermostat to pair it with the hub. That is what my first comment is about – my unsuccessful attempts to pair it. The thermostat fails to find the hub. The app seems to want that first. Am I missing something in this procedure? Thanks for replying.

        Reply
      2. stant6

        HI again, Juan. It’s working now. I’m not sure what I did differently this time, but the device connection suddenly appeared on the thermostat screen and I was able to use it. I did get my phone near it with the app search or connect feature and that is when it appeared. I thought I did that before, but must have done something else. Thanks for your help!

        Reply
    1. juano2310

      Hi It looks like is a problem with android. You can change de format by changing valueTile, controlTile or standardTile. For example if you change the width on the slider you can use 2 tiles instead of one πŸ™‚

      Hope this helps!

      Reply
      1. Aninda Maitra

        Hi, thanks for all the help btw! But unfortunately I still don’t see the credentials fields. Just to be sure I deleted everything and did it from scratch again.

        Reply
        1. juano2310

          I think that there might be a conflict with the other version. I read about this problem on the forums. Try replacing line 16 with this

          definition (name: “Nest Thermostats”, namespace: “juano2310”, author: “juano23@gmail.com”) {

          Also, on the device, when you choose the device type, check if the next option “Version” is set to “Self-published”

          Reply
    1. juano2310

      I know some people has been having trouble with this too. We will soon release the official integration.

      Reply
    2. Jesse Andrew

      Okay – figured it out, for some reason it changed to “draft” so I changed it to “self-published”

      But it’s still not working. I added my user name, password and serial number and nothing. πŸ™ Any ideas?

      Reply
          1. Jesse Andrew

            Hey Juano, love this integration – I just have one question. The status/states/info from my Nest does not update unless I hit the “Refresh” button. Is there a way to have it automatically refresh?

          2. juano2310

            It’s not very intuitive but you can add runEvery5Minutes(“poll”) to the refresh function and after you executed once it will start polling every 5 minutes πŸ™‚

  15. Richard Pycroft

    Hi there, thanks so much for this, I have managed to add my nest into SmartThings now. Been trying to do this for ages! Any way to change the units to Celsius instead of Fahrenheit? Thanks so much for your help!

    Reply
    1. juano2310

      Hi! To change units you have to do it in your location. There is an option to change units.
      Just to clarify, Location is where you create your account and select activate the Hub πŸ™‚

      Reply
      1. Richard Pycroft

        Thanks for the reply! The units are set to “C” in my location settings but in the code you kindly published above there are a few instances of “Units:”F”” – assume this is overriding that and setting it as F?

        Cheers πŸ™‚

        Reply
        1. Samuel Barr

          I am having the same issue. Its showing my temperature in Fahrenheit despite both nest and smart things being in degrees. Any ideas?

          Reply
  16. HawkHome

    I’ve just installed a 3rd Gen Nest (based in the UK). I’ve tried adding the code and updating the preferences/username code as mentioned in previous comments by Fun-Home-Auto but I can’t get it to work.

    The device appears on the iOS app under ‘Things’ but crashes out as soon as I press on it. I don’t even get to the Nest screen as Chris Flores describes. I’ve noticed on the right hand side of the screen (where the status of each ‘thing’ is displayed) shows “$(CURRENTVALUE)” which I guess shouldn’t be there.

    When I first added the code I got the following error when I published…

    groovy.lang.MissingMethodException: No signature of method: script14514069959981110006917.metadata() is applicable for argument types: (script14514069959981110006917$_run_closure2) values: [script14514069959981110006917$_run_closure2@2eb80b09]
    Possible solutions: getMetadata(), getState(), setState(java.lang.Object), metaClass(groovy.lang.Closure) @ line 8

    Weirdly, when I publish/save the code, leave the page and then try to return to the code it doesn’t display the code I copied and pasted from this website. It only displays…

    /**

    * Nest Thermostat

    *

    * Copyright 2015 juano23@gmail.com

    *

    * Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except

    * in compliance with the License. You may obtain a copy of the License at:

    *

    * http://www.apache.org/licenses/LICENSE-2.0

    *

    * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed

    * on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License

    * for the specific language governing permissions and limitations under the License.

    *

    */

    definition(

    name: “Nest Thermostat”,

    namespace: “hawkinshomestuff”,

    author: “juano23@gmail.com”,

    description: “Nest Thermostat”,

    category: “”,

    iconUrl: “https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png”,

    iconX2Url: “https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png”,

    iconX3Url: “https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png”)

    preferences {

    section(“Title”) {

    // TODO: put inputs here

    }

    }

    def installed() {

    log.debug “Installed with settings: ${settings}”

    initialize()

    }

    def updated() {

    log.debug “Updated with settings: ${settings}”

    unsubscribe()

    initialize()

    }

    def initialize() {

    // TODO: subscribe to attributes, devices, locations, etc.

    }

    // TODO: implement event handlers

    …and that’s it. What am I doing wrong? Any help much appreciated!

    Reply
  17. HawkHome

    I’ve just installed a 3rd Gen Nest (based in the UK). I’ve tried adding the code and updating the preferences/username code as mentioned in previous comments by @funhomeauto:disqus but I can’t get it to work.

    The device appears on the iOS app under ‘Things’ but crashes out as soon as I press on it. I don’t even get to the Nest screen as @disqus_MUcNQPyquD:disqus describes. I’ve noticed on the right hand side of the screen (where the status of each ‘thing’ is displayed) shows “$(CURRENTVALUE)” which I guess shouldn’t be there?

    Any help greatly appreciated.

    Reply
    1. rhostam

      If you haven’t already resolved this, try checking within the IDE. Go to “My Devices” and check to make sure that the Nest Thermostat you added appears there. If it does, click on Nest Thermostat and along the bottom of the subsequent page click on (edit) next to Preferences. You can type in your user name, password, and serial number there. Then save. If the Nest Thermostat doesn’t appear, run through a plain install without modifying any of the code. Add a new device via “My Device” and enter “Nest Thermostat” for “Name*”, “2323” for “Device Network Id*”, select “Nest Thermostat” from “Type*”, “Self-Published” for “Version*”, and select a Location and/or Hub and save. After a period, close app and restart it. The new Thing should automatically be present and configured. In fact, mine had already done a poll by the time I looked.

      Reply
  18. rhostam

    Wow. I was thinking I had to add the Thing manually but it turns out it was just added and already connected. Nice. Thanks! The instructions require a tad of an update since the labels for “My Devices” and “My Device Handlers” are somewhat different. Too bad this isn’t more straight forward and “more” native. I saw a device template for Nest Thermostat but I’m not sure what it does.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *