ha-mqtt-device
A thin Python library for creating and maintaining Home Assistant devices that are discoverable via MQTT device discovery. Individual entities associated with a device can be added, updated, and removed through the same API.
Features
- Device discovery: publish the discovery payload Home Assistant needs to automatically pick up your device over MQTT.
- Entity management: add and maintain multiple entities (sensors, switches, lights, binary sensors, dates, datetimes, humidifiers, cameras, device trackers, infrared emitters/receivers, etc.) that belong to a device.
- Event subscriptions: entities can subscribe to MQTT topics and deliver updates — for example switch commands from Home Assistant or infrared emitter signals — to your async callbacks as
Eventobjects. - Thin and focused: no heavy framework — just the abstractions needed to model a device and its entities.
Requirements
- Python 3.14+
- uv for development and dependency management
aiomqttfor the MQTT provider (pip install "ha-mqtt-device[mqtt]")
Usage
Runnable examples — for the MQTT provider, device discovery, and every entity (supported and planned) — can be found in EXAMPLES.md.
Development
This project is managed with uv. Common commands:
| Task | Command |
|---|---|
| Run tests | uv run pytest |
| Format code | uv format |
| Lint | uv run ruff check |
| Type checking | uv run mypy . |
| Build | uv build |
Project layout
src/ha_mqtt_device/ # library source
tests/ # test suite
examples/ # runnable entity examples
pyproject.toml # project metadata and tool configuration
License
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 ha_mqtt_device-1.1.0.tar.gz.
File metadata
- Download URL: ha_mqtt_device-1.1.0.tar.gz
- Upload date:
- Size: 57.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
048046c0fb903c9df2153ec5b3fabccaf4a47ae0d290dcbfc90d8596e313c36e
|
|
| MD5 |
3d3258d98943de57edc8f88547a98ac8
|
|
| BLAKE2b-256 |
e058fd7b5168a6b0382e6ea2ff32f8ecdcf957b4997de61229f44b5ddbbc3ff3
|
File details
Details for the file ha_mqtt_device-1.1.0-py3-none-any.whl.
File metadata
- Download URL: ha_mqtt_device-1.1.0-py3-none-any.whl
- Upload date:
- Size: 105.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d204f9a6e646c81b75312deeeec8c34aed5bfe3019db50f2095ec34a29b6419c
|
|
| MD5 |
60a97077b7eb21932d9ff43b59dbfcaf
|
|
| BLAKE2b-256 |
1859c9b1656777eac7f5b76a5c996f179c900418bf5b228cebacdec06e8d66df
|