Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kritsel/tado-api-demo-kotlin

Kotlin application showcasing how to interact with the tado API v2, via a generated REST API client
https://github.com/kritsel/tado-api-demo-kotlin

kotlin oauth2 openapi-generator restclient spring-boot tado tado-api

Last synced: 4 days ago
JSON representation

Kotlin application showcasing how to interact with the tado API v2, via a generated REST API client

Awesome Lists containing this project

README

        

# Tado api demo - kotlin

tadoº is a german based company which offers a smart thermostat solution.
They also have an API to control this solution.

This Sprint Boot kotlin application showscases how you can use the tado API v2
which is available at https://my.tado.com/api/v2.

When you start the application, it runs a scheduled task which every minute
prints information like the current heating power, current temperature and
current humidity for every room (zone) in your home.

# Module set-up

## generated-tado-api-client
Generated kotlin client for the tado API.

It uses the `openapi-generator-maven-plugin` to generate the client code based on the
tado OpenAPI spec maintained here https://github.com/kritsel/tado-openapispec-v2/

## tado demo

Spring boot application which executes some tado API calls upon application
start-up.

It also implements the OAuth 2.0 authentication mechanism to authenticate
to the API.

# How to run this application

## Prerequisites
You need to have a tado account which is linked to a tado Home.

The username and password of this account need to be supplied as arguments
to the program, as they are needed to authenticate to the API.

## maven command-line - on Windows

On Windows the `spring-boot.run.jvmArguments` part needs to be surrounded by quotes

Replace the placeholders with your account details.

`mvn -pl tado-demo -am spring-boot:run -D"spring-boot.run.jvmArguments"="-Dtado.username= -Dtado.password="`

## maven command-line - non-Windows

Replace the placeholders with your account details.

`mvn -pl tado-demo -am spring-boot:run -Dspring-boot.run.jvmArguments="-Dtado.username= -Dtado.password="`

## IntelliJ

Navigate to tado-demo > src > main > kotlin > tadodemo > Application and run
the `main` method.

The first run will be unsuccessful as you will be missing some necessary
arguments. Edit the run configuration and add this part to the VM options
(replace the placeholders with your account details):

`-Dtado.username= -Dtado.password=`

## `useWindowsTrustStore` option

This application is developed on a company managed Windows machine,
where the company manages the certificates in the Windows keystore.

This set-up requires that some specific system properties need to be set to instruct
the program to use the Windows truststore instead of the Java one.

When you happen to be in a similar situation, you can add this extra JVM argument:

`-DuseWindowsTrustStore=true`