Async client for the Ampio Smart Home MQTT protocol
Project description
ampio-mqtt
Beta - 0.x.x. This library exists to back the home-assistant/core ampio integration currently in development. Anything below
1.0.0is unstable by design: the public surface (dataclass fields, exported names, method signatures) can and will change between any two 0.x.x releases without migration shims.1.0.0is reserved for the moment the integration PR is accepted upstream; until then, breaking changes are expected and pins should be exact.
Async Python client for the Ampio Smart Home local MQTT protocol exposed by the Ampio M-SERV controller. Built to back a Home Assistant integration; the library itself is Home Assistant agnostic.
Status
Beta. The library is iterated alongside the home-assistant/core ampio
integration; both move together. There is no API stability promise at this
stage - any 0.x.x release may break consumers. The 1.0.0 cut ships when
the HA Core integration PR is accepted.
Currently supports:
- TCP connection to the Ampio MQTT broker with username/password auth and auto-reconnect with capped exponential backoff and jitter,
- discovery of physical modules and logical DB objects from the M-SERV,
- live push of object state changes via per-object MQTT topics, plus a bulk states snapshot at startup,
- classification of sensor objects (temperature and M-SENS environmental channels) with Home-Assistant-compatible device/state class hints,
- M-SERV identification (mac, firmware versions, local IP),
- best-effort LAN discovery via
discover()(explicit multicast DNS A-record lookup ofampio.localdriven bypython-zeroconf, followed by a TCP probe of the resolved address). Home Assistant integrations can pass their sharedAsyncZeroconfinstance viadiscover(zeroconf=...). - per-object room mapping via
AmpioClient.fetch_rooms()({object_id: room_name}), backed by the M-SERV's MQTTdata/groups+data/group_devicesendpoints. Intended for a Home Assistant integration to forward asDeviceInfo.suggested_areaat first import; reassignment is the user's call after that. - per-module capability classification on
AmpioModule.capabilities(afrozenset[Capability]):DIGITAL_OUTPUT,DIGITAL_INPUT,ANALOG_INPUT,TEMPERATURE_INPUT,ENV_SENSOR,ROLLER_OUTPUT,RGBW_OUTPUT,IR_OUTPUT,UI_PANEL,BRIDGE,HUB,ALARM,AUDIO_VIDEO. Most modules carry several flags (e.g. M-OC-4s ={DIGITAL_OUTPUT, ANALOG_INPUT, RGBW_OUTPUT}). Drives HA platform selection and bundle/split decisions in the integration. - input-object classification via
classify_input()/InputKind(AmpioObject.input_kind,is_input,is_on): flags map to a generic boolean, motion detection tobinary_sensor.motion. Live flag/button events are delivered with minimal latency through the sameadd_object_listener()pipeline by routing the decoded raw per-channel topics (which fire ahead of the per-object republish) to the owning object.
Protocol reference notes live under docs/;
src/ampio_mqtt/const.py remains the
canonical source for the topic helpers.
Installation
pip install ampio-mqtt
discover() resolves ampio.local over multicast DNS from inside the
process via python-zeroconf, which
is a hard runtime dependency. The lookup works identically on macOS, HAOS,
plain Linux, and Docker - no dependency on nss-mdns/avahi being
configured on the host.
Usage
import asyncio
from ampio_mqtt import AmpioClient, discover
async def main() -> None:
# Find the M-SERV on the LAN via mDNS.
candidates = await discover()
if not candidates:
raise SystemExit("No Ampio M-SERV found on the LAN")
host = candidates[0].address or candidates[0].host
client = AmpioClient(host, username="user", password="secret")
client.add_object_listener(lambda obj: print(obj.id, obj.kind, obj.value))
await client.start() # connects, subscribes, requests discovery
# Per-object room map. A Home Assistant integration would forward each
# value as `DeviceInfo.suggested_area` at first device creation.
rooms = await client.fetch_rooms()
for obj_id, room in rooms.items():
print(f"object {obj_id} -> {room}")
await asyncio.sleep(30)
await client.stop()
asyncio.run(main())
License
MIT
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
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 ampio_mqtt-0.4.0.tar.gz.
File metadata
- Download URL: ampio_mqtt-0.4.0.tar.gz
- Upload date:
- Size: 53.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1d03b84c0af4452f92edaa6c13dcf7b9d460b5360da2c1f62f0064bfb37e5bba
|
|
| MD5 |
169a14603580baa7de4e1c9d5fdb4d91
|
|
| BLAKE2b-256 |
2d0fbd2d4b509b489a2ca86766ae7c5cd529da8504892d5f563c07cd56b53293
|
Provenance
The following attestation bundles were made for ampio_mqtt-0.4.0.tar.gz:
Publisher:
release.yml on pszypowicz/ampio-mqtt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ampio_mqtt-0.4.0.tar.gz -
Subject digest:
1d03b84c0af4452f92edaa6c13dcf7b9d460b5360da2c1f62f0064bfb37e5bba - Sigstore transparency entry: 1722459178
- Sigstore integration time:
-
Permalink:
pszypowicz/ampio-mqtt@59ca1658ed51b1561daa8556c29cc21ca4848d14 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/pszypowicz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@59ca1658ed51b1561daa8556c29cc21ca4848d14 -
Trigger Event:
push
-
Statement type:
File details
Details for the file ampio_mqtt-0.4.0-py3-none-any.whl.
File metadata
- Download URL: ampio_mqtt-0.4.0-py3-none-any.whl
- Upload date:
- Size: 30.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
beae6157ac47146646bb6bca6cb9ec1dece3952fe007d16eb54c4b69d180c674
|
|
| MD5 |
0f9de39e47df6e6e13f8041456fd4b1f
|
|
| BLAKE2b-256 |
f352433ceb30e4a92a01a89096736882d7e2d69eb34c8f47e986571d63bf3db2
|
Provenance
The following attestation bundles were made for ampio_mqtt-0.4.0-py3-none-any.whl:
Publisher:
release.yml on pszypowicz/ampio-mqtt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ampio_mqtt-0.4.0-py3-none-any.whl -
Subject digest:
beae6157ac47146646bb6bca6cb9ec1dece3952fe007d16eb54c4b69d180c674 - Sigstore transparency entry: 1722459267
- Sigstore integration time:
-
Permalink:
pszypowicz/ampio-mqtt@59ca1658ed51b1561daa8556c29cc21ca4848d14 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/pszypowicz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@59ca1658ed51b1561daa8556c29cc21ca4848d14 -
Trigger Event:
push
-
Statement type: