Skip to main content

aioecobee

Python3 async library for interacting with the ecobee API

Requirements: aiofiles, aiohttp, asyncio

Install aioecobee with python3 -m pip install aioecobee.

Usage

aioecobee's main class is EcobeeAPI; create an API object like this:

from aiohttp import ClientSession
from aioecobee import EcobeeAPI

session = ClientSession()
api_key = xxxxxxxxxxxxxxxxxxxxx
config_file = "/path/to/ecobee.conf"

ecobee = EcobeeAPI(session, api_key=api_key, config_file=config_file)

Where:

  • session is an instance of aiohttp.ClientSession();
  • api_key is the API key obtained from ecobee.com (optional); and,
  • config_file is the name of a config file for use with aioecobee (optional).

If config_file is not specified, api_key is required.

Obtain a PIN for authorizing on ecobee.com:

await ecobee.request_pin()

After authorizing your app on ecobee.com, request tokens:

await ecobee.request_tokens()

After obtaining tokens, populate (or update) ecobee.thermostats and ecobee.sensors:

await ecobee.update()

Calls to the API will raise an ExpiredTokensError if tokens are expired and need refreshing:

from aioecobee import ExpiredTokensError
try:
    await ecobee.update()
except ExpiredTokensError:
    await ecobee.refresh_tokens()

example.py

An example script is provided to demonstrate the usage of aioecobee.

python example.py api_key

Caveats

aioecobee does not implement timeouts; use asyncio_timeout in your client code to wrap calls to the API as needed.

Contributing

Please open issues or pull requests.

Release files for aioecobee 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aioecobee 0.1.0
File Size Uploaded
aioecobee-0.1.0.tar.gz 5.6 kB Details

Release files / aioecobee-0.1.0.tar.gz

Download URL aioecobee-0.1.0.tar.gz
Size 5.6 kB
Tags Source
SHA-256 checksum
How to use checksums
435cf78040f1c5f8229ec93e869f379dc830d876c389a9ca0cf4db6719237a9a
BLAKE2b-256 checksum
How to use checksums
f8757f21abfce7fb5b33acd2434d56aeb6993f4a7295f8eecb7312f72800286e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.4

Release history Release notifications | RSS feed

This release

0.1.0 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page