Skip to main content

miniconf-mqtt Python client

Python 3.11+ client and CLI for miniconf_mqtt targets.

python -m pip install -e py/

Client

Use the async client for schema-aware access:

from miniconf.client import Miniconf

async with Miniconf.connect("mqtt", "app/id") as mc:
    schema = await mc.schema()
    value = await mc.get("/path")
    snapshot = await mc.snapshot("/subtree")
    await mc.set("/path", 42)

    async for event in mc.watch("/subtree"):
        print(event.path, event.value if event.present else "<deleted>")

Each context is one session. Connection loss raises aiomqtt.MqttError in pending operations and watches; open a new context to reconnect. When supplying an existing aiomqtt client, enter async with Miniconf(client, prefix) and give it exclusive use of the client's message stream.

Core API:

  • schema() loads and caches the retained schema.
  • get(path) reads one schema-validated retained leaf without opening a subtree cache.
  • set(path, value, response=True) publishes one set/# request. It waits for the broker's acknowledgement; response=True also waits for the device's reply.
  • snapshot(path="") reads a finite retained subtree snapshot.
  • watch(path="") streams authoritative retained settings publications below a subtree without waiting for quiescence. Events distinguish JSON null from retained deletes through .present. Opening another reader can replay retained values to an existing watcher.
  • RawMiniconf provides exact-path get(), set(), snapshot(), and watch() without schema loading.

Schema helpers:

  • schema.path(keys) normalizes string, Indices, Packed, or path-part keys.
  • schema.node(keys) returns a SchemaNode(path, schema) with .kind, .node, and .edge.
  • schema.children(keys) returns direct child nodes.
  • schema.walk(keys="") iterates a subtree.
  • schema.compact(keys="") returns compact defs rooted at a subtree.
  • schema.indices(keys) and schema.packed(keys) translate paths to Rust-compatible keys.

Notes:

  • The client accepts Miniconf MQTT protocol proto=1, keeps /alive subscribed, and reloads schema when schema_rev changes. An unsupported protocol invalidates the cache and subsequent schema-based operations raise a protocol error. RawMiniconf skips this check. Rust and Python package versions need not match; incompatible wire changes require a new protocol version.
  • Exact reads and open watches do not wait for subtree quiescence.
  • A finite operation's timeout covers startup, schema loading, subscription, and response waits together. Watch timeouts bound setup and later schema reloads, not the lifetime of the stream. Subscription cleanup has a separate one-second allowance.
  • Finite retained subtree snapshots use a quiescence window because MQTT retained replay has no end-of-set marker. If the timeout expires before quiescence, snapshots and pruning raise TimeoutError instead of accepting partial results.
  • Retained /settings messages without auth="" are ignored as non-authoritative settings traffic.
  • Retained burst quiescence uses the same rule as the Rust client: 100 ms + 3 * measured_subscribe_rtt, reset on each accepted retained publication.

CLI

miniconf --broker mqtt app/id /path
miniconf --broker mqtt app/id /path=42
miniconf --broker mqtt app/id /path?
miniconf --broker mqtt app/id /path!
miniconf --broker mqtt --raw app/id /path

Command suffixes:

  • PATH reads one exact leaf.
  • PATH=VALUE writes one JSON value with ACK/NACK by default.
  • PATH? renders schema; PATH?? prints compact schema NDJSON.
  • PATH! renders retained subtree values; PATH!! prints raw /path=value lines.
  • The root path is empty: use the quoted command '?' for root schema. '/?' addresses the empty-name child below root; / is not an alias for root.
  • --raw disables schema, subtree tracking, ?, and !.
  • --prune PATH clears stale retained schema/settings below PATH.
  • --force-prune clears all retained topics under the resolved prefix.

Metadata

Release files for miniconf-mqtt 0.21.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for miniconf-mqtt 0.21.0
File Size Uploaded
miniconf_mqtt-0.21.0.tar.gz 21.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for miniconf-mqtt 0.21.0
File Interpreter ABI Platform
miniconf_mqtt-0.21.0-py3-none-any.whl Python 3 none any Details

Total release size: 39.9 kB

Release files / miniconf_mqtt-0.21.0.tar.gz

Download URL miniconf_mqtt-0.21.0.tar.gz
Size 21.1 kB
Tags Source
SHA-256 checksum
How to use checksums
ec7a9e30919c3d57bd21c4576993c749d037b69dda7831c4586b77b463ad10d4
BLAKE2b-256 checksum
How to use checksums
9b0e7780a706316d64a937b1c471ef56e0fa44c99917d9f83839520fa9ea850d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 22, 2026.

Transparency log

Release files / miniconf_mqtt-0.21.0-py3-none-any.whl

Download URL miniconf_mqtt-0.21.0-py3-none-any.whl
Size 18.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1dfe3abd6f13077fbc7f8073f2cbefff2009302020b0ed4456bfed11be8c12de
BLAKE2b-256 checksum
How to use checksums
744863f0d887b36aa6d9a4427d0bbe0fb9bb9e5bd19b4a3377a10ba1597397d9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 22, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.21.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page