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
Hashes for pytrutankless-0.4.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e11e4cc0fcffbcfae115a68a479c182d74b3b2b90538e3d047fc39fa5f22eb3 |
|
MD5 | e38f9c5eb2b3ae714e8e110bb0107f77 |
|
BLAKE2b-256 | f9854309d5f190f4e3555ec7cb8eaf104c0b475dac7ad9fe6ed1d9ad55d05f17 |