GithubHelp home page GithubHelp logo

strix-technica / libtado Goto Github PK

View Code? Open in Web Editor NEW

This project forked from germainlefebvre4/libtado

0.0 1.0 0.0 537 KB

A Library to control your Tado Smart Thermostat

License: GNU General Public License v3.0

Python 100.00%

libtado's Introduction

Tado python library

Libtado Logo


License: GPL-3.0 GitHub Repo stars

build Docs

A library to control your Tado Smart Thermostat. This repository contains an actual library in libtado/api.py and a proof of concept command line client in libtado/__main__.py.

The tested version of APIs is Tado v2.

Installation

You can download official library with pip install libtado.

But because I do not own a Tado anymore you may want to use a fork of libtado instead. For example you can install the fork that is currently (February 2019) maintained and improved by @germainlefebvre4. Please note that I do not monitor or verify changes of this repository. Please check the source yourself.

git clone https://github.com/germainlefebvre4/libtado.git

Please check out https://libtado.readthedocs.io for more documentation.

Preparation

Retrieve the CLIENT_SECRET before running the script otherwise you will get a 401 Unauthorized Access.

The latest CLIENT_SECRET can be found at https://my.tado.com/webapp/env.js. It will look something like this:

var TD = {
    config: {
        version: 'v588',
        oauth: {
          clientSecret: 'wZaRN7rpjn3FoNyF5IFuxg9uMzYJcvOoQ8QWiIqS3hfk6gLhVlG57j5YNoZL2Rtc'
        }
    }
};

An alternative way to get your CLIENT_SECRET is to enable the Developper Mode when logging in and catch the Headers. You will find the form data like this :

client_id: tado-web-app
client_secret: fndskjnjzkefjNFRNkfKJRNFKRENkjnrek
grant_type: password
password: MyBeautifulPassword
scope: home.user
username: [email protected]

Then you just have to get the value in the attribute client_secret. You will need it to connect to your account through Tado APIs. The client_secret never dies so you can base your script on it.

Usage

Download the repository. You can work inside it. Beware that the examples assume that they can access the file ./libtado/api.py.

Now you can call it in your Pyhton script!

import libtado.api

t = api.Tado('[email protected]', 'myPassword', 'client_secret')

print(t.get_me())
print(t.get_home())
print(t.get_zones())
print(t.get_state(1))

Examples

An example script is provided in the repository as example.py. It shows you how to use the library and expose some structured responses. A more detailed example is available in libtado/__main__.py.

Supported version and deprecations

Python

Python version Supported versions
3.7 2.0.0 > 3.6.x
3.8 3.7.0 > latest

Development

Setup

sudo apt update
sudo apt install python3.7 python3.7-pip
sudo pip install pipenv
pipenv update --dev
# poetry install --with dev

Run application

Follow the indications in sectio Usage.

Run tests

pipenv update --dev
# poetry install --with dev

pipenv run pytest tests/
# poetry run pytest tests/

libtado's People

Contributors

ekeih avatar germainlefebvre4 avatar dependabot[bot] avatar strix-technica avatar rhuijben avatar edent avatar zianvw avatar finkr avatar mauermann avatar dependabot-preview[bot] avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.