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.
Account tiers. Any Ampio account works; what the library can see is decided by the account's administrator bit. Per-user app permissions do not change it (live-verified with a standard account granted every app permission):
- Administrator - the full catalogue: every DB object, the module list (
AmpioClient.moduleswith names, models, firmware), and the global raw-channel topics that deliver input events with minimal latency.- Standard user (the recommended shape for a dedicated Home Assistant account) - the app-sync surface: the objects the administrator granted the account in the Ampio app, with names, classification metadata, visibility flags, rooms, and the server identity (
AmpioClient.server_info). No module list (somserv_idstaysNone) and no raw input topics - input events arrive about 100-140 ms later, through the per-object republish.
AmpioClient.access_tierreports the detected tier once discovery completes.docs/account-tiers.mdhas the full capability table, the measured latency difference, and when an administrator account is worth it.The grant bounds reads and object commands alike. An account can only read and only command the objects it was granted in the app; a command aimed at anything else is dropped, and no state for it reaches the account's namespace.
Bus events are not bounded that way. Any account can raise any event number, regardless of the per-event rights the app shows, and the logic behind an event runs with full authority. A dedicated standard account is a real boundary for direct object control, not for whatever the installer wired to an event - see
docs/account-tiers.md.
Status
Beta, iterated alongside the home-assistant/core ampio integration (see the stability note above). 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,
- two-tier discovery: administrator accounts read the full
configcatalogue; standard accounts fall back to the app-syncdatasurface (grant-filtered objects with full metadata, plus theparams_devicesvisibility table). The detected tier is exposed asAmpioClient.access_tier, - replacement-stable per-object identity via
AmpioObject.stable_key(the DesignerleafId), identical on both tiers - seedocs/identity.md, - 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),
- bus events:
send_event()raises one on either tier, andadd_event_listener()reports the ones Ampio's own logic raises (panel presses and the like, administrator-only), - scene catalogue and control via
fetch_scenes()/run_scene()/turn_scene_off()/undo_scene()(undorestores what the objects held before the scene ran), - per-module health on the admin tier (
AmpioModule.supply_voltage,temperature) from each module's own diagnostics broadcast, withadd_module_listener()for updates, - 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. - object control via
AmpioClient.command()plus typed helpers (turn_on,turn_off,toggle,set_value,set_color,open_cover,close_cover,set_cover_position,set_cover_tilt). Works on both account tiers - seedocs/protocol.md, - output-object classification via
classify()/OutputKind(AmpioObject.kind,is_output,supports_tilt): relays, dimmers, RGBW lights, and the three cover types, each flagged with the command verbs it answers so a consumer picks a platform without its own type table. Tilt-capable blinds also report their slat angle asAmpioObject.tilt_position, - input-object classification via
classify()/InputKind(AmpioObject.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
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.14.0.tar.gz.
File metadata
- Download URL: ampio_mqtt-0.14.0.tar.gz
- Upload date:
- Size: 89.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
36d1b71e2f845d6769f7e33f554c0c1288e6409f6a9d125023bf2430ba4c51ee
|
|
| MD5 |
0eb7e64cbe2519127c70ef2f626eab2c
|
|
| BLAKE2b-256 |
e085e994c9ba2f5f4ad7dd641874dc1371c16b35d6c8a53e622c2e4511bb5cf8
|
Provenance
The following attestation bundles were made for ampio_mqtt-0.14.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.14.0.tar.gz -
Subject digest:
36d1b71e2f845d6769f7e33f554c0c1288e6409f6a9d125023bf2430ba4c51ee - Sigstore transparency entry: 2469161574
- Sigstore integration time:
-
Permalink:
pszypowicz/ampio-mqtt@70642ff5a39e0c4272e1ec4529369cb2fed8fad0 -
Branch / Tag:
refs/tags/v0.14.0 - Owner: https://github.com/pszypowicz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@70642ff5a39e0c4272e1ec4529369cb2fed8fad0 -
Trigger Event:
push
-
Statement type:
File details
Details for the file ampio_mqtt-0.14.0-py3-none-any.whl.
File metadata
- Download URL: ampio_mqtt-0.14.0-py3-none-any.whl
- Upload date:
- Size: 42.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
56a644ca3070e17b87957cf2f06ede60e7032d12a2370d4f5efbe20861ac9105
|
|
| MD5 |
8340a12c17cee0fbf8ae3bf42a82267e
|
|
| BLAKE2b-256 |
5837e9c5911c0a69fc2bd5c800401a65ea07213188f0f541ef31fc942bd6c537
|
Provenance
The following attestation bundles were made for ampio_mqtt-0.14.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.14.0-py3-none-any.whl -
Subject digest:
56a644ca3070e17b87957cf2f06ede60e7032d12a2370d4f5efbe20861ac9105 - Sigstore transparency entry: 2469161592
- Sigstore integration time:
-
Permalink:
pszypowicz/ampio-mqtt@70642ff5a39e0c4272e1ec4529369cb2fed8fad0 -
Branch / Tag:
refs/tags/v0.14.0 - Owner: https://github.com/pszypowicz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@70642ff5a39e0c4272e1ec4529369cb2fed8fad0 -
Trigger Event:
push
-
Statement type: