Thursday, 19 June 2014

While Nest are still to release details of their API, some clever people have already deconstructed the methods by which your Nest Thermostat (and Nest Protect) talks back to Nest Cloud HQ and have released a PHP script which can pull data from Nest Cloud HQ, allowing you to do with it, whatever you want!

1. Visit the link above and download the nest.class.php file
2. Publish the above on a web server that supports PHP, and has Internet access
3. Create another PHP file that "includes" the above class and gathers and presents the data you want. There are examples on GitHub, and I've included my own hacked together example here:

4. Now using something like PRTG (free for a licence of 10 sensors) and the HTTP XML Sensor type, you can GET your PHP script every few minutes (I wouldn't recommend more than once every 5 minutes), and have PRTG automatically interpret the XML into sensor values. All you need to do is tell PRTG the full web address of your php file and also which XML tags you want to capture. The sensors it produces will look like the ones shown below:

5. Lastly, once you have the data captured, graphed etc, you can set-up a notification within PRTG to send an email when a certain value is seen on a sensor. In our case, to email us when the Auto Away sensor = 1

I've found that setting a single threshold trigger when the value = 1 and then another notification when the condition clears seems to work best - rather than 2 separate threshold triggers for 1 and 0.

There are numerous other things you could do with this depending on what you want to monitor and the Nest API allows you to SET certain parameters as well as GET them.