A Python client library for the TruTankless API
Project description
pytrutankless
Python interface for TRUTANKLESS branded water heaters
Installation
pip install pytrutankless
Usage
In order to obtain an auth token, a TruTanklessApi object must be instantiated and api.authenticate
called.
from pytrutankles.api import TruTanklessApiInterface(user, passwd, token[Optional])
email = "your@email.here"
password = "yoursecrethere"
api = await TruTanklessApiInterface(user=email, passwd=password)
auth = api.authenticate()
A Token object with the following parameters is returned;
{
"access_token": "str",
"token_type": "str",
"expires_in": "int",
"expires_at": "datetime",
"refresh_token": "str",
"user_id": "str"
}
If a Token
object is provided, it will be used for authentification unless expired. If the given Token
is expired, a new one is retrieved from the API.
Methods
authenticate()
api.authenticate()
retun Token
Logs into service and retrieves access_token
.
get_devices()
api.get_devices()
Updates dictionaries of locations and devices.
Returns a dict of location(s) that are stored in api._locations
and a dict of device(s) stored in api.devices
.
refresh_device(device_id)
api.refresh_device(device_id)
Given device_id
, updates usage data for that device.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pytrutankless-0.4.3.tar.gz
.
File metadata
- Download URL: pytrutankless-0.4.3.tar.gz
- Upload date:
- Size: 10.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.14
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6d3adc9968d97bbadc6795bf40f71225c182ffa5d7b9e4f57298e86ea8e8c294 |
|
MD5 | 3e408fe66f4992c2a9cfc59e82dc87f3 |
|
BLAKE2b-256 | 5c07933d5d0e05243ae53aefdf94f90eee4c273f1cabee90d36fb75a58737f88 |
File details
Details for the file pytrutankless-0.4.3-py3-none-any.whl
.
File metadata
- Download URL: pytrutankless-0.4.3-py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.14
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e11e4cc0fcffbcfae115a68a479c182d74b3b2b90538e3d047fc39fa5f22eb3 |
|
MD5 | e38f9c5eb2b3ae714e8e110bb0107f77 |
|
BLAKE2b-256 | f9854309d5f190f4e3555ec7cb8eaf104c0b475dac7ad9fe6ed1d9ad55d05f17 |