Skip to main content

Standalone MQTT client wrapper around paho-mqtt with TLS, reconnection, subscription recovery, and topic pattern matching

Project description

ebus-mqtt-client

Standalone MQTT client wrapper around paho-mqtt v2.

Features

  • TLS support (secure with CA verification, insecure, or plaintext)
  • Automatic reconnection with configurable backoff
  • Subscription recovery on reconnect
  • Topic pattern matching via paho's MQTTMatcher
  • Last Will and Testament (LWT)
  • MQTTv3 and MQTTv5 protocol support
  • Factory method for dict-based configuration

Install

pip install ebus-mqtt-client

Quick start

from ebus_mqtt_client import MqttClient

client = MqttClient(
    client_id="my-client",
    endpoint="broker.example.com",
    port=1883,
)
client.start()

client.subscribe("sensors/#", callback_param)
client.publish("sensors/temp", "22.5")

client.stop()

From a config dict

cfg = {
    "host": "broker.example.com",
    "port": 8883,
    "use_tls": True,
    "tls_insecure": False,
    "tls_ca_cert": "/path/to/ca.pem",
    "authentication": {
        "type": "USER_PASS",
        "username": "user",
        "password": "secret",
    },
}

client = MqttClient.from_config(cfg, client_id="my-client")
client.start()

mTLS (client-certificate authentication)

When the broker authenticates the client via the TLS handshake (no username/password), supply a client cert and key. File-path form:

cfg = {
    "host": "broker.example.com",
    "port": 8883,
    "use_tls": True,
    "tls_insecure": False,
    "tls_ca_cert": "/path/to/ca.pem",
    "tls_client_cert": "/path/to/client.crt",
    "tls_client_key": "/path/to/client.key",
    # "tls_client_key_password": "...",  # only if the key is encrypted
}

client = MqttClient.from_config(cfg, client_id="my-client")
client.start()

In-memory form — useful when the cert/key are fetched from a secret store rather than the filesystem. If both the path and *_data forms are supplied for the same item, the *_data form wins and a warning is logged:

cfg = {
    "host": "broker.example.com",
    "port": 8883,
    "use_tls": True,
    "tls_insecure": False,
    "tls_ca_data": ca_pem_str,
    "tls_client_cert_data": client_cert_pem_str,
    "tls_client_key_data": client_key_pem_str,
}

client = MqttClient.from_config(cfg, client_id="my-client")
client.start()

Contributing

See CONTRIBUTING.md for how to file Discussions, Issues, and pull requests. The library is intentionally a thin MQTT-only layer — Homie / eBus features belong in ebus-sdk.

License

MIT License — Copyright (c) 2026 Clark Communications Corporation

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

ebus_mqtt_client-0.1.6.tar.gz (12.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ebus_mqtt_client-0.1.6-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file ebus_mqtt_client-0.1.6.tar.gz.

File metadata

  • Download URL: ebus_mqtt_client-0.1.6.tar.gz
  • Upload date:
  • Size: 12.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ebus_mqtt_client-0.1.6.tar.gz
Algorithm Hash digest
SHA256 3497450737aabbb526b089436c0ddc7c1988525c69451b743a5317dbb03d63f5
MD5 1c6ff83721d4b6af3f475b5329c8f65f
BLAKE2b-256 e9c395f20e307831f955e2305f01d790a8ea262f8e0987dc5380901142f10d9e

See more details on using hashes here.

Provenance

The following attestation bundles were made for ebus_mqtt_client-0.1.6.tar.gz:

Publisher: publish.yml on electrification-bus/ebus-mqtt-client

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ebus_mqtt_client-0.1.6-py3-none-any.whl.

File metadata

File hashes

Hashes for ebus_mqtt_client-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 6200512ef10bf4b2e0171388339f9bd55b53dd52acddf1d88159ed15034ca647
MD5 32e8b61882db7a836e7156c7604855a1
BLAKE2b-256 8eb776f374feb5f4783c3d9d4788b6de0f0f453f89d10e061f9c545e85e52bf8

See more details on using hashes here.

Provenance

The following attestation bundles were made for ebus_mqtt_client-0.1.6-py3-none-any.whl:

Publisher: publish.yml on electrification-bus/ebus-mqtt-client

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page