{"id":1788,"date":"2012-12-30T17:13:00","date_gmt":"2012-12-30T23:13:00","guid":{"rendered":"http:\/\/www.wiredprairie.us\/blog\/?p=1788"},"modified":"2013-01-09T07:25:46","modified_gmt":"2013-01-09T13:25:46","slug":"added-awayhome-to-unofficial-nest-api","status":"publish","type":"post","link":"https:\/\/www.wiredprairie.us\/blog\/index.php\/archives\/1788","title":{"rendered":"Added Away\/Home to unofficial-nest-api"},"content":{"rendered":"

I just finished adding a new simple feature to control the away status for a structure to my unofficial-nest-api published on GitHub<\/a> and available as a node package (npm<\/a>).<\/p>\n

Usage is simple as calling setAway <\/strong>or setHome<\/strong> on the nest instance after authentication and a successful status has been returned (see commented calls below).<\/p>\n

[javascript]
\nif (username && password) {
\n username = trimQuotes(username);
\n password = trimQuotes(password);
\n nest.login(username, password, function (data) {
\n if (!data) {
\n console.log(‘Login failed.’);
\n process.exit(1);
\n return;
\n }
\n console.log(‘Logged in.’);
\n nest.fetchStatus(function (data) {
\n for (var deviceId in data.device) {
\n if (data.device.hasOwnProperty(deviceId)) {
\n var device = data.shared[deviceId];
\n console.log(util.format("%s [%s], Current temperature = %d F target=%d",
\n device.name, deviceId,
\n nest.ctof(device.current_temperature),
\n nest.ctof(device.target_temperature)));
\n }
\n }
\n subscribe();
\n \/\/nest.setAway();
\n \/\/nest.setHome();
\n });
\n });
\n}
\n[\/javascript]<\/p>\n","protected":false},"excerpt":{"rendered":"

I just finished adding a new simple feature to control the away status for a structure to my unofficial-nest-api published on GitHub and available as a node package (npm). Usage is simple as calling setAway or setHome on the nest instance after authentication and a successful status has been returned (see commented calls below). [javascript] […]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true},"categories":[4],"tags":[60,38,45,120,124,59],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pd5QIe-sQ","jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":1754,"url":"https:\/\/www.wiredprairie.us\/blog\/index.php\/archives\/1754","url_meta":{"origin":1788,"position":0},"title":"Nest Thermostat API using Node JS and Nest API Update","date":"October 9, 2012","format":false,"excerpt":"I\u2019ve been asked by a few people for more details on the API Nest Labs uses for their thermostats, especially regarding setting data (and not just polling). The API uses mostly JSON formatted data POSTed to their web servers. Authentication To authenticate, POST the username and password, encoded as form\u2026","rel":"","context":"In "Coding"","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1449,"url":"https:\/\/www.wiredprairie.us\/blog\/index.php\/archives\/1449","url_meta":{"origin":1788,"position":1},"title":".NET API for Nest Thermostat","date":"January 9, 2012","format":false,"excerpt":"I just finished a preliminary read-only (think version 0.1) wrapper around the Nest Thermostat API that is used by their mobile phone and web applications. As Nest doesn\u2019t have a formal API yet, the code could break at any time and may not be suitable for any use. However, it\u2026","rel":"","context":"In "Coding"","img":{"alt_text":"SNAGHTML88bff0b3","src":"https:\/\/i0.wp.com\/www.wiredprairie.us\/blog\/wp-content\/uploads\/2012\/01\/SNAGHTML88bff0b3_thumb.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":1784,"url":"https:\/\/www.wiredprairie.us\/blog\/index.php\/archives\/1784","url_meta":{"origin":1788,"position":2},"title":"Unofficial Nest API for Node JS as an NPM","date":"December 20, 2012","format":false,"excerpt":"Per the request of an anonymous user on Bitbucket, I have: Moved the code for the Nest API to GitHub. While I did have a preference for Bitbucket (free private hosting!!!), I moved it anyway. I also created an npm called the unofficial-nest-api. Enjoy.","rel":"","context":"In "Coding"","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1442,"url":"https:\/\/www.wiredprairie.us\/blog\/index.php\/archives\/1442","url_meta":{"origin":1788,"position":3},"title":"Nest Thermostat API\/Protocol","date":"January 8, 2012","format":false,"excerpt":"While Nest Labs hasn\u2019t released a formal (documented & supported) API, I thought I\u2019d do a bit of digging to see how they\u2019re using the network and what might be achievable. A few things are going on, the majority as you\u2019d probably expect. The web interface is using a long\u2026","rel":"","context":"In "Coding"","img":{"alt_text":"image","src":"https:\/\/i0.wp.com\/www.wiredprairie.us\/blog\/wp-content\/uploads\/2012\/01\/image_thumb7.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":1576,"url":"https:\/\/www.wiredprairie.us\/blog\/index.php\/archives\/1576","url_meta":{"origin":1788,"position":4},"title":"Nest Thermostat Review, Update #10: Wifi Settings Missing","date":"March 24, 2012","format":false,"excerpt":"One more brief update about our Nest thermostats. After a few weeks of limited use of our HVAC system due to a very unusually warm late winter and early spring, I\u2019d set the whole house to AWAY mode last evening. However, a bit later, I heard the furnace running. Odd.\u2026","rel":"","context":"In "Recommendations"","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1930,"url":"https:\/\/www.wiredprairie.us\/blog\/index.php\/archives\/1930","url_meta":{"origin":1788,"position":5},"title":"Sending a socket to a forked process in Node.JS","date":"August 27, 2013","format":false,"excerpt":"If you want to fork a process in Node and pass a socket, the current Node documentation has a rather odd example, so I\u2019ve simplified it here for my own sanity (further complicated by the fact that the WebStorm debugger can\u2019t debug a forked Node.JS process, which confused me for\u2026","rel":"","context":"In "Coding"","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.wiredprairie.us\/blog\/index.php\/wpjson\/wp\/v2\/posts\/1788"}],"collection":[{"href":"https:\/\/www.wiredprairie.us\/blog\/index.php\/wpjson\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wiredprairie.us\/blog\/index.php\/wpjson\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wiredprairie.us\/blog\/index.php\/wpjson\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wiredprairie.us\/blog\/index.php\/wpjson\/wp\/v2\/comments?post=1788"}],"version-history":[{"count":4,"href":"https:\/\/www.wiredprairie.us\/blog\/index.php\/wpjson\/wp\/v2\/posts\/1788\/revisions"}],"predecessor-version":[{"id":1791,"href":"https:\/\/www.wiredprairie.us\/blog\/index.php\/wpjson\/wp\/v2\/posts\/1788\/revisions\/1791"}],"wp:attachment":[{"href":"https:\/\/www.wiredprairie.us\/blog\/index.php\/wpjson\/wp\/v2\/media?parent=1788"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wiredprairie.us\/blog\/index.php\/wpjson\/wp\/v2\/categories?post=1788"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wiredprairie.us\/blog\/index.php\/wpjson\/wp\/v2\/tags?post=1788"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}