How to have Nest switch between Home & Away modes?

I just got my SmartThings hub last night and started getting everything set up with my z-wave devices. I’m migrating over from a Vera lite so already had a bunch of switches and outlets installed in my home. I also have a Nest thermostat that I’d like to control. I created a new device type using the code @pstuart provided and was able to successfully add my Nest thermostat to my devices. The problem is I’m not sure how to set it up so that the Nest switches from Home to Away mode when my ST hub goes into away mode. I currently have my hub set up to switch to away mode when it detects that both my wife and I are out of the house (using our iPhones as presence sensors). I see where I can have the Nest change to a specific temp when that happens but not where I can have it go into Away mode. I’d prefer to control things this way rather than use the auto-away feature built into Nest. Is this possible?

Wouldn’t take much to modify this to do what you want…

Hate to sound like a total noob, but could you tell me how exactly I would go about implementing that code? Do I create another device type like I did with the original Nest device or do I add that to the code somewhere? I’m still brand new to all of this.

edit Think I figured it out. Thanks!

Glad you figured it out, now, in the spirit of openness, share your modifications to my code so others can benefit. :smile:
I am away from home now, but I think you could have used modes to do this as well, but then again, I think that I looked and wrote this to do a scheduled away mode and used a motion sensor to tell Nest I’m back. Could easily swap out the motion subscribe with a presence* group.

Let me know if you need help with the code to do this.

Yes please! :slight_smile:

This would be perfect. My Nest is in a place that may not be activated when people come and go and it’s always annoyed me to have to make a special trip to that part of the house just to walk by it and wake it up. Integrated in to ST presence would be great!


Sorry, been a bit distracted these couple of weeks. I will see what I can do to help out here this week, but lots on my plate that the moment.