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 asynchronous and user-friendly API client for the OverKiz platform. This client enables interaction with smart devices connected to OverKiz, supporting multiple vendors such as Somfy TaHoma and Atlantic Cozytouch.

This package is primarily used by Home Assistant Core to provide the Overkiz integration. If you wish to use this package in your own project, refer to the examples below or explore the Home Assistant source code for additional usage 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())

Contribute

We welcome contributions! To get started with setting up this project for development, follow the steps below.

Dev Container (recommended)

If you use Visual Studio Code with Docker or GitHub Codespaces, you can take advantage of the included Dev Container. This environment comes pre-configured with all necessary dependencies and tools, including the correct Python version, making setup simple and straightforward.

Manual

  • Ensure Python 3.12 is installed on your system.
  • Install uv.
  • Clone this repository and navigate to it: cd python-overkiz-api
  • Initialize the project with uv sync, then run uv run pre-commit install

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

pyoverkiz-1.18.0.tar.gz (41.6 kB view details)

Uploaded Source

Built Distribution

pyoverkiz-1.18.0-py3-none-any.whl (47.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyoverkiz-1.18.0.tar.gz
  • Upload date:
  • Size: 41.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.7.13

File hashes

Hashes for pyoverkiz-1.18.0.tar.gz
Algorithm Hash digest
SHA256 0b729aaaa0faad64484dd9d5e94f9b016e672a604b3ea2220875a79a1a780cf5
MD5 0ebe54093b146b75c990079909d62346
BLAKE2b-256 62ba0ba18274a983a8835e895284e146dae0203cd4302b4d87802d69206d2edf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyoverkiz-1.18.0-py3-none-any.whl
  • Upload date:
  • Size: 47.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.7.13

File hashes

Hashes for pyoverkiz-1.18.0-py3-none-any.whl
Algorithm Hash digest
SHA256 451cc449c0193633c31ea74be8ece8dc1e59f0ab54d695ae03c069e0c491741a
MD5 f29872d3fd0cfb72269fa841a8b19ce2
BLAKE2b-256 071afaebab86c3ca7e34a8faa8110c7beee3bb04b05786779a0e839be688c238

See more details on using hashes here.

Supported by

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