Nest thermostat tracks temperature, humidity and furnace/AC usage and users are able to see historical data only for 10 days. I wanted to collect historical data (>10 days) and came across google spreadheets script that pings nest every set time and also gets local weather data from openweathermap.org and saves in the spreadsheet.
Everything was going well for a year, and the script suddenly stopped collecting data. After some google searching, I realized that one row every 5 minute for google spreadhseet means hitting the max limit of cells a google spreadsheet can accomodate. I updated the original script to still ping Nest every 5 mins, and but collect data in 1 row per day. Script checks the last row and if it is the same day, then it appends the data to the same row rather than adding a new row.
Credit for the original script. I just made a few edits to suit my needs.
// michael-pesce's work: https://gist.github.com/michael-pesce/a4ba55d4fc4...
// --> BEEZLY's work: https://gist.github.com/beezly/9b2de3749d687fdbff...
Keywords: Nest Thermostat History, Nest Heat, Nest Temperature History, Nest Thermostat Hack, Nest Thermostat Tips, Nest Energy History, Nest Daily Use, Nest Daily Usage, Download nest thermostat data
Start with my shared google sheet linked below (Open that file and click File and then "make a copy" and save in your google drive).
P.S: Do not ask me to give you the permission to edit this file. Before you make any changes, which you will not be able to make because I shared this as a read only spreadsheet, do a "make a copy" in your own google drive and then proceed with making edits.
https://docs.google.com/spreadsheets/d/1zTHUfiltWomhPYmfD3TYRRoJZsgcjrQ_A2xHSTK5_dE/edit?usp=sharing
To folks who are having issues with authorization: Try the script in the following file. It has additional functionality related to Nest's new 2.0 authorization protocols. I have not tried it, so if you come across any questions or issues, please post in the comments section.Credit to mcr2582.
https://www.dropbox.com/s/8rbtg7pb0xl9n9x/nest%20t...
Another variation of the script by Coder56: Additional details in the comments section. I have not tried it, but script is organized very well and it appears to be working well for many users.
Skip this step if you did save a copy on my shared google sheet.
Copy/take note of the link to your new web app for now, and it will be added to the runDataCollection routine below (the first code) in later steps.
Let's modify the script to your specific thermostat, city and google sheet.
Each change is listed with a line number of the script. You will have to go to that line in the script and update as instructed below. (Line numbers should be correct if line 40 is "runDataCollection()...").
You can get the id for each thermostat by going to the Nest dashboard, clicking on the Thermostat, clicking the gear icon on the top right then copying the "Serial no."" field. It will look something like: 02XX01XX471XXX3S
To find city ID go to "http://openweathermap.org/find?q=" search for your city, click on the city link and the ID will be the 7 digit number in the URL
The Sheet id can be grabbed from the shee URL See this pattern for where the Sheet id is in the URL:https://docs.google.com/spreadsheets/d/THIS_IS_WHERE_THE_SHEET_ID_IS/edit#gid=123456789
Skip this step if you started with my shared spreadsheet.
These two lines need to be in the spreadsheet for the code to work.
First line (Header row): Space separates columns
Date/Time Month Day Year Temp Humidity OutsideTemp OutsideHumidity Heat_Usage AC_Usage Weather AutoAway
Second Line:
Add yesterday's date in the first column and zeros in the remaining columns.
That is it. Let the script run and it should add one row per day and pinging your thermostat and local weather for data per the trigger frequency you set.
If you redeploy the webapp, use the new revision. I had problems using the same revisions with script not running.
If script is not running, go over the previous steps again and make sure you have updated the script as suggested by these steps accurately. This is the most likely cause of the issue with script not running.
Known Issues (If someone knows the fix, please reply in the comments section):
1) Script fails to obtain data from nest throughout the day. I have my trigger every 5 minutes, which should results in total 288 reads throughout a day. I get ~170. Lowest I had gotten is 16 and highest is 264.