Name | dbus2mqtt JSON |
Version |
0.5.1
JSON |
| download |
home_page | None |
Summary | 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 |
upload_time | 2025-09-08 20:11:36 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.10 |
license | None |
keywords |
bluez
bridge
dbus
home-assistant
jinja2
mpris
mqtt
python
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# 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 flexible **Jinja2 templating**.
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](https://jwnmulder.github.io/dbus2mqtt/examples/home_assistant_media_player.html)
## 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.
```yaml
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: 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.
```bash
MQTT__HOST=localhost
MQTT__PORT=1883
MQTT__USERNAME=
MQTT__PASSWORD=
```
### Install and run dbus2mqtt
```bash
python -m pip install dbus2mqtt
dbus2mqtt --config config.yaml
```
See [setup](https://jwnmulder.github.io/dbus2mqtt/setup.html) for more installation options and configuration details.
## Examples
More dbus2mqtt examples can be found in the [examples](https://jwnmulder.github.io/dbus2mqtt/examples/index.html) section.
The most complete one being [Mediaplayer integration with Home Assistant](https://jwnmulder.github.io/dbus2mqtt/examples/home_assistant_media_player.html)
## Exposing dbus methods, properties and signals
See [subscriptions](https://jwnmulder.github.io/dbus2mqtt/subscriptions.html) 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
```json
{
"method": "Play"
}
```
## Flows and Jinja based templating
For more advanced use-cases, dbus2mqtt has support for flows and Jinja2 based templates. A reference of all supported flow triggers and actions can be found on [flows](https://jwnmulder.github.io/dbus2mqtt/flows/index.html)
Jinja templating documentation can be found here: [templating](https://jwnmulder.github.io/dbus2mqtt/templating/index.html)
Raw data
{
"_id": null,
"home_page": null,
"name": "dbus2mqtt",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "bluez, bridge, dbus, home-assistant, jinja2, mpris, mqtt, python",
"author": null,
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/2d/82/4d257f659bf9459fe5e412bc6092a59fb09468e06064776b4a58ce924d5b/dbus2mqtt-0.5.1.tar.gz",
"platform": null,
"description": "# dbus2mqtt\n\n**dbus2mqtt** is a Python application that bridges **DBus** with **MQTT**.\nIt lets you forward Linux D-Bus signals and properties to MQTT topics, call D-Bus methods via MQTT messages, and shape payloads using flexible **Jinja2 templating**.\n\nThis makes it easy to integrate Linux desktop services or system signals into MQTT-based workflows - including **Home Assistant**.\n\n## Features\n\n* \ud83d\udd17 Forward **D-Bus signals** to MQTT topics.\n* \ud83e\udde0 Enrich or transform **MQTT payloads** using Jinja2 templates and additional D-Bus calls.\n* \u26a1 Trigger message publishing via **signals, timers, property changes, or startup events**.\n* \ud83d\udce1 Expose **D-Bus methods** for remote control via MQTT messages.\n* \ud83c\udfe0 Includes example configurations for **MPRIS** and **Home Assistant Media Player** integration.\n\n## Project status\n\n**dbus2mqtt** is considered stable for the use-cases it has been tested against, and is actively being developed. Documentation is continuously being improved.\n\nInitial 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](https://jwnmulder.github.io/dbus2mqtt/examples/home_assistant_media_player.html)\n\n## Getting started with dbus2mqtt\n\nCreate 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.\n\n```yaml\ndbus:\n subscriptions:\n - bus_name: org.mpris.MediaPlayer2.*\n path: /org/mpris/MediaPlayer2\n interfaces:\n - interface: org.freedesktop.DBus.Properties\n methods:\n - method: GetAll\n\n flows:\n - name: \"Publish MPRIS state\"\n triggers:\n - type: object_added\n - type: schedule\n interval: {seconds: 5}\n actions:\n - type: context_set\n context:\n mpris_bus_name: '{{ dbus_list(\"org.mpris.MediaPlayer2.*\") | first }}'\n path: /org/mpris/MediaPlayer2\n - type: mqtt_publish\n topic: dbus2mqtt/org.mpris.MediaPlayer2/state\n payload_type: json\n payload_template: |\n {{ dbus_call(mpris_bus_name, path, 'org.freedesktop.DBus.Properties', 'GetAll', ['org.mpris.MediaPlayer2.Player']) }}\n```\n\nMQTT 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.\n\n```bash\nMQTT__HOST=localhost\nMQTT__PORT=1883\nMQTT__USERNAME=\nMQTT__PASSWORD=\n```\n\n### Install and run dbus2mqtt\n\n```bash\npython -m pip install dbus2mqtt\ndbus2mqtt --config config.yaml\n```\n\nSee [setup](https://jwnmulder.github.io/dbus2mqtt/setup.html) for more installation options and configuration details.\n\n## Examples\n\nMore dbus2mqtt examples can be found in the [examples](https://jwnmulder.github.io/dbus2mqtt/examples/index.html) section.\nThe most complete one being [Mediaplayer integration with Home Assistant](https://jwnmulder.github.io/dbus2mqtt/examples/home_assistant_media_player.html)\n\n## Exposing dbus methods, properties and signals\n\nSee [subscriptions](https://jwnmulder.github.io/dbus2mqtt/subscriptions.html) 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\n\n```json\n{\n \"method\": \"Play\"\n}\n```\n\n## Flows and Jinja based templating\n\nFor more advanced use-cases, dbus2mqtt has support for flows and Jinja2 based templates. A reference of all supported flow triggers and actions can be found on [flows](https://jwnmulder.github.io/dbus2mqtt/flows/index.html)\n\nJinja templating documentation can be found here: [templating](https://jwnmulder.github.io/dbus2mqtt/templating/index.html)\n",
"bugtrack_url": null,
"license": null,
"summary": "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 ",
"version": "0.5.1",
"project_urls": {
"Documentation": "https://jwnmulder.github.io/dbus2mqtt",
"Issues": "https://github.com/jwnmulder/dbus2mqtt/issues",
"Source": "https://github.com/jwnmulder/dbus2mqtt"
},
"split_keywords": [
"bluez",
" bridge",
" dbus",
" home-assistant",
" jinja2",
" mpris",
" mqtt",
" python"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "e0d2cf0a99c8cdbd12536f7a564eda733f1454d387c9aeaf43ac6ed475341e34",
"md5": "16e4bae03965c9045521aac2d0d0296a",
"sha256": "b08e61133592d68f976b03efe6290f1225d0d08420f199b592a778992513fbec"
},
"downloads": -1,
"filename": "dbus2mqtt-0.5.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "16e4bae03965c9045521aac2d0d0296a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 32286,
"upload_time": "2025-09-08T20:11:34",
"upload_time_iso_8601": "2025-09-08T20:11:34.878331Z",
"url": "https://files.pythonhosted.org/packages/e0/d2/cf0a99c8cdbd12536f7a564eda733f1454d387c9aeaf43ac6ed475341e34/dbus2mqtt-0.5.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "2d824d257f659bf9459fe5e412bc6092a59fb09468e06064776b4a58ce924d5b",
"md5": "affccd8ad6dc0cf9d093db85826692b2",
"sha256": "0453c5353e32a2dc095a05418ca9784b3d1eaa2b4540a01cca2726e2d955a52f"
},
"downloads": -1,
"filename": "dbus2mqtt-0.5.1.tar.gz",
"has_sig": false,
"md5_digest": "affccd8ad6dc0cf9d093db85826692b2",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 146888,
"upload_time": "2025-09-08T20:11:36",
"upload_time_iso_8601": "2025-09-08T20:11:36.427426Z",
"url": "https://files.pythonhosted.org/packages/2d/82/4d257f659bf9459fe5e412bc6092a59fb09468e06064776b4a58ce924d5b/dbus2mqtt-0.5.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-09-08 20:11:36",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "jwnmulder",
"github_project": "dbus2mqtt",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "dbus2mqtt"
}