General purpose DBus to MQTT bridge - expose signals, methods and properties over MQTT - featuring jinja based templating, payload enrichment and MPRIS / BlueZ / Home Assistant ready examples
Project description
dbus2mqtt
dbus2mqtt is a Python application that bridges DBus with MQTT. It lets you forward Linux D-Bus signals and properties to MQTT topics, call D-Bus methods via MQTT messages and shape payloads using configurable templates.
This makes it easy to integrate Linux desktop services or system signals into MQTT-based workflows - including Home Assistant.
Features
- 🔗 Forward D-Bus signals to MQTT topics.
- 🧠 Enrich or transform MQTT payloads using Jinja2 templates and additional D-Bus calls.
- ⚡ Trigger message publishing via signals, timers, property changes, or startup events.
- 📡 Expose D-Bus methods for remote control via MQTT messages.
- 🏠 Includes example configurations for MPRIS and Home Assistant Media Player integration.
Project status
dbus2mqtt is considered stable for the use-cases it has been tested against, and is actively being developed. Documentation is continuously being improved.
Initial testing has focused on MPRIS integration. A table of tested MPRIS players and their supported methods can be found on Mediaplayer integration with Home Assistant
Getting started with dbus2mqtt
Create a config.yaml file with the contents shown below. This configuration will expose all bus properties from the org.mpris.MediaPlayer2.Player interface to MQTT on the dbus2mqtt/org.mpris.MediaPlayer2/state topic.
dbus:
subscriptions:
- bus_name: org.mpris.MediaPlayer2.*
path: /org/mpris/MediaPlayer2
interfaces:
- interface: org.freedesktop.DBus.Properties
methods:
- method: GetAll
flows:
- name: "Publish MPRIS state"
triggers:
- type: dbus_object_added
- type: schedule
interval: {seconds: 5}
actions:
- type: context_set
context:
mpris_bus_name: '{{ dbus_list("org.mpris.MediaPlayer2.*") | first }}'
path: /org/mpris/MediaPlayer2
- type: mqtt_publish
topic: dbus2mqtt/org.mpris.MediaPlayer2/state
payload_type: json
payload_template: |
{{ dbus_call(mpris_bus_name, path, 'org.freedesktop.DBus.Properties', 'GetAll', ['org.mpris.MediaPlayer2.Player']) }}
MQTT connection details can be configured in that same config.yaml file or via environment variables. For now create a .env file with the following contents.
MQTT__HOST=localhost
MQTT__PORT=1883
MQTT__USERNAME=
MQTT__PASSWORD=
Install and run dbus2mqtt
python -m pip install dbus2mqtt
dbus2mqtt --config config.yaml
See setup for more installation options and configuration details.
Examples
More dbus2mqtt examples can be found in the examples section. The most complete one being Mediaplayer integration with Home Assistant
Exposing dbus methods, properties and signals
See subscriptions for documentation on calling methods, setting properties and exposing D-Bus signals to MQTT. When configured, D-Bus methods can be invoked by publishing a message like
{
"method": "Play"
}
Flows
dbus2mqtt lets you build flows to automate how D-Bus data is published or processed. Templates provide dynamic control over filtering, topics, payloads and other flow parameters.
A reference of supported flow triggers and actions is available on flows and templating details can be found at templating
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 dbus2mqtt-0.1.dev1.tar.gz.
File metadata
- Download URL: dbus2mqtt-0.1.dev1.tar.gz
- Upload date:
- Size: 198.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
deccfb0aed63d92b7429c2bce2cb77518c4513b273e0e7127f291d2b544541dc
|
|
| MD5 |
e5d2189d24a8adaf8df4712292cac8f9
|
|
| BLAKE2b-256 |
f032875577594e6be4a5dced6e41e91cf9a0e78f82daea8e67ba92ce818be265
|
Provenance
The following attestation bundles were made for dbus2mqtt-0.1.dev1.tar.gz:
Publisher:
publish.yml on jwnmulder/dbus2mqtt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dbus2mqtt-0.1.dev1.tar.gz -
Subject digest:
deccfb0aed63d92b7429c2bce2cb77518c4513b273e0e7127f291d2b544541dc - Sigstore transparency entry: 976339878
- Sigstore integration time:
-
Permalink:
jwnmulder/dbus2mqtt@d19b5edf517f943184c33cc12afd28d117a6774a -
Branch / Tag:
- Owner: https://github.com/jwnmulder
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d19b5edf517f943184c33cc12afd28d117a6774a -
Trigger Event:
release
-
Statement type:
File details
Details for the file dbus2mqtt-0.1.dev1-py3-none-any.whl.
File metadata
- Download URL: dbus2mqtt-0.1.dev1-py3-none-any.whl
- Upload date:
- Size: 41.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
08fd77eb635ec148b9323561ca41346e985de5c78889fcbf4ecbc67cfd4a8c1b
|
|
| MD5 |
78df5c214ac07a9fecf7d6940693c32f
|
|
| BLAKE2b-256 |
fcff58b4f62896cc8908c09cf679f044362898c902b2b8024f686a581ccfdee9
|
Provenance
The following attestation bundles were made for dbus2mqtt-0.1.dev1-py3-none-any.whl:
Publisher:
publish.yml on jwnmulder/dbus2mqtt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dbus2mqtt-0.1.dev1-py3-none-any.whl -
Subject digest:
08fd77eb635ec148b9323561ca41346e985de5c78889fcbf4ecbc67cfd4a8c1b - Sigstore transparency entry: 976339881
- Sigstore integration time:
-
Permalink:
jwnmulder/dbus2mqtt@d19b5edf517f943184c33cc12afd28d117a6774a -
Branch / Tag:
- Owner: https://github.com/jwnmulder
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d19b5edf517f943184c33cc12afd28d117a6774a -
Trigger Event:
release
-
Statement type: