Simple API to access BTicino/Legrand Classe 100X/300X devices
Project description
pybticino
Async Python library for the BTicino/Netatmo API. Controls BTicino Classe 100X/300X video intercom systems via the Netatmo cloud.
Used by the bticino_intercom Home Assistant integration.
Installation
pip install pybticino
Requires Python 3.13 or later.
Features
- Authentication: OAuth2 password grant with automatic token refresh and persistence support
- Home topology: fetch homes, modules, and their configuration
- Device control: lock/unlock doors, turn lights on/off
- Events: fetch call history with snapshots and vignettes
- WebSocket: real-time push notifications (call events, connection status, state changes)
- Re-subscribe: refresh OAuth token on existing connection without reconnecting
- WebRTC signaling: offer/answer/ICE exchange for live video calls (experimental)
Quick start
import asyncio
from pybticino import AuthHandler, AsyncAccount
async def main():
auth = AuthHandler("your_email@example.com", "your_password")
account = AsyncAccount(auth)
await account.async_update_topology()
for home_id, home in account.homes.items():
print(f"Home: {home.name} ({len(home.modules)} modules)")
status = await account.async_get_home_status(home_id)
events = await account.async_get_events(home_id, size=5)
await auth.close_session()
asyncio.run(main())
WebSocket (real-time events)
import asyncio
from pybticino import AuthHandler, WebsocketClient
async def on_message(message):
print(f"Event: {message.get('push_type')} - {message}")
async def main():
auth = AuthHandler("your_email@example.com", "your_password")
ws = WebsocketClient(auth, on_message)
await ws.connect()
# Listen for events (doorbell rings, connection changes, etc.)
task = ws.get_listener_task()
if task:
await task
await ws.disconnect()
await auth.close_session()
asyncio.run(main())
Re-subscribe (keep connection alive)
# Refresh token on existing connection without disconnecting
await ws.resubscribe()
API endpoints
| Method | Endpoint | Description |
|---|---|---|
async_update_topology() |
/api/homesdata |
Fetch homes and modules |
async_get_home_status(home_id) |
/syncapi/v1/homestatus |
Get module status |
async_set_module_state(home_id, module_id, state) |
/syncapi/v1/setstate |
Control devices |
async_get_events(home_id, size) |
/api/getevents |
Get event history |
WebSocket event types
Events are delivered with push_type in format {DEVICE_TYPE}-{EVENT_TYPE}:
| push_type | Description |
|---|---|
BNC1-rtc |
Incoming WebRTC call (with SDP offer) |
BNC1-incoming_call |
Doorbell ring (with snapshot URL) |
BNC1-missed_call |
Unanswered call |
BNC1-accepted_call |
Call answered |
BNC1-connection |
Bridge connected |
BNC1-disconnection |
Bridge disconnected |
Documentation
Full documentation at k-the-hidden-hero.github.io/pybticino
Key guides from reverse engineering:
- WebRTC Signaling Protocol — complete offer/answer/ICE flow, message formats, session state, two call modes
- WebRTC Audio Mechanism — how to activate the device microphone (requires real RTP audio packets)
- WebSocket Events — all push notification types and their JSON structures
- Reverse Engineering Notes — findings from decompiling the official BTicino/Netatmo app
Examples
Working example scripts in examples/:
| Script | Description |
|---|---|
webrtc_offer_mode.py |
On-demand video: send offer → receive answer → ICE → connected |
webrtc_answer_mode.py |
Answer incoming call: wait for doorbell → answer via signaling |
webrtc_audio_test.html |
Browser-based audio test with silence oscillator |
websocket_test.py |
Real-time push notification listener |
Related projects
- bticino_intercom — Home Assistant custom integration
- bticino_ha_extras — Blueprints, Lovelace cards, and companion resources
Contributing
pip install -e ".[test,dev]"
pytest tests/ -v
ruff check src/ tests/
License
MIT
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pybticino-1.8.0.tar.gz.
File metadata
- Download URL: pybticino-1.8.0.tar.gz
- Upload date:
- Size: 79.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd6abe17811c5d97de94c6a8d73b16b39028fa37a2e0ea968bcd46ab84c985f3
|
|
| MD5 |
f61062d67d2ad9ad3a3430aa351b0b0a
|
|
| BLAKE2b-256 |
c3032e40aa5e69b6f07f99d2c5a55553e9b0d950b0f06c0231ea892826302513
|
Provenance
The following attestation bundles were made for pybticino-1.8.0.tar.gz:
Publisher:
release.yml on k-the-hidden-hero/pybticino
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pybticino-1.8.0.tar.gz -
Subject digest:
cd6abe17811c5d97de94c6a8d73b16b39028fa37a2e0ea968bcd46ab84c985f3 - Sigstore transparency entry: 1369914884
- Sigstore integration time:
-
Permalink:
k-the-hidden-hero/pybticino@5172ca6ebc7ab4f7a18de0fed660800de95245dc -
Branch / Tag:
refs/tags/v1.8.0 - Owner: https://github.com/k-the-hidden-hero
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5172ca6ebc7ab4f7a18de0fed660800de95245dc -
Trigger Event:
push
-
Statement type:
File details
Details for the file pybticino-1.8.0-py3-none-any.whl.
File metadata
- Download URL: pybticino-1.8.0-py3-none-any.whl
- Upload date:
- Size: 28.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2818a086b42b63d3621696d93338b81f38ad2a2b3b9197d17beef688fdd9650f
|
|
| MD5 |
bed98c3e71e4be1920f8b1d154e0f866
|
|
| BLAKE2b-256 |
e826872600824640d43e080c9e94e563f8596081aac4c2f1351aed75c3fb2b2d
|
Provenance
The following attestation bundles were made for pybticino-1.8.0-py3-none-any.whl:
Publisher:
release.yml on k-the-hidden-hero/pybticino
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pybticino-1.8.0-py3-none-any.whl -
Subject digest:
2818a086b42b63d3621696d93338b81f38ad2a2b3b9197d17beef688fdd9650f - Sigstore transparency entry: 1369914976
- Sigstore integration time:
-
Permalink:
k-the-hidden-hero/pybticino@5172ca6ebc7ab4f7a18de0fed660800de95245dc -
Branch / Tag:
refs/tags/v1.8.0 - Owner: https://github.com/k-the-hidden-hero
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5172ca6ebc7ab4f7a18de0fed660800de95245dc -
Trigger Event:
push
-
Statement type: