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
- Hitachi Hi Kumo
- Nexity Eugénie
- Rexel Energeasy Connect
- Simu (LiveIn2)
- Somfy Connexoon IO
- Somfy Connexoon RTS
- Somfy TaHoma
- Somfy TaHoma Switch
- Thermor Cozytouch
Installation
pip install pyoverkiz
Getting started
Cloud API
import asyncio
import time
from pyoverkiz.const import SUPPORTED_SERVERS
from pyoverkiz.client import OverkizClient
USERNAME = ""
PASSWORD = ""
async def main() -> None:
async with OverkizClient(USERNAME, PASSWORD, server=SUPPORTED_SERVERS["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
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["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
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
-
For Linux, install pyenv using pyenv-installer
-
For MacOS, run
brew install pyenv
-
Don't forget to update your
.bashrc
file (or similar):export PATH="~/.pyenv/bin:$PATH" eval "$(pyenv init -)"
-
Install the required dependencies
-
Install poetry:
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
-
Clone this repository
-
cd python-overkiz-api
-
Install the required Python version:
pyenv install
-
Init the project:
poetry install
-
Run
poetry 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
Built Distribution
File details
Details for the file pyoverkiz-1.13.4.tar.gz
.
File metadata
- Download URL: pyoverkiz-1.13.4.tar.gz
- Upload date:
- Size: 39.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.12.1 Linux/6.2.0-1018-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 789b0d7823a3aa3bc731225b19f95141ad88d3225d991d2971452eb41b4373aa |
|
MD5 | 72526f488839cc974e72caf1ae4330d5 |
|
BLAKE2b-256 | 6bd6f8184e57e6cadb85cea1c1ea5cbc3be2fd83183c566dac2c048a0d9712f0 |
File details
Details for the file pyoverkiz-1.13.4-py3-none-any.whl
.
File metadata
- Download URL: pyoverkiz-1.13.4-py3-none-any.whl
- Upload date:
- Size: 43.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.12.1 Linux/6.2.0-1018-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fb420b343e29df4a13f5ad0a75c042f81aec8eecc41af6402323864b3d8673ea |
|
MD5 | 4e9230a3de911057576aba23c408efc9 |
|
BLAKE2b-256 | 8fe8dcc13ad5150639666e72abd3b2b111cdab8699ffbf9459d5fa7ce7180eb2 |