A Home Assistant MQTT client library
Project description
NirahMQ
A complete Home Assistant MQTT Python library with ease of use in mind
[!WARNING] This library is currently in ALPHA! Expect things to change or break!
✨ Features
- Supports all Home Assistant MQTT components and all their features
- Use of device-based discovery instead of component-based for simpler organization
- Support for automatic cleanup of topics on exit
- Device wide and per component availability support
- MQTT birth and last will support for both device and Home Assistant
- Ease of use by simple static definitions, while allowing runtime modifications
- Full Python type hint support
- Validation of definitions and user inputs on load thanks to pydantic
- Extensible API through simple class inheritance
📦 Installation
NirahMQ requires Python 3.12 or later and can be installed simply with pip install nirahmq.
🚀 Simple example
Below is an example of a simple Text component that prints its contents on update:
Example code
from nirahmq.components import Text
from nirahmq.device import Device, DeviceInfo, DiscoveryInfo, OriginInfo
from nirahmq.mqtt import MQTTClient
def callback(text: Text, payload: str) -> None:
print(f"Got new text: `{payload}`")
text.set_text(payload)
dinfo = DiscoveryInfo(
device=DeviceInfo(
name="NirahMQ Test Device",
identifiers="NirahMQ-Test-Device"
),
origin=OriginInfo(
name="Python Program"
),
components={
'component1': Text(command_topic="~/cmd", state_topic="~/state", command_callback=callback)
}
)
with (MQTTClient("homeassistant.lan", 1883, "user", r"password") as client,
Device(client, dinfo, "node_id") as device):
input("Press enter to continue...\n")
📝 License
Copyright © 2025 Dionisis Toulatos
NirahMQ uses the AGPL-3.0+ license
Project details
Release history Release notifications | RSS feed
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 nirahmq-0.1.3a0.tar.gz.
File metadata
- Download URL: nirahmq-0.1.3a0.tar.gz
- Upload date:
- Size: 53.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a18f10c181007e84f6b805bfe689ca4f26c28d281878edadecfcaa23596b0c83
|
|
| MD5 |
d03fb6a6014ce59b6db8c0e76b16dfca
|
|
| BLAKE2b-256 |
18f1aae0efe6922a5d6d0306e5e07857ddd7a67f664644910b60cea7f6e507a6
|
Provenance
The following attestation bundles were made for nirahmq-0.1.3a0.tar.gz:
Publisher:
release.yaml on dionisis2014/nirahmq
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nirahmq-0.1.3a0.tar.gz -
Subject digest:
a18f10c181007e84f6b805bfe689ca4f26c28d281878edadecfcaa23596b0c83 - Sigstore transparency entry: 227367467
- Sigstore integration time:
-
Permalink:
dionisis2014/nirahmq@2936d883e7739645551542f36489f19ae71e7a27 -
Branch / Tag:
refs/tags/v0.1.3a0 - Owner: https://github.com/dionisis2014
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@2936d883e7739645551542f36489f19ae71e7a27 -
Trigger Event:
push
-
Statement type:
File details
Details for the file nirahmq-0.1.3a0-py3-none-any.whl.
File metadata
- Download URL: nirahmq-0.1.3a0-py3-none-any.whl
- Upload date:
- Size: 37.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f95df52d3e0192ab44ae75c13e1d8ff28caab50c1ac0f8a5148acf2f53b06eb
|
|
| MD5 |
57003c6c7bf37139c028aea9aa1fda98
|
|
| BLAKE2b-256 |
020b44f12b001e41bad48d0a4a695fa105a1ed1e33eedb3eaa345d4899c8dfbc
|
Provenance
The following attestation bundles were made for nirahmq-0.1.3a0-py3-none-any.whl:
Publisher:
release.yaml on dionisis2014/nirahmq
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nirahmq-0.1.3a0-py3-none-any.whl -
Subject digest:
3f95df52d3e0192ab44ae75c13e1d8ff28caab50c1ac0f8a5148acf2f53b06eb - Sigstore transparency entry: 227367469
- Sigstore integration time:
-
Permalink:
dionisis2014/nirahmq@2936d883e7739645551542f36489f19ae71e7a27 -
Branch / Tag:
refs/tags/v0.1.3a0 - Owner: https://github.com/dionisis2014
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@2936d883e7739645551542f36489f19ae71e7a27 -
Trigger Event:
push
-
Statement type: