zola-theme-terminimal/content/wifi-temperature-monitor-part2.md
“kylejcarlton” a2e407fe47 update taxonomies
2023-04-06 10:57:31 -05:00

2.7 KiB
Raw Blame History

+++ title = "WiFi Temperature Monitor - Part II" date = 2016-10-05

[taxonomies] tags = ["Particle", "Temperature"] +++

Since writing the first WiFi temperature monitor post, Ive implemented retrieving temperature values on a schedule, to generate a real-time dashboard. I came across this Gadgets Apps Hacks Post, which utilizes Google Apps Scripts ability to connect to External APIs and record stock ticker values over time in Google Sheets. The method I used in the first part to write the temperature sensor value in a Sheet is more suited for a single import of a larger data set in JSON format. There is also a tutorial from Particle that uses IFTTT to log the data in a Sheet. Although the tutorial from Particle might be a little easier to implement, I chose to work solely with Google Apps Script; since I wanted to pull data from other APIs. Ill use WeatherUnderground for the outside temperature and Nest for a comparison of inside temperature from another device.

{{ image(src="/img/Google_Apps_Script_Temp.png", position="left") }}

For communication with my Nest Thermostat, I didnt implement the OAuth2.0 standard completely inside the Apps Script; although this would be possible using apps-script-oauth2. Following the REST Quick Guide, I generated a PIN for my Nest and then used Postman to initiate the POST call for the Access Token to be used in the script.

Here are the results after a few days:

The Google Sheet is here (create a copy to view Script Editor and make changes) and I also posted the code as a Gist here. API keys, device IDs etc. are all variables to be defined at the beginning of the Script.