dbus2mqtt 0.4.2__tar.gz → 0.4.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of dbus2mqtt might be problematic. Click here for more details.

Files changed (84) hide show
  1. dbus2mqtt-0.4.3/.github/workflows/deploy-docs.yml +29 -0
  2. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/.github/workflows/docker-dev.yml +3 -0
  3. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/.github/workflows/docker-stable.yml +1 -1
  4. dbus2mqtt-0.4.3/.github/workflows/trivy.yml +35 -0
  5. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/.gitignore +1 -3
  6. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/.pre-commit-config.yaml +2 -2
  7. dbus2mqtt-0.4.3/.vscode/settings.json +16 -0
  8. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/PKG-INFO +15 -11
  9. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/README.md +8 -6
  10. dbus2mqtt-0.4.2/docs/debugging.md → dbus2mqtt-0.4.3/docs/developer/debugging_dbus.md +9 -12
  11. dbus2mqtt-0.4.3/docs/developer/index.md +15 -0
  12. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/docs/examples/bluez.md +18 -10
  13. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/docs/examples/dbus2mqtt_internal_state.md +12 -2
  14. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/docs/examples/home_assistant_media_player.md +53 -30
  15. dbus2mqtt-0.4.3/docs/examples/index.md +9 -0
  16. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/docs/examples/linux_desktop.md +11 -4
  17. dbus2mqtt-0.4.3/docs/flows/flow_actions.md +44 -0
  18. dbus2mqtt-0.4.3/docs/flows/flow_triggers.md +72 -0
  19. dbus2mqtt-0.4.3/docs/flows/index.md +33 -0
  20. dbus2mqtt-0.4.3/docs/hooks.py +16 -0
  21. dbus2mqtt-0.4.3/docs/index.md +1 -0
  22. dbus2mqtt-0.4.3/mkdocs.yml +144 -0
  23. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/pyproject.toml +12 -10
  24. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/renovate.json +4 -4
  25. dbus2mqtt-0.4.3/uv.lock +1108 -0
  26. dbus2mqtt-0.4.2/.vscode/settings.json +0 -4
  27. dbus2mqtt-0.4.2/docs/examples.md +0 -5
  28. dbus2mqtt-0.4.2/docs/flows.md +0 -149
  29. dbus2mqtt-0.4.2/uv.lock +0 -744
  30. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/.dockerignore +0 -0
  31. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/.env.example +0 -0
  32. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  33. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  34. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/.github/release-drafter.yml +0 -0
  35. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/.github/scripts/release-versions.py +0 -0
  36. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/.github/workflows/ci.yml +0 -0
  37. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/.github/workflows/pre-commit.yml +0 -0
  38. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/.github/workflows/publish.yml +0 -0
  39. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/.github/workflows/release-drafter.yml +0 -0
  40. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/.python-version +0 -0
  41. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/.vscode/launch.json +0 -0
  42. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/.yamllint.yml +0 -0
  43. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/LICENSE +0 -0
  44. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/docker/Dockerfile.dev +0 -0
  45. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/docker/Dockerfile.pypi +0 -0
  46. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/docs/examples/bluez.yaml +0 -0
  47. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/docs/examples/dbus2mqtt_internal_state.yaml +0 -0
  48. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/docs/examples/home_assistant_media_player.yaml +2 -2
  49. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/docs/examples/linux_desktop.yaml +0 -0
  50. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/src/dbus2mqtt/__init__.py +0 -0
  51. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/src/dbus2mqtt/__main__.py +0 -0
  52. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/src/dbus2mqtt/config/__init__.py +0 -0
  53. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/src/dbus2mqtt/config/jsonarparse.py +0 -0
  54. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/src/dbus2mqtt/dbus/dbus_client.py +0 -0
  55. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/src/dbus2mqtt/dbus/dbus_types.py +0 -0
  56. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/src/dbus2mqtt/dbus/dbus_util.py +0 -0
  57. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/src/dbus2mqtt/dbus/introspection_patches/mpris_playerctl.py +0 -0
  58. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/src/dbus2mqtt/dbus/introspection_patches/mpris_vlc.py +0 -0
  59. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/src/dbus2mqtt/event_broker.py +0 -0
  60. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/src/dbus2mqtt/flow/__init__.py +0 -0
  61. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/src/dbus2mqtt/flow/actions/context_set.py +0 -0
  62. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/src/dbus2mqtt/flow/actions/log_action.py +0 -0
  63. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/src/dbus2mqtt/flow/actions/mqtt_publish.py +0 -0
  64. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/src/dbus2mqtt/flow/flow_processor.py +0 -0
  65. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/src/dbus2mqtt/main.py +0 -0
  66. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/src/dbus2mqtt/mqtt/mqtt_client.py +0 -0
  67. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/src/dbus2mqtt/template/dbus_template_functions.py +0 -0
  68. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/src/dbus2mqtt/template/templating.py +0 -0
  69. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/tests/__init__.py +0 -0
  70. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/tests/config/fixtures/payload_template_jinja_expressions.yaml +0 -0
  71. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/tests/config/fixtures/payload_template_off.yaml +0 -0
  72. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/tests/config/fixtures/schedule_cron_trigger.yaml +0 -0
  73. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/tests/config/test_config.py +0 -0
  74. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/tests/config/test_examples.py +0 -0
  75. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/tests/conftest.py +0 -0
  76. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/tests/dbus/test_dbus_client.py +0 -0
  77. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/tests/dbus/test_dbus_client_mqtt_command.py +0 -0
  78. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/tests/flow/actions/test_context_set.py +0 -0
  79. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/tests/flow/actions/test_log.py +0 -0
  80. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/tests/flow/actions/test_mqtt_publish.py +0 -0
  81. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/tests/flow/test_flow_processor.py +0 -0
  82. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/tests/flow/triggers/test_dbus_client_triggers.py +0 -0
  83. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/tests/template/test_templating.py +0 -0
  84. {dbus2mqtt-0.4.2 → dbus2mqtt-0.4.3}/tests/template/test_templating_config.py +0 -0
