https://github.com/gonzolino/gotado
Go client for the tado° Web API
https://github.com/gonzolino/gotado
go golang tado tado-api
Last synced: 5 months ago
JSON representation
Go client for the tado° Web API
- Host: GitHub
- URL: https://github.com/gonzolino/gotado
- Owner: gonzolino
- License: apache-2.0
- Created: 2021-01-24T21:03:56.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2025-11-21T17:34:06.000Z (7 months ago)
- Last Synced: 2025-11-22T17:11:14.444Z (7 months ago)
- Topics: go, golang, tado, tado-api
- Language: Go
- Homepage: https://pkg.go.dev/github.com/gonzolino/gotado/v2
- Size: 454 KB
- Stars: 12
- Watchers: 1
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# gotado
[](https://github.com/gonzolino/gotado/actions/workflows/github-code-scanning/codeql) [](https://goreportcard.com/report/github.com/gonzolino/gotado) [](https://pkg.go.dev/github.com/gonzolino/gotado)
Go client for the tado° Web API. Still in early development, so only a subset of the API functionality is implemented.
## Installation
Install gotado with `go get`:
```sh
go get github.com/gonzolino/gotado
```
Then you can import `"github.com/gonzolino/gotado"` in your packages. Have a look at the [examples](examples) directory to see example code.
## Usage
### Authentication
Authentication to the tado° API is done using OAuth 2.0. The details are documented [here](https://support.tado.com/en/articles/8565472-how-do-i-authenticate-to-access-the-rest-api).
Gotado requires an `oauth2.Config` and a `oauth2.Token` to make authenticated requests. An authentication flow on the CLI could look like this:
```golang
ctx := context.Background()
config := gotado.AuthConfig(clientID)
deviceAuth, err := config.DeviceAuth(ctx)
// The user must visit the verification URI and authenticate with his personal credentials.
// Afterwards an access token will be generated.
fmt.Printf("To authenticate, visit %s\n", deviceAuth.VerificationURIComplete)
token, err := config.DeviceAccessToken(ctx, deviceAuth)
```
Be aware that an access token is only valid for 10 minutes. To keep authenticated for longer, you will need to request a refresh token during authentication. You can do this by adding the `offline_access` scope to the auth config:
```golang
config := gotado.AuthConfig(clientID, "offline_access")
```
Gotado will automatically refresh the access token when it expires, if a refresh token is available.
### Getting Started
Get started by creating a client object:
```golang
tado := gotado.New(ctx, config, token)
```
With the client you can start using the gotado functions:
```golang
me, err := tado.Me(ctx)
fmt.Printf("User Email: %s\n", me.Email)
home, err := me.GetHome(ctx, "My Home Name")
fmt.Printf("Home Address:\n%s\n%s %s\n", *home.Address.AddressLine1, *home.Address.ZipCode, *home.Address.City)
```
Just have a look at the package documentation to learn more about whats possible.
## Contributing
Please feel free to submit issues and/or pull requests if you discover bugs or missing features.