mirror of
https://github.com/pawroman/zola-theme-terminimal.git
synced 2025-04-09 10:37:12 +02:00
nest logger publish test
This commit is contained in:
parent
ee68e1ce82
commit
a63c1d268d
|
@ -1,13 +1,16 @@
|
|||
+++
|
||||
title = "Nest Thermostat Logger"
|
||||
date = 2022-12-24
|
||||
draft = true
|
||||
draft = false
|
||||
|
||||
[taxonomies]
|
||||
tags = ["Nest", "Google", "API", "DeviceAccess", "OAuth2", "Temperature", "Humidity", "Weather"]
|
||||
+++
|
||||
|
||||
Since [Works with Nest (WWN)](https://developers.nest.com/) is retiring, I decided to get set up on [Device Access](https://developers.google.com/nest/device-access/get-started) to check out the Smart Device Management (SDM) API. The Quick Start Guide on the Device Access page is very comprehensive, and here's what I did to get everything up and running.
|
||||
Since [Works with Nest (WWN)](https://developers.nest.com/) is retiring, I decided to configure [Device Access](https://developers.google.com/nest/device-access/get-started) and check out the Smart Device Management (SDM) API. The Quick Start Guide on the Device Access page is very comprehensive, and here's what I did to get a log of temperature and humidity from my Nest and corresponding outdoor values.
|
||||
|
||||
{{ image(src="/img/NestandOutside.png", position="left") }}
|
||||
<!-- more -->
|
||||
|
||||
First I paid the seemingly unavoidable one-time, non-refundable $5 USD fee and accepted both the [Google API](https://developers.google.com/terms) and [Device Access Sandbox](https://developers.google.com/nest/device-access/tos) Terms of Service.
|
||||
|
||||
|
@ -17,15 +20,17 @@ My final step in setup was to create a project in Device Access, so I have the P
|
|||
|
||||
<!-- more -->
|
||||
|
||||
Authorizing an account through this link allows granting access to my nest:
|
||||
Authorizing an account through this link allows granting access to my Nest (replace ***project-id*** and ***oauth2-client-id*** with project values):
|
||||
|
||||
>[https://nestservices.google.com/partnerconnections/***project-id***/auth?redirect_uri=https://www.google.com&access_type=offline&prompt=consent&client_id=<font color="green">***oauth2-client-id***</font>&response_type=code&scope=https://www.googleapis.com/auth/sdm.service](https://nestservices.google.com/partnerconnections/project-id/auth?redirect_uri=https://www.google.com&access_type=offline&prompt=consent&client_id=oauth2-client-id&response_type=code&scope=https://www.googleapis.com/auth/sdm.service)
|
||||
>[https://nestservices.google.com/partnerconnections/***project-id***/auth?redirect_uri=https://www.google.com&access_type=offline&prompt=consent&client_id=***oauth2-client-id***&response_type=code&scope=https://www.googleapis.com/auth/sdm.service](https://nestservices.google.com/partnerconnections/project-id/auth?redirect_uri=https://www.google.com&access_type=offline&prompt=consent&client_id=oauth2-client-id&response_type=code&scope=https://www.googleapis.com/auth/sdm.service)
|
||||
|
||||
This redirects to [google.com](https://www.google.com) and returns the authorization code in the address bar:
|
||||
|
||||
>[https://www.google.com?code=**authorization-code**&scope=https://www.googleapis.com/auth/sdm.service](https://www.google.com?code=authorization-code&scope=https://www.googleapis.com/auth/sdm.service
|
||||
>[https://www.google.com?code=***authorization-code***&scope=https://www.googleapis.com/auth/sdm.service](https://www.google.com?code=authorization-code&scope=https://www.googleapis.com/auth/sdm.service
|
||||
)
|
||||
|
||||
This [curl](https://curl.se/) request returns the access and refresh tokens:
|
||||
This [curl](https://curl.se/) request returns the access and refresh tokens (replace ***oauth2-client-id***, ***oauth2-client-secret***, and ***authorization-code*** with project values):
|
||||
|
||||
> $ curl -L -X POST [https://www.googleapis.com/oauth2/v4/token?client_id=oauth2-client-id&client_secret=oauth2-client-secret&code=authorization-code&grant_type=authorization_code&redirect_uri=https://www.google.com](https://www.googleapis.com/oauth2/v4/token?client_id=oauth2-client-id&client_secret=oauth2-client-secret&code=authorization-code&grant_type=authorization_code&redirect_uri=https://www.google.c
|
||||
```bash
|
||||
$ curl -L -X POST https://www.googleapis.com/oauth2/v4/token?client_id=${oauth2-client-id}&client_secret=${oauth2-client-secret}&code=${authorization-code}&grant_type=authorization_code&redirect_uri=https://www.google.com
|
||||
```
|
BIN
static/img/NestandOutside.png
Normal file
BIN
static/img/NestandOutside.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 151 KiB |
Loading…
Reference in a new issue