Skip to content

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

Notifications You must be signed in to change notification settings

kritsel/tado-api-demo-kotlin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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=<username> -Dtado.password=<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=<username> -Dtado.password=<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=<username> -Dtado.password=<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

About

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

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Languages