Skip to main content

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.

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

Metadata

Release files for dbus2mqtt 0.8.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.8.0
File Size Uploaded
dbus2mqtt-0.8.0.tar.gz 202.8 kB Details

Built distribution (wheel)

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

Total release size: 245.3 kB

Release files / dbus2mqtt-0.8.0.tar.gz

Download URL dbus2mqtt-0.8.0.tar.gz
Size 202.8 kB
Tags Source
SHA-256 checksum
How to use checksums
1ee2e59d8264fc940aca9c7fcb2a704c4c326b6dd6a99cf214507106211b6a63
BLAKE2b-256 checksum
How to use checksums
178cb5bc91d3576fe5e1dca65a31683f17ff98b6b45d1744c117e2e3a6784305
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 16, 2026.

Transparency log

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

Download URL dbus2mqtt-0.8.0-py3-none-any.whl
Size 42.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fbe9785a4329c61109225da6f755765e50dbe732a0d9891ad847f74d3add9654
BLAKE2b-256 checksum
How to use checksums
23341a6ae8909d7a6115f817b764ee37d481d0b0c6ae437c58465e956196c7bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 16, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.8.0 This release

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

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