Nov 072018
 
Nest

Nest App

I like data. I’ve always been a bit of a data junky.  In my personal life, I’ve found looking at the data is usually interesting but not terribly useful.  But at work, I identify issues all of the time just by keeping different data up on my dashboards.    This write up however, is for my home, and my new Nest thermostat.  I was so excited to get this thing, I was curious about a dozen different aspects of these smart thermostats.  However, I was terribly disappointed when I got it installed and working and realized that the Nest only stores the last 10 days worth of data.  My assumption is they keep all the data (doesn’t everybody?) but for speed purposes they only let the customer access the last 10 days.  Whatever, its frustrating, but its not like their going to change it for little old me.

Imagine my surprise when I discovered they have an API that the customer can access. I had been bitching about the fact that Nest doesn’t give the customer access to this data, like on the website or something.. somewhere at least.  About 3 weeks later my buddy Buddah sends me this link that I guess showed up on his FaceBalls.

… I may have gotten a lil chub from this.

The guide will get you through the specific steps to making this whole thing happen.

Here’s my notes;Nest Data

  • I had issues getting google sheets to run the app.  I’d set it to run every 15 minutes, and sometimes it would happen sometimes it would not.  My guess is that either the jobs are queued or that sometimes the first couple take a bit longer.    I had a lot more luck when I’d set it to 15mins and then wait 30 for it to work.
  • The Nest API only allows 1 query every 5 minutes, its real easy to go over this when your coding.  If you go over, they’ll send a denied response which this script isn’t built to handle, so you just end up with no data.
  • Same with the openweathermap.org API.
  • Michael P. got the openweathermap.org to respond to a zip code.  I couldn’t get it to for some reason. I ended up going with city ID instead (its in their documentation).
  • The data from openweathermap.org isn’t super consistent.  My guess is its the opensource-ness of the project.  Inconsistent weather and humidity readings.

 Posted by at 6:04 pm

  2 Responses to “Nest history > 10 days”

  1. Thanks for your tutorial

    I have no experience with google sheets, i can not make the trigger to work
    After following your settings, nothing happens

    I modified the function to doget and trigger to “on open” and i get data

    Can you help me to make it work every x minutes?

    • That was one of the more difficult parts of this setup. I found with lots of trial and error that the script function in google sheets is very temperamental. I would get my script perfect and try to run it and sometimes it would work after 15-30 mins, and other times it wouldn’t. I never really did find what was causing the issue. It felt like it was caching the script, sometimes I would edit the script and get the same results as I did from the version before, other times it would update on the spot. Also, I think they run crons like this in batches and first come first serve. Even after I had it running for months, it would not always happen at 15 minutes. It would be like 16 or 20.

      The one suggestion I might be able to give you, is that every time I started a new sheet and created new scripts (same code), it seemed to work the first time (if you don’t count the delay). Once it was running, you don’t want to touch it. So when your pretty sure your script is perfect, start a new sheet, copy the code over and start it once, then if its supposed to run every 15 mins, wait at least 3 hrs to verify if its running.

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

(required)

(required)