@@ -0,0 +1,29 @@
1
+ name: deploy-docs
2
+
3
+ "on":
4
+ release:
5
+ types: [published]
6
+ workflow_dispatch:
7
+
8
+ jobs:
9
+ deploy-docs:
10
+ runs-on: ubuntu-latest
11
+ permissions:
12
+ contents: write
13
+ steps:
14
+ - name: Checkout
15
+ uses: actions/checkout@v4
16
+ with:
17
+ fetch-depth: 0
18
+ - name: Configure Git Credentials
19
+ run: |
20
+ git config user.name github-actions[bot]
21
+ git config user.email 41898282+github-actions[bot]@users.noreply.github.com
22
+ - name: Install uv
23
+ uses: astral-sh/setup-uv@v6
24
+ with:
25
+ activate-environment: true
26
+ enable-cache: true
27
+ - name: gh-deploy
28
+ run: |
29
+ uv run mkdocs gh-deploy --force
@@ -6,7 +6,10 @@ name: docker-dev
6
6
  - main
7
7
  paths-ignore:
8
8
  - 'docs/**'
9
+ - 'tests/**'
9
10
  - '.pre-commit-config.yaml'
11
+ - 'README.md'
12
+ - 'renovate.json'
10
13
  workflow_dispatch:
11
14
 
12
15
  jobs:
@@ -26,7 +26,7 @@ jobs:
26
26
  - name: Determine supported release versions
27
27
  id: supported_release_versions
28
28
  run: |
29
- SUPPORTED_CYCLES=("0.1" "0.2" "0.3" "0.4" "0.5" "0.6" "0.7" "0.8" "0.9" "1.0" "2.0")
29
+ SUPPORTED_CYCLES=("0.4" "0.5" "0.6" "0.7" "0.8" "0.9" "1.0" "2.0")
30
30
 
31
31
  VERSIONS_JSON=$(python3 .github/scripts/release-versions.py "${SUPPORTED_CYCLES[@]}")
32
32
 
@@ -0,0 +1,35 @@
1
+ name: trivy
2
+
3
+ "on":
4
+ schedule:
5
+ - cron: '15 10 * * 1'
6
+ workflow_dispatch: {}
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ scan:
13
+ permissions:
14
+ contents: read # for actions/checkout to fetch code
15
+ security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
16
+ actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
17
+ name: Scan
18
+ runs-on: ubuntu-latest
19
+ steps:
20
+ - name: Checkout code
21
+ uses: actions/checkout@v4
22
+
23
+ - name: Run Trivy vulnerability scanner
24
+ uses: aquasecurity/trivy-action@0.32.0
25
+ with:
26
+ image-ref: ghcr.io/jwnmulder/dbus2mqtt:latest
27
+ format: 'sarif'
28
+ output: 'trivy-results.sarif'
29
+ severity: 'CRITICAL,HIGH'
30
+ ignore-unfixed: true
31
+
32
+ - name: Upload Trivy scan results to GitHub Security tab
33
+ uses: github/codeql-action/upload-sarif@v3
34
+ with:
35
+ sarif_file: 'trivy-results.sarif'
@@ -1,6 +1,3 @@
1
- # https://github.com/github/gitignore/blob/main/Python.gitignore
2
- # https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
3
-
4
1
  # Byte-compiled / optimized / DLL files
5
2
  __pycache__/
6
3
  *.py[cod]
@@ -8,6 +5,7 @@ __pycache__/
8
5
 
9
6
  # Distribution / packaging
10
7
  dist/
8
+ site/
11
9
 
12
10
  # Environments
13
11
  .env
@@ -33,7 +33,7 @@ repos:
33
33
  - --strict
34
34
 
35
35
  - repo: https://github.com/astral-sh/ruff-pre-commit
36
- rev: v0.12.2
36
+ rev: v0.12.3
37
37
  hooks:
