Skip to main content

dbus2mqtt

dbus2mqtt is a Python application that bridges D-Bus 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.

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 D-Bus 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

Metadata

Release files for dbus2mqtt 0.9.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 dbus2mqtt 0.9.0
File Size Uploaded Provenance Actions
dbus2mqtt-0.9.0.tar.gz 197.4 kB With provenance Details for dbus2mqtt-0.9.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dbus2mqtt 0.9.0
File Interpreter ABI Platform Actions
dbus2mqtt-0.9.0-py3-none-any.whl Python 3 none any Details for dbus2mqtt-0.9.0-py3-none-any.whl

Total release size: 240.1 kB

Release files / dbus2mqtt-0.9.0.tar.gz

Download URL dbus2mqtt-0.9.0.tar.gz
Size 197.4 kB
Tags Source
SHA-256 checksum
How to use checksums
b91899bfba183b6b50dfd68a18ca5881fd104aa328625d40b445c2060ee719c6
BLAKE2b-256 checksum
How to use checksums
fb60678f79eb02588ae932b2f0235546315854b116e14d04a1ca6a81613d20c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 6, 2026.

Transparency log

Release files / dbus2mqtt-0.9.0-py3-none-any.whl

Download URL dbus2mqtt-0.9.0-py3-none-any.whl
Size 42.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
77aef8b633444218372b6b1ca1463329b467f7d438a8904d62d81b1c159da432
BLAKE2b-256 checksum
How to use checksums
efef18d960cdba8c466d98fd1db36804d544d86e4eb104560d1123f0a9e838a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 6, 2026.

Transparency log

Security for dbus2mqtt 0.9.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for dbus2mqtt-0.9.0.tar.gz

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 Nov 6, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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