Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytrutankless-0.4.3.tar.gz (10.0 kB view hashes)

Uploaded Source

Built Distribution

pytrutankless-0.4.3-py3-none-any.whl (7.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page