38
38
  - id: ruff
39
39
  args:
@@ -42,7 +42,7 @@ repos:
42
42
  - I
43
43
 
44
44
  - repo: https://github.com/astral-sh/uv-pre-commit
45
- rev: 0.7.19
45
+ rev: 0.7.21
46
46
  hooks:
47
47
  - id: uv-lock
48
48
 
@@ -0,0 +1,16 @@
1
+ {
2
+ "python.testing.unittestEnabled": false,
3
+ "python.testing.pytestEnabled": true,
4
+ "yaml.schemas": {
5
+ "https://squidfunk.github.io/mkdocs-material/schema.json": "mkdocs.yml"
6
+ },
7
+ "yaml.customTags": [
8
+ "!ENV scalar",
9
+ "!ENV sequence",
10
+ "!relative scalar",
11
+ "tag:yaml.org,2002:python/name:material.extensions.emoji.to_svg",
12
+ "tag:yaml.org,2002:python/name:material.extensions.emoji.twemoji",
13
+ "tag:yaml.org,2002:python/name:pymdownx.superfences.fence_code_format",
14
+ "tag:yaml.org,2002:python/object/apply:pymdownx.slugs.slugify mapping"
15
+ ]
16
+ }
@@ -1,13 +1,14 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dbus2mqtt
3
- Version: 0.4.2
4
- Summary: A Python tool to expose Linux D-Bus signals, methods and properties over MQTT - featuring templating, payload enrichment and Home Assistant-ready examples
5
- Project-URL: Repository, https://github.com/jwnmulder/dbus2mqtt.git
3
+ Version: 0.4.3
4
+ 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
5
+ Project-URL: Documentation, https://jwnmulder.github.io/dbus2mqtt
6
+ Project-URL: Source, https://github.com/jwnmulder/dbus2mqtt
6
7
  Project-URL: Issues, https://github.com/jwnmulder/dbus2mqtt/issues
7
8
  License-Expression: MIT
8
9
  License-File: LICENSE
9
- Keywords: dbus,home-assistant,mpris,mqtt,python
10
- Classifier: Development Status :: 4 - Beta
10
+ Keywords: bluez,bridge,dbus,home-assistant,jinja2,mpris,mqtt,python
11
+ Classifier: Development Status :: 5 - Production/Stable
11
12
  Classifier: Intended Audience :: Developers
12
13
  Classifier: License :: OSI Approved :: MIT License
13
14
  Classifier: Operating System :: POSIX :: Linux
@@ -16,6 +17,7 @@ Classifier: Programming Language :: Python :: 3.10
16
17
  Classifier: Programming Language :: Python :: 3.11
17
18
  Classifier: Programming Language :: Python :: 3.12
18
19
  Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Home Automation
19
21
  Requires-Python: >=3.10
20
22
  Requires-Dist: apscheduler>=3.11.0
21
23
  Requires-Dist: colorlog>=6.9.0
@@ -37,7 +39,7 @@ It lets you forward Linux D-Bus signals and properties to MQTT topics, call D-Bu
37
39
 
38
40
  This makes it easy to integrate Linux desktop services or system signals into MQTT-based workflows - including **Home Assistant**.
39
41
 
40
- ## Features
42
+ ## Features
41
43
 
42
44
  * 🔗 Forward **D-Bus signals** to MQTT topics.
43
45
  * 🧠 Enrich or transform **MQTT payloads** using Jinja2 templates and additional D-Bus calls.
@@ -49,11 +51,11 @@ This makes it easy to integrate Linux desktop services or system signals into MQ
49
51
 
50
52
  **dbus2mqtt** is considered stable for the use-cases it has been tested against, and is actively being developed. Documentation is continuously being improved.
51
53
 
