article updates

This commit is contained in:
kylejcarlton 2021-12-04 19:49:17 -06:00
parent 0b8a9ed118
commit 1c1b0994a8
2 changed files with 12 additions and 0 deletions

View file

@ -6,4 +6,16 @@ date = 2016-10-05
tags = ["Particle", "WiFiTemp"]
+++
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](http://www.gadgetsappshacks.com/2014/01/how-to-record-daily-portfolio-values-in.html), which utilizes [Google Apps Scripts](https://developers.google.com/apps-script/) ability to connect to [External APIs](https://developers.google.com/apps-script/guides/services/external) and record stock ticker values over time in [Google Sheets](https://www.google.com/sheets/about/). 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](https://docs.particle.io/tutorials/projects/maker-kit/#tutorial-4-temperature-logger) that uses [IFTTT](https://ifttt.com/) 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](https://www.wunderground.com/weather/api/d/docs) for the outside temperature and [Nest](https://developers.nest.com/documentation/cloud/get-started) for a comparison of inside temperature from another device.
{{ image(src="https://raw.githubusercontent.com/kylejcarlton/zola-theme-terminimal/master/img/Google_Apps_Script_Temp.png", position="left") }}
For communication with my Nest Thermostat, I didnt implement the [OAuth2.0](https://oauth.net/2/) standard completely inside the Apps Script; although this would be possible using [apps-script-oauth2](https://github.com/googlesamples/apps-script-oauth2). Following the [REST Quick Guide](https://developers.nest.com/documentation/cloud/how-to-auth), I generated a [PIN for my Nest](https://developers.nest.com/documentation/cloud/authorization-overview#pin-based-authorization) and then used [Postman](https://www.getpostman.com/) to initiate the POST call for the Access Token to be used in the script.
Here are the results after a few days:
```bash
### iFRAME CHART HERE ###
```
The [Google Sheet](https://docs.google.com/spreadsheets/d/1ir8ENcChkleHsPGUWlmbGlXQQTnxPHI-o29nMX9jvO8/edit) is here (create a copy to view Script Editor and make changes) and I also posted the code as a [Gist here](https://gist.github.com/kylejcarlton/12a85c4a5b375eaff62ee509d76a6720). API keys, device IDs etc. are all variables to be defined at the beginning of the Script.

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB