Skip to main content

A aiohttp-based client for Genius Hub systems

Project description



This is a Python library to provide access to a Genius Hub by abstracting its RESTful API. It uses aiohttp and is therefore async-friendly.

This library can use either the offical v1 API with a hub token, or the latest v3 API (using your own username and password). In either case, the library will return v1-compatible results wherever possible (this is not a trivial task).

If you use the v3 API, you can interrogate the hub directly, rather than via Heat Genius' own servers. Note that the v3 API is undocumented, and so this functionality may break at any time. In fact, the v3 to v1 conversion if best efforts and may even be broken as is for some edge cases - it was tested with HW, on/off (i.e. smart plugs), and radiators only.

It is a WIP, and is missing some functionality (e.g. schedules). In addition, there are some other limitations (see below).

It is based upon work by @GeoffAtHome - thanks!

Current limitations

Current limitations & to-dos include:

  • is not complete
  • schedules are read-only
  • when using the v3 API, zones sometimes have the wrong value for occupied

The library will return v1 API responses wherever possible, however:

  1. the only code available to reverse-engineer is from the web app, but
  2. the Web app does not correlate completely with the v1 API (e.g. issue messages, occupied state)

Thus, always check your output against the corresponding v1 API response rather than the web app.


Either clone this repository and run python install, or install from pip using pip install geniushub-client.

Using the Library

See for example code. You can also use for ad-hoc queries:

python -?

There are two distinct options for accessing a Genius Hub:

Option 1: hub token only:

  • requires a hub token obtained from
  • uses the v1 API - which is well-documented
  • interrogates Heat Genius' own servers (so is slower)

Option 2: hub hostname/address with user credentials:

  • requires your username & password, as used with
  • uses the v3 API - results are WIP and may not be what you expect
  • interrogates the hub directly (so is faster), via port :1223

python ${HUB_TOKEN} issues

python ${HUB_ADDRESS} -u ${USERNAME} -p ${PASSWORD} zones -v

You can compare any output to the 'official' API (v1 response):

curl -H "authorization: Bearer ${HUB_TOKEN}" -X GET
python ${HUB_TOKEN} zones

curl -H "authorization: Bearer ${HUB_TOKEN}" -X GET
python ${HUB_ADDRESS} -u ${USERNAME} -p ${PASSWORD} devices -v

curl -H "authorization: Bearer ${HUB_TOKEN}" -X GET
python ${HUB_ADDRESS} -u ${USERNAME} -p ${PASSWORD} issues

You can obtain the 'raw' v3 API responses (i.e. the JSON is not converted to the v1 schema):

python ${HUB_ADDRESS} -u ${USERNAME} -p ${PASSWORD} zones -vvv
python ${HUB_ADDRESS} -u ${USERNAME} -p ${PASSWORD} devices -vvv

To obtain the 'official' v3 API responses takes a little work. First, use python to obtain a HASH:

>>> from hashlib import sha256
>>> hash = sha256()
>>> hash.update(("my_username" + "my_password").encode('utf-8'))
>>> print(hash.hexdigest())

Then you can use curl:

curl --user ${USERNAME}:${HASH} -X GET http://${HUB_ADDRESS}:1223/v3/zones

Advanced Features

When used as a library, there is the option to utilize the referencing module's own aiohttp.ClientSession() (recommended).

Here is an example, but see for a more complete example:

import asyncio
import aiohttp
from geniushubclient import GeniusHub

my_session = aiohttp.ClientSession()


if not (username or password):
   hub = GeniusHub(hub_id=hub_address, username, password, session=my_session)
   hub = GeniusHub(hub_id=hub_token, session=my_session)

await hub.update()  # enumerate all zones, devices and issues

client.verbosity = 0  # same as v1/zones/summary, v1/devices/summary

client.verbosity = 1  # default, same as v1/zones, v1/devices, v1/issues


await session.close()

QA/CI via CircleCI

QA includes comparing JSON from cURL with output from this app using diff, for example:

(venv) root@hostname:~/$ curl -X GET -H "authorization: Bearer ${HUB_TOKEN}" | \
    python -c "import sys, json; print(json.dumps(json.load(sys.stdin, parse_float=lambda x: int(float(x))), indent=4, sort_keys=True))" > a.out

(venv) root@hostname:~/$ python ${HUB_ADDRESS} -u ${USERNAME} -p ${PASSWORD} zones -v | \
    python -c "import sys, json; print(json.dumps(json.load(sys.stdin, parse_float=lambda x: int(float(x))), indent=4, sort_keys=True))" > b.out

(venv) root@hostname:~/$ diff a.out b.out

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

geniushub-client-0.6.22.tar.gz (15.0 kB view hashes)

Uploaded Source

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