52
- Initial testing has focused on MPRIS integration. A table of tested MPRIS players and their supported methods can be found here: [home_assistant_media_player.md](https://github.com/jwnmulder/dbus2mqtt/blob/main/docs/examples/home_assistant_media_player.md)
54
+ Initial testing has focused on MPRIS integration. A table of tested MPRIS players and their supported methods can be found here: [Mediaplayer integration with Home Assistant](https://jwnmulder.github.io/dbus2mqtt/examples/home_assistant_media_player/)
53
55
 
54
56
  ## Getting started with dbus2mqtt
55
57
 
56
- 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. Have a look at [docs/examples](https://github.com/jwnmulder/dbus2mqtt/blob/main/docs/examples.md) for more examples
58
+ 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.
57
59
 
58
60
  ```yaml
59
61
  dbus:
@@ -92,6 +94,7 @@ MQTT__USERNAME=
92
94
  MQTT__PASSWORD=
93
95
  ```
94
96
 
97
+
95
98
  ### Install and run dbus2mqtt
96
99
 
97
100
  ```bash
@@ -129,7 +132,8 @@ sudo docker logs dbus2mqtt -f
129
132
 
130
133
  ## Examples
131
134
 
132
- This repository contains examples under [docs/examples](https://github.com/jwnmulder/dbus2mqtt/blob/main//docs/examples.md). The most complete one being [MPRIS to Home Assistant Media Player integration](https://github.com/jwnmulder/dbus2mqtt/blob/main/docs/examples/home_assistant_media_player.md)
135
+ More dbus2mqtt examples can be found here: [examples](https://jwnmulder.github.io/dbus2mqtt/examples/).
136
+ The most complete one being [MPRIS to Home Assistant Media Player integration](https://jwnmulder.github.io/dbus2mqtt/examples/home_assistant_media_player/)
133
137
 
134
138
  ## Configuration reference
135
139
 
@@ -226,8 +230,8 @@ dbus:
226
230
 
227
231
  ## Flows
228
232
 
229
- A reference of all supported flow triggers and actions can be found on [Flows](https://github.com/jwnmulder/dbus2mqtt/blob/main/docs/flows.md)
233
+ A reference of all supported flow triggers and actions can be found on [Flows](https://jwnmulder.github.io/dbus2mqtt/flows/)
230
234
 
231
235
  ## Jinja templating
232
236
 
233
- TODO: Document Jinja templating, for now see the [MPRIS to Home Assistant Media Player integration](https://github.com/jwnmulder/dbus2mqtt/blob/main/docs/examples/home_assistant_media_player.md) example
237
+ TODO: Document Jinja templating, for now see the [MPRIS to Home Assistant Media Player integration](https://jwnmulder.github.io/dbus2mqtt/examples/home_assistant_media_player/) example
@@ -5,7 +5,7 @@ It lets you forward Linux D-Bus signals and properties to MQTT topics, call D-Bu
5
5
 
6
6
  This makes it easy to integrate Linux desktop services or system signals into MQTT-based workflows - including **Home Assistant**.
7
7
 
8
- ## Features
8
+ ## Features
9
9
 
10
10
  * 🔗 Forward **D-Bus signals** to MQTT topics.
11
11
  * 🧠 Enrich or transform **MQTT payloads** using Jinja2 templates and additional D-Bus calls.
@@ -17,11 +17,11 @@ This makes it easy to integrate Linux desktop services or system signals into MQ
17
17
 
18
18
  **dbus2mqtt** is considered stable for the use-cases it has been tested against, and is actively being developed. Documentation is continuously being improved.
19
19
 
20
- Initial testing has focused on MPRIS integration. A table of tested MPRIS players and their supported methods can be found here: [home_assistant_media_player.md](https://github.com/jwnmulder/dbus2mqtt/blob/main/docs/examples/home_assistant_media_player.md)
20
+ Initial testing has focused on MPRIS integration. A table of tested MPRIS players and their supported methods can be found here: [Mediaplayer integration with Home Assistant](https://jwnmulder.github.io/dbus2mqtt/examples/home_assistant_media_player/)
21
21
 
22
22
  ## Getting started with dbus2mqtt
23
23
 
24
- 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. Have a look at [docs/examples](https://github.com/jwnmulder/dbus2mqtt/blob/main/docs/examples.md) for more examples
24
+ 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.
25
25
 
26
26
  ```yaml
27
27
  dbus:
@@ -60,6 +60,7 @@ MQTT__USERNAME=
60
60
  MQTT__PASSWORD=
61
61
  ```
62
62
 
63
+
63
64
  ### Install and run dbus2mqtt
64
65
 
65
66
  ```bash
@@ -97,7 +98,8 @@ sudo docker logs dbus2mqtt -f
97
98
 
98
99
  ## Examples
99
100
 
100
- This repository contains examples under [docs/examples](https://github.com/jwnmulder/dbus2mqtt/blob/main//docs/examples.md). The most complete one being [MPRIS to Home Assistant Media Player integration](https://github.com/jwnmulder/dbus2mqtt/blob/main/docs/examples/home_assistant_media_player.md)
101
+ More dbus2mqtt examples can be found here: [examples](https://jwnmulder.github.io/dbus2mqtt/examples/).
102
+ The most complete one being [MPRIS to Home Assistant Media Player integration](https://jwnmulder.github.io/dbus2mqtt/examples/home_assistant_media_player/)
101
103
 
102
104
  ## Configuration reference
103
105
 
@@ -194,8 +196,8 @@ dbus:
194
196
 
195
197
  ## Flows
196
198
 
197
- A reference of all supported flow triggers and actions can be found on [Flows](https://github.com/jwnmulder/dbus2mqtt/blob/main/docs/flows.md)
199
+ A reference of all supported flow triggers and actions can be found on [Flows](https://jwnmulder.github.io/dbus2mqtt/flows/)
198
200
 
199
201
  ## Jinja templating
200
202
 
201
- TODO: Document Jinja templating, for now see the [MPRIS to Home Assistant Media Player integration](https://github.com/jwnmulder/dbus2mqtt/blob/main/docs/examples/home_assistant_media_player.md) example
203
+ TODO: Document Jinja templating, for now see the [MPRIS to Home Assistant Media Player integration](https://jwnmulder.github.io/dbus2mqtt/examples/home_assistant_media_player/) example
@@ -1,23 +1,20 @@
1
- # Debugging
1
+ # Debugging dbus
2
2
 
3
- ## Running from source
3
+ Useful snippets for checking what's going on on dbus
4
4
 
5
5
  ```bash
6
- uv run main.py --config config.yaml
7
- ```
8
-
9
- ## dbus debugging
10
-
11
- ```bash
12
- uv run dbus2mqtt
13
-
14
- # https://dbus.freedesktop.org/doc/dbus-tutorial.html
15
- # https://dbus.freedesktop.org/doc/dbus-specification.html
6
+ # monitor all dbus traffic
16
7
  dbus-monitor
17
8
 
9
+ # show introspection data for dbus objects
18
10
  busctl --user introspect org.freedesktop.DBus /org/freedesktop/DBus
11
+ ```
12
+
13
+ Useful snippts for MPRIS debugging
19
14
 
15
+ ```bash
20
16
  playerctl -l
17
+
21
18
  busctl --user introspect org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2
22
19
 
23
20
  dbus-send --print-reply --session --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.ListNames | grep mpris
@@ -0,0 +1,15 @@
1
+ # Developer guide
2
+
3
+ ## Specifications
4
+
5
+ Generic DBus specifications:
6
+
7
+ * [D-Bus Tutorial](https://dbus.freedesktop.org/doc/dbus-tutorial.html)
8
+ * [D-Bus Specification](https://dbus.freedesktop.org/doc/dbus-specification.html)
9
+
10
+
11
+ ## Running from source
12
+
13
+ ```bash
14
+ uv run main.py --config config.yaml
15
+ ```
@@ -1,5 +1,12 @@
1
+ ---
2
+ hide:
3
+ - toc
4
+ ---
5
+
1
6
  # Bluez
2
7
 
8
+ ## Introduction
9
+
3
10
  This configuration file demonstrates how to use dbus2mqtt to bridge D-Bus events from BlueZ (the official Linux Bluetooth protocol stack) to MQTT topics. It subscribes to relevant D-Bus signals and properties for both the Bluetooth adapter (`hci0`) and all Bluetooth devices managed by BlueZ. The configuration defines flows that:
4
11
 
5
12
  * Monitor property changes and object lifecycle events (added/removed) for the Bluetooth adapter and devices.
@@ -8,7 +15,7 @@ This configuration file demonstrates how to use dbus2mqtt to bridge D-Bus events
8
15
 
9
16
  This setup allows MQTT clients to receive updates about Bluetooth adapter and device states, as well as notifications when devices are removed, making it easier to integrate Bluetooth events into broader automation workflows.
10
17
 
11
- Configuration activities
18
+ ## Setup activities
12
19
 
13
20
  * dbus2mqtt setup using the supplied [bluez.yaml](https://github.com/jwnmulder/dbus2mqtt/blob/main/docs/examples/bluez.yaml)
14
21
 
@@ -24,14 +31,15 @@ The following table lists commands, their descriptions, and an example JSON payl
24
31
 
25
32
  Dbus methods can be invoked by sendig the JSON payload to MQTT topic `dbus2mqtt/bluez/hci0/command`. Method calls will be done for all matching dbus objects.
26
33
 
27
- | Interface | Method<br />Property | Description | Example MQTT JSON Payload |
28
- |----------------------|-----------------------|--------------------------------------|-------------------------------------------------|
29
- | `org.bluez.Adapter1` | `StartDiscovery` | Starts bluetooth discovery | `{ "method": "StartDiscovery" }` |
30
- | `org.bluez.Adapter1` | `StopDiscovery` | Stops bluetooth discovery | `{ "method": "StopDiscovery" }` |
31
- | `org.bluez.Device1` | `Connect` | | `{ "method": "Connect", "path": "/org/bluez/hci0/dev_A1_A2_A3_A4_A5_A6" }` |
32
- | `org.bluez.Device1` | `Disconnect` | | `{ "method": "Disconnect", "path": "/org/bluez/hci0/dev_A1_A2_A3_A4_A5_A6" }` |
33
- | `org.bluez.Device1` | `Pair` | | `{ "method": "Pair", "path": "/org/bluez/hci0/dev_A1_A2_A3_A4_A5_A6" }` |
34
- | `org.bluez.Device1` | `CancelPairing` | | `{ "method": "CancelPairing", "path": "/org/bluez/hci0/dev_A1_A2_A3_A4_A5_A6" }` |
34
+ | Method<br />Property | Description | Example MQTT JSON Payload |
35
+ |-----------------------|--------------------------------------|-------------------------------------------------|
36
+ | `StartDiscovery` | Starts bluetooth discovery | `#!json { "method": "StartDiscovery" }` |
37
+ | `StopDiscovery` | Stops bluetooth discovery | `#!json { "method": "StopDiscovery" }` |
38
+ | `Connect` | | `#!json { "method": "Connect", "path": "/org/bluez/hci0/dev_A1_A2_A3_A4_A5_A6" }` |
39
+ | `Disconnect` | | `#!json { "method": "Disconnect", "path": "/org/bluez/hci0/dev_A1_A2_A3_A4_A5_A6" }` |
40
+ | `Pair` | | `#!json { "method": "Pair", "path": "/org/bluez/hci0/dev_A1_A2_A3_A4_A5_A6" }` |
41
+ | `CancelPairing` | | `#!json { "method": "CancelPairing", "path": "/org/bluez/hci0/dev_A1_A2_A3_A4_A5_A6" }` |
35
42
 
43
+ ## References
36
44
 
37
- https://manpages.ubuntu.com/manpages/noble/man5/org.bluez.
45
+ * <https://manpages.ubuntu.com/manpages/noble/man5/org.bluez>
@@ -1,4 +1,15 @@
1
- # dbus2mqtt internal state example
1
+ ---
2
+ hide:
3
+ - toc
4
+ ---
5
+
6
+ # dbus2mqtt internal state (WIP)
7
+
8
+ ## Introduction
9
+
10
+ This will publish the dbus2mqtt's internal state to the `dbus2mqtt/state` MQTT topic every 5 seconds
11
+
12
+ ## Setup activities
2
13
 
3
14
  Execute the following command to run dbus2mqtt with the example configuration in this repository.
4
15
 
@@ -6,7 +17,6 @@ Execute the following command to run dbus2mqtt with the example configuration in
6
17
  dbus2mqtt --config docs/examples/dbus2mqtt_internal_state.yaml
7
18
  ```
8
19
 
9
- This will publish the dbus2mqtt's internal state to the `dbus2mqtt/state` MQTT topic every 5 seconds
10
20
 
11
21
  ```json
12
22
  {"now": "2025-04-23T16:01:34.985452", "dbus_list": ["org.freedesktop.systemd1", "org.gnome.SessionManager"]}
@@ -1,5 +1,12 @@
1
+ ---
2
+ hide:
3
+ - toc
4
+ ---
5
+
1
6
  # Mediaplayer integration with Home Assistant
2
7
 
8
+ ## Introduction
9
+
3
10
  With dbus2mqtt as a bridge between MPRIS players and Home Assistant, it becomes possible to control Linux based media players via Home Assistant.
4
11
 
5
12
  The Media Player Remote Interfacing Specification (MPRIS) is a standard for controlling Linux media players. It provides a mechanism for compliant media players discovery, basic playback and media player state control as well as a tracklist interface which is used to add context to the current item.
@@ -7,21 +14,21 @@ The Media Player Remote Interfacing Specification (MPRIS) is a standard for cont
7
14
  Pre-requisites:
8
15
 
9
16
  * Home-Assistant with a working MQTT setup
10
- * The [media_player.template](https://github.com/Sennevds/media_player.template/tree/master) plugin
17
+ * The community Home-Assistant plugin [github.com/Sennevds/media_player.template](https://github.com/Sennevds/media_player.template)
11
18
 
12
- Features:
19
+ ## Features
13
20
 
14
21
  * dbus subscription using `org.mpris.MediaPlayer2.*` wildcard to support multiple concurrent MRPIS players
15
22
  * Every 5 seconds, the state of the `first` known MPRIS player is published to MQTT topic `dbus2mqtt/org.mpris.MediaPlayer2/state`
16
23
  * Every MPRIS property update immediately publishes the state to MQTT topic `dbus2mqtt/org.mpris.MediaPlayer2/state`
17
24
  * Support for player commands (see below)
18
25
 
19
- Configuration activities
26
+ ## Setup activities
20
27
 
21
- * MQTT Sensor and player configuration in Home Assistant (see below)
22
- * dbus2mqtt setup using the supplied [home_assistant_media_player.yaml](https://github.com/jwnmulder/dbus2mqtt/blob/main/docs/examples/home_assistant_media_player.yaml)
28
+ * Configure the MQTT Sensor and player configuration in Home Assistant with the configuration listed below
29
+ * Config dbus2mqtt using the supplied [home_assistant_media_player.yaml](https://github.com/jwnmulder/dbus2mqtt/blob/main/docs/examples/home_assistant_media_player.yaml)
23
30
 
24
- Execute the following command to run dbus2mqtt with the example configuration in this repository.
31
+ To run, execute the following commands
25
32
 
26
33
  ```bash
27
34
  dbus2mqtt --config docs/examples/home_assistant_media_player.yaml
@@ -29,17 +36,18 @@ dbus2mqtt --config docs/examples/home_assistant_media_player.yaml
29
36
 
30
37
  ## Tested configurations
31
38
 
32
- The following setup is known to work with Home Assistant.
39
+ The following MPRIS players are known to work with Home Assistant.
33
40
 
34
41
  | Application | Play<br />Pause<br /> | Stop | Next<br />Previous | Seek<br />SetPosition | Volume | Quit | Media Info | Media Image | Notes
35
42
  |--------------|-----------------------|------|--------------------|------|--------|------|------------|-------------|-------------------|
36
43
  | `Firefox` | ✅ | ✅ | ✅ | ✅ | | ❌ | ✅ | ✅ | |
37
44
  | `VLC` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | |
38
45
  | `Chromium` | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ✅ | ✔️ | Images not working when Chromium is running as snap |
39
- | `Kodi` | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | Requires Kodi plugin [MediaPlayerRemoteInterface](https://github.com/wastis/MediaPlayerRemoteInterface)<br /> Requires path to be set to '/'<br />Signals not working due to non-defaut path |
46
+ | `Kodi` | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | Requires Kodi plugin [MediaPlayerRemoteInterface](https://github.com/wastis/MediaPlayerRemoteInterface) |
40
47
 
48
+ !!! note
41
49
 
42
- More players that support MPRIS can be found here: <https://wiki.archlinux.org/title/MPRIS>
50
+ More players that support MPRIS (but have not been tested) can be found here: <https://wiki.archlinux.org/title/MPRIS>
43
51
 
44
52
  ## Player commands
45
53
 
@@ -47,18 +55,18 @@ The following table lists player commands, their descriptions, and an example JS
47
55
 
48
56
  Dbus methods can be invoked by sendig the JSON payload to MQTT topic `dbus2mqtt/org.mpris.MediaPlayer2/command`. Method calls will be done for all matching players. The same applies to property updates.
49
57
 
50
- | Interface | Method<br />Property | Description | Example MQTT JSON Payload |
51
- |---------------------------------|---------------|------------------------------------------|------------------------------------------------|
52
- | `org.mpris.MediaPlayer2.Player` | `Play` | Starts playback | `{ "method": "Play" }` |
53
- | `org.mpris.MediaPlayer2.Player` | `Pause` | Pauses playback | `{ "method": "Pause" }` |
54
- | `org.mpris.MediaPlayer2.Player` | `PlayPause` | Toggles between play and pause | `{ "method": "PlayPause" }` |
55
- | `org.mpris.MediaPlayer2.Player` | `Next` | Next | `{ "method": "Next" }` |
56
- | `org.mpris.MediaPlayer2.Player` | `Previous` | Previous | `{ "method": "Previous" }` |
57
- | `org.mpris.MediaPlayer2.Player` | `Stop` | Stops playback | `{ "method": "Stop" }` |
58
- | `org.mpris.MediaPlayer2.Player` | `Seek` | Seek forward or backward in micro seconds | `{ "method": "Seek", "args": [60000000] }` |
59
- | `org.mpris.MediaPlayer2.Player` | `Volume` | Set volume (double between 0 and 1) | `{ "property": "Volume", "value": 1.0 }` |
60
- | `org.mpris.MediaPlayer2.Player` | `SetPosition` | Set / seek to position in micro seconds. First arguments needs to be trackid which can be determined via Metadata.mpris:trackid | `{ "method": "SetPosition", "args": ["/org/mpris/MediaPlayer2/firefox", 170692139] }` |
61
- | `org.mpris.MediaPlayer2` | `Quit` | Quits the media player | `{ "method": "Quit" }` |
58
+ | Method<br />Property | Description | Example MQTT JSON Payload |
59
+ |---------------|------------------------------------------|------------------------------------------------|
60
+ | `Play` | Starts playback | `#!json { "method": "Play" }` |
61
+ | `Pause` | Pauses playback | `#!json { "method": "Pause" }` |
62
+ | `PlayPause` | Toggles between play and pause | `#!json { "method": "PlayPause" }` |
63
+ | `Stop` | Stops playback | `#!json { "method": "Stop" }` |
64
+ | `Next` | Next | `#!json { "method": "Next" }` |
65
+ | `Previous` | Previous | `#!json { "method": "Previous" }` |
66
+ | `Seek` | Seek forward or backward in micro seconds | `#!json { "method": "Seek", "args": [60000000] }` |
67
+ | `Volume` | Set volume (double between 0 and 1) | `#!json { "property": "Volume", "value": 1.0 }` |
68
+ | `SetPosition` | Set / seek to position in micro seconds. First arguments needs to be trackid which can be determined via Metadata.mpris:trackid | `#!json { "method": "SetPosition", "args": ["/org/mpris/MediaPlayer2/firefox", 170692139] }` |
69
+ | `Quit` | Quits the media player | `#!json { "method": "Quit" }` |
62
70
 
63
71
  For an overview of MPRIS commands have a look at <https://mpris2.readthedocs.io/en/latest/interfaces.html#mpris2.MediaPlayer2>
64
72
 
@@ -69,7 +77,7 @@ The configuration shown below creates a few components in Home Assistant
69
77
  * Media Player
70
78
  * MQTT sensor listening on topic `dbus2mqtt/org.mpris.MediaPlayer2/state`
71
79
 
72
- ```yaml
80
+ ```yaml+jinja
73
81
  mqtt:
74
82
  sensor:
75
83
  - name: MPRIS Media Player
@@ -94,7 +102,15 @@ media_player:
94
102
  current_volume_template: "{{ state_attr('sensor.mpris_media_player', 'Volume') }}"
95
103
  current_is_muted_template: "{{ state_attr('sensor.mpris_media_player', 'Volume') == 0 }}"
96
104
  current_position_template: "{{ state_attr('sensor.mpris_media_player', 'Position') }}"
97
- title_template: "{{ (state_attr('sensor.mpris_media_player', 'Metadata') or {}).get('xesam:title', '') }}"
105
+
106
+ # title: 'xesam:title' or filename without extension from 'xesam:url'
107
+ title_template: >-
108
+ {% set metadata = state_attr('sensor.mpris_media_player', 'Metadata') or {} %}
109
+ {% set title = metadata.get('xesam:title', '') %}
110
+ {% if not title or title == '' %}
111
+ {% set title = metadata.get('xesam:url', '') | regex_findall(find='([^\\/]+?)(?:\.[^.\\/]+)?$') | first | default('') %}
112
+ {% endif %}
113
+ {{ title }}
98
114
 
99
115
  media_content_type_template: music # needed to show 'artist'
100
116
  media_duration_template: "{{ (state_attr('sensor.mpris_media_player', 'Metadata') or {}).get('mpris:length', 0) }}"
@@ -129,32 +145,38 @@ media_player:
129
145
  service: mqtt.publish
130
146
  data:
131
147
  topic: dbus2mqtt/org.mpris.MediaPlayer2/command
132
- payload: '{"method": "Quit"}'
148
+ payload: >
149
+ {"method": "Quit"}
133
150
  play:
134
151
  service: mqtt.publish
135
152
  data:
136
153
  topic: dbus2mqtt/org.mpris.MediaPlayer2/command
137
- payload: '{"method": "Play"}'
154
+ payload: >
155
+ {"method": "Play"}
138
156
  pause:
139
157
  service: mqtt.publish
140
158
  data:
141
159
  topic: dbus2mqtt/org.mpris.MediaPlayer2/command
142
- payload: '{"method": "Pause"}'
160
+ payload: >
161
+ {"method": "Pause"}
143
162
  stop:
144
163
  service: mqtt.publish
145
164
  data:
146
165
  topic: dbus2mqtt/org.mpris.MediaPlayer2/command
147
- payload: '{"method": "Stop"}'
166
+ payload: >
167
+ {"method": "Stop"}
148
168
  next:
149
169
  service: mqtt.publish
150
170
  data:
151
171
  topic: dbus2mqtt/org.mpris.MediaPlayer2/command
152
- payload: '{"method": "Next"}'
172
+ payload: >
173
+ {"method": "Next"}
153
174
  previous:
154
175
  service: mqtt.publish
155
176
  data:
156
177
  topic: dbus2mqtt/org.mpris.MediaPlayer2/command
157
- payload: '{"method": "Previous"}'
178
+ payload: >
179
+ {"method": "Previous"}
158
180
  seek:
159
181
  service: mqtt.publish
160
182
  data:
@@ -165,7 +187,8 @@ media_player:
165
187
  service: mqtt.publish
166
188
  data:
167
189
  topic: dbus2mqtt/org.mpris.MediaPlayer2/command
168
- payload: '{"property": "Volume", "value": {{volume}} }'
190
+ payload: >
191
+ {"property": "Volume", "value": {{volume}} }
169
192
  volume_up:
170
193
  service: mqtt.publish
171
194
  data:
@@ -0,0 +1,9 @@
1
+ # Examples
2
+
3
+ Examples work better than large amounts of documentation and puzzling everything together. Feel free to use these examples as-is or adapt them to your own likening.
4
+
5
+ Each example comes with a dbus2mqtt configuration file and corresponding documentation.
6
+
7
+ * [MPRIS to Home Assistant Media Player integration](home_assistant_media_player.md)
8
+ * [BlueZ](bluez.md)
9
+ * [Publish dbus2mqtt internal state](dbus2mqtt_internal_state.md)
@@ -1,16 +1,23 @@
1
- # Linux Desktop
1
+ ---
2
+ hide:
3
+ - toc
4
+ ---
5
+
6
+ # Linux Desktop (WIP)
7
+
8
+ ## Introduction
2
9
 
3
10
  > **Warning:** This is not working, dbus-next is validating property names and bails on `power-saver-enable`
4
11
 
12
+ ## Setup activities
13
+
5
14
  Trying out this example
6
15
 
7
16
  ```bash
8
17
  uv run dbus2mqtt --config docs/examples/linux_desktop.yaml
9
18
  ```
10
19
 
11
- This example shows how this dbus2mqtt can act as a bridge between the MPRIS player and Home Assistant.
12
-
13
- Features:
20
+ ## Features
14
21
 
15
22
  * ...
16
23