Skip to main content

Async Python client to interact with internal OverKiz API (e.g. used by Somfy TaHoma).

Project description

Python client for OverKiz API

A fully async and easy to use API client for the (internal) OverKiz API. You can use this client to interact with smart devices connected to the OverKiz platform, used by various vendors like Somfy TaHoma and Atlantic Cozytouch.

This package is mainly used by Home Assistant Core, to offer the Overkiz integration. If you want to use this package in your own project, you can use the following examples to get started, or look at the Home Assistant Code for more examples.

Supported hubs

  • Atlantic Cozytouch
  • Bouygues Flexom
  • Brandt Smart Control *
  • Hitachi Hi Kumo
  • Nexity Eugénie
  • Rexel Energeasy Connect *
  • Sauter Cozytouch
  • Simu (LiveIn2)
  • Somfy Connexoon IO
  • Somfy Connexoon RTS
  • Somfy TaHoma
  • Somfy TaHoma Switch
  • Thermor Cozytouch

[*] These servers utilize an authentication method that is currently not supported by this library. To use this library with these servers, you will need to obtain an access token (by sniffing the original app) and create a local user on the Overkiz API platform.

Installation

pip install pyoverkiz

Getting started

Cloud API

import asyncio
import time

from pyoverkiz.const import SUPPORTED_SERVERS
from pyoverkiz.client import OverkizClient
from pyoverkiz.enums import Server

USERNAME = ""
PASSWORD = ""

async def main() -> None:
    async with OverkizClient(USERNAME, PASSWORD, server=SUPPORTED_SERVERS[Server.SOMFY_EUROPE]) as client:
        try:
            await client.login()
        except Exception as exception:  # pylint: disable=broad-except
            print(exception)
            return

        devices = await client.get_devices()

        for device in devices:
            print(f"{device.label} ({device.id}) - {device.controllable_name}")
            print(f"{device.widget} - {device.ui_class}")

        while True:
            events = await client.fetch_events()
            print(events)

            time.sleep(2)

asyncio.run(main())

Local API

import asyncio
import time
import aiohttp

from pyoverkiz.client import OverkizClient
from pyoverkiz.const import SUPPORTED_SERVERS, OverkizServer
from pyoverkiz.enums import Server

USERNAME = ""
PASSWORD = ""
LOCAL_GATEWAY = "gateway-xxxx-xxxx-xxxx.local" # or use the IP address of your gateway
VERIFY_SSL = True # set verify_ssl to False if you don't use the .local hostname

async def main() -> None:
    token = "" # you can set the token here for testing purposes, to re-use an earlier generated token

    if not token:
        # Generate new token via Cloud API
        async with OverkizClient(
            username=USERNAME, password=PASSWORD, server=SUPPORTED_SERVERS[Server.SOMFY_EUROPE]
        ) as client:

            await client.login()
            gateways = await client.get_gateways()

            for gateway in gateways:
                token = await client.generate_local_token(gateway.id)
                await client.activate_local_token(gateway_id=gateway.id, token=token, label="Home Assistant/local-dev")
                print(f"Token for {gateway.label} ({gateway.id}):")
                print(token)  # save this token for future use

    # Local Connection
    session = aiohttp.ClientSession(
        connector=aiohttp.TCPConnector(verify_ssl=VERIFY_SSL))

    async with OverkizClient(
        username="", password="", token=token, session=session, verify_ssl=VERIFY_SSL, server=OverkizServer(
            name="Somfy TaHoma (local)",
            endpoint=f"https://{LOCAL_GATEWAY}:8443/enduser-mobile-web/1/enduserAPI/",
            manufacturer="Somfy",
            configuration_url=None,
        )
    ) as client:
        await client.login()

        print("Local API connection succesfull!")

        print(await client.get_api_version())

        setup = await client.get_setup()
        print(setup)

        devices = await client.get_devices()
        print(devices)

        for device in devices:
            print(f"{device.label} ({device.id}) - {device.controllable_name}")
            print(f"{device.widget} - {device.ui_class}")

        while True:
            events = await client.fetch_events()
            print(events)

            time.sleep(2)

asyncio.run(main())

Development

DevContainer (recommended)

If you use Visual Studio Code with Docker or GitHub CodeSpaces, you can leverage the available devcontainer. This will install all required dependencies and tools and has the right Python version available. Easy!

Manual

  • Install Python 3.12
  • Install poetry: curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
  • Clone this repository
  • cd python-overkiz-api
  • Init the project: poetry install
  • Run poetry run pre-commit install

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

pyoverkiz-1.14.2.tar.gz (40.6 kB view details)

Uploaded Source

Built Distribution

pyoverkiz-1.14.2-py3-none-any.whl (45.0 kB view details)

Uploaded Python 3

File details

Details for the file pyoverkiz-1.14.2.tar.gz.

File metadata

  • Download URL: pyoverkiz-1.14.2.tar.gz
  • Upload date:
  • Size: 40.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pyoverkiz-1.14.2.tar.gz
Algorithm Hash digest
SHA256 c1e1cf042b366c3562b9005be77170cf15fc10b86cc05d3cc38b8d6f2d2af358
MD5 d54dcd5f8fcdf8e5adf689d5955c798c
BLAKE2b-256 c9269785557b98a1379d62bac453bd6e2c52f73175e024609de519a243a2f2d9

See more details on using hashes here.

File details

Details for the file pyoverkiz-1.14.2-py3-none-any.whl.

File metadata

  • Download URL: pyoverkiz-1.14.2-py3-none-any.whl
  • Upload date:
  • Size: 45.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pyoverkiz-1.14.2-py3-none-any.whl
Algorithm Hash digest
SHA256 236e41f5733681fa70c444dbe4966ff9ef3b0cd6864e4e4d1be5dc5ec9a1e608
MD5 9fb338b8b11b84a01fff4159ec9336b2
BLAKE2b-256 9f7b7b0f25a3db4c7714c8de00eb79bf6ab75d712b02ec8b5bc4749537cc6071

See more details on using hashes here.

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