Harvesting Nest Thermostat Data For Fun And Profit

This is an old post!

This post is over 2 years old. Solutions referenced in this article may no longer be valid. Please consider this when utilizing any information referenced here.

Okay, no profit in this, but it certainly is fun!

I have two Nest thermostats in my house and, after some teething pains (yay the life of an early adopter) they have been pretty solid. But they’re also black boxes that I know little about. I know they’re collecting mountains of data and sending it back to the Google mothership. Wouldn’t it be nice to get at some of that data and build my own reports?

The more practical reason, however, is that I have a house that is heated and cooled by electric heat pumps, with heat strips as an auxiliary backup. Those things pull 50 amps when they are in use. I might as well light dollar bills on fire. So anything that I can do to reduce my use of aux heating I try to do.

Unfortunately, Nest’s reports are delayed by a day so I can’t make realtime adjustments to my usage. Furthermore, Nest’s reports don’t give me any data more granular than * (heat|cool) was used (in 15 minute increments) today” and look at a timeline and kinda see where it was used, but that’s it.

This may be fine for a normal person. But I’m an engineer, not a normal person. :) I want data!

So when I came across this unofficial API, I instantly thought of how neat it would be to use it to grab that data and do something with it. Rather than write my own analytics on top of it, I decided instead to just stuff the data into a time-series database (InfluxDB), off which I could use any platform I wanted to build reports or alerting.

So I created Nest Watch, which does exactly that.

In addition to reporting the outside weather conditions, which Nest obtains from the Weather Underground, it also pulls the following datapoints:

  • auto_cool
  • auto_heat
  • temperature
  • humidity
  • ac
  • heat
  • alt_heat
  • fan
  • auto_away
  • manual_away
  • structure_away
  • leaf
  • battery_level
  • active_stages.heat.stage1
  • active_stages.heat.stage2
  • active_stages.heat.stage3
  • active_stages.heat.alt
  • active_stages.heat.alt_stage2
  • active_stages.heat.aux
  • active_stages.heat.emergency
  • active_stages.cool.stage1
  • active_stages.cool.stage2
  • active_stages.cool.stage3
  • network.online

With this data going into InfluxDB, you can build Grafana dashboards using this data. Here’s a sample dashboard I build using some of my data:

You could also use a tool like Kapacitor or even Nagios to perform alerts based on the data.

Last year I had an issue with my upstairs heat pump that caused it to safety shut off. When this happens it shuts off power to the thermostats. We didn’t find out about the safety shut off for about 2 days until the battery finally wore down and the Nest shut off. Meanwhile, it was 95 degrees upstairs. I didn’t find out about any of this until my wife called me while I was traveling in California and told me it was 95 in my daughter’s room and the thermostat was broken.

Wouldn’t it have been nice to have some alerting about that, so I would have known sooner that there was an issue?

This is a wholly unofficial project. It might stop working at any time. Do not rely on this for life-critical stuff. I am not responsible for what you do with it.

And if anyone at Nest is reading this, it would be really cool if you had an open API for your users to build their own solutions. I know about the “official API”, but it is clearly business oriented and certainly not maker-friendly given all the hoops you have to jump through just to get access to it. I just want to draw neat graphs and know when something is broken, not change the world. Please let us have access to our data.

Did something I wrote help you out?

That's great! I don't earn any money from this site - I run no ads, sell no products and participate in no affiliate programs. I do this solely because it's fun; I enjoy writing and sharing what I learn.

All the same, if you found this article helpful and want to show your appreciation, here's my Amazon.com wishlist.

Read More

More collectd and pfSense Fun!

Extending my post from last year, here’s some additional data I’m grabbing from pfSense and stuffing into collectd via a script. I’m now grabbing: DHCP Leases CPU Temperature Thermal Zone Temperature SSD Drive Temperature UPS information (via NUT) Here’s the exec script:

Collecting Data From pfSense Using collectd

So I’ve recently been on a graphing thing, wanting to collect all kind of data from my home network. And collectd seems to be a good candidate for doing that. With a huge number of plugins, it can collect and send just about anything you can think of to a time series database (I’m using InfluxDB for this). But, there’s a significant hole in my data collection: my pfSense firewall. Well, not anymore!