Nest Client in Go
A simple Go client for the Nest API.
- It's possible to show informations in the console or in a embedded web server.
- It's also possible to export datas to Time Series Database InfluxData.
1] Getting Started
Prerequisites
Installation
Configuration
- Don't forget !!!! : You have to change the API Key in the config.yaml.
- Or use flag "-token xxxxxx"
Traduction
- This application supports en-us and fr
- Cette application supporte l'anglais et le français
Binary donwload with config.yaml
Platform |
Architecture |
URL |
Apple macOS |
64-bit Intel |
./goNest-darwin-amd64.bin |
Linux |
64-bit Intel |
./goNest-linux-amd64.bin |
Windows |
64-bit Intel |
goNest-windows-amd64.exe |
Usage with config.yaml or with flag
Execute the binary with the config file "config.yaml" in the same folder.
- Ex : goNest-windows-amd64.exe -token xxxxxxx
There are some others flags : --help for doc
Usage of ./nest-client-go:
-debug string
panic,fatal,error,warning,info,debug
-devel string
true,false
-mock string
true,false
-token string
yourtoken
Test using Nest Browser
Nest Clientcomes with an embedded web based object browser. Point your web browser by default to http://localhost:1111/
ensure your server has started successfully.
Example : result in the standard console
---------------------
Nest 2017-07-20 17:06:21
---------------------
Ambien TemperatureC : 27.5
Example : result in a influxData
Docker Container
docker pull patrickalin/docker-nest
docker run -d --name=nest -e nestAccessToken=ToBECompleted patrickalin/docker-nest
https://hub.docker.com/r/patrickalin/docker-nest/
2] Modification code / Compilation
Pre installation
- install git
- install go from
http://golang.org/
- If you want install influxData
Installation env development
git clone https://github.com/patrickalin/GonestThermostatAPIRest.git
cd GonestThermostatAPIRest
export GOPATH=$PWD
go get -v .
go build
Mock
In the config file, you can activate a mock. If you don't have a API key.
Dev
In the config file, you can change the dev mode to use template, lang locally.
When the dev = false you use assembly files.
Execute "go generate" to refresh assembly files.
Debug
In the config file, you can change the log level (panic,fatal,error,warn,info,debug)
3] Thanks
https://github.com/tixu for testing and review
http://mervine.net/json2struct "transform JSON to Go struct library"
http://github.com/spf13/viper "read config library"
4] License
The code is licensed under the permissive Apache v2.0 licence. This means you can do what you like with the software, as long as you include the required notices. Read this for a summary.