dbus2mqtt 0.4.1__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.
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/.github/release-drafter.yml +4 -5
- dbus2mqtt-0.4.3/.github/workflows/deploy-docs.yml +29 -0
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/.github/workflows/docker-dev.yml +3 -0
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/.github/workflows/docker-stable.yml +1 -1
- dbus2mqtt-0.4.3/.github/workflows/trivy.yml +35 -0
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/.gitignore +1 -3
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/.pre-commit-config.yaml +3 -3
- dbus2mqtt-0.4.3/.vscode/settings.json +16 -0
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/PKG-INFO +19 -13
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/README.md +12 -8
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/docker/Dockerfile.dev +1 -1
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/docker/Dockerfile.pypi +1 -1
- dbus2mqtt-0.4.1/docs/debugging.md → dbus2mqtt-0.4.3/docs/developer/debugging_dbus.md +9 -12
- dbus2mqtt-0.4.3/docs/developer/index.md +15 -0
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/docs/examples/bluez.md +18 -10
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/docs/examples/dbus2mqtt_internal_state.md +12 -2
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/docs/examples/dbus2mqtt_internal_state.yaml +7 -1
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/docs/examples/home_assistant_media_player.md +54 -31
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/docs/examples/home_assistant_media_player.yaml +6 -7
- dbus2mqtt-0.4.3/docs/examples/index.md +9 -0
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/docs/examples/linux_desktop.md +11 -4
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/docs/examples/linux_desktop.yaml +0 -4
- dbus2mqtt-0.4.3/docs/flows/flow_actions.md +44 -0
- dbus2mqtt-0.4.3/docs/flows/flow_triggers.md +72 -0
- dbus2mqtt-0.4.3/docs/flows/index.md +33 -0
- dbus2mqtt-0.4.3/docs/hooks.py +16 -0
- dbus2mqtt-0.4.3/docs/index.md +1 -0
- dbus2mqtt-0.4.3/mkdocs.yml +144 -0
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/pyproject.toml +12 -10
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/renovate.json +17 -3
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/src/dbus2mqtt/config/__init__.py +8 -1
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/src/dbus2mqtt/dbus/dbus_client.py +1 -1
- dbus2mqtt-0.4.3/src/dbus2mqtt/flow/actions/log_action.py +36 -0
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/src/dbus2mqtt/flow/flow_processor.py +5 -1
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/src/dbus2mqtt/mqtt/mqtt_client.py +29 -8
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/src/dbus2mqtt/template/templating.py +11 -0
- dbus2mqtt-0.4.3/tests/flow/actions/test_log.py +28 -0
- dbus2mqtt-0.4.3/uv.lock +1108 -0
- dbus2mqtt-0.4.1/.vscode/settings.json +0 -4
- dbus2mqtt-0.4.1/docs/examples.md +0 -5
- dbus2mqtt-0.4.1/docs/flows.md +0 -123
- dbus2mqtt-0.4.1/uv.lock +0 -744
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/.dockerignore +0 -0
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/.env.example +0 -0
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/.github/scripts/release-versions.py +0 -0
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/.github/workflows/ci.yml +0 -0
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/.github/workflows/pre-commit.yml +0 -0
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/.github/workflows/publish.yml +0 -0
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/.github/workflows/release-drafter.yml +0 -0
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/.python-version +0 -0
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/.vscode/launch.json +0 -0
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/.yamllint.yml +0 -0
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/LICENSE +0 -0
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/docs/examples/bluez.yaml +0 -0
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/src/dbus2mqtt/__init__.py +0 -0
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/src/dbus2mqtt/__main__.py +0 -0
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/src/dbus2mqtt/config/jsonarparse.py +0 -0
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/src/dbus2mqtt/dbus/dbus_types.py +0 -0
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/src/dbus2mqtt/dbus/dbus_util.py +0 -0
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/src/dbus2mqtt/dbus/introspection_patches/mpris_playerctl.py +0 -0
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/src/dbus2mqtt/dbus/introspection_patches/mpris_vlc.py +0 -0
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/src/dbus2mqtt/event_broker.py +0 -0
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/src/dbus2mqtt/flow/__init__.py +0 -0
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/src/dbus2mqtt/flow/actions/context_set.py +0 -0
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/src/dbus2mqtt/flow/actions/mqtt_publish.py +0 -0
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/src/dbus2mqtt/main.py +0 -0
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/src/dbus2mqtt/template/dbus_template_functions.py +0 -0
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/tests/__init__.py +0 -0
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/tests/config/fixtures/payload_template_jinja_expressions.yaml +0 -0
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/tests/config/fixtures/payload_template_off.yaml +0 -0
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/tests/config/fixtures/schedule_cron_trigger.yaml +0 -0
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/tests/config/test_config.py +0 -0
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/tests/config/test_examples.py +0 -0
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/tests/conftest.py +0 -0
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/tests/dbus/test_dbus_client.py +0 -0
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/tests/dbus/test_dbus_client_mqtt_command.py +0 -0
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/tests/flow/actions/test_context_set.py +0 -0
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/tests/flow/actions/test_mqtt_publish.py +0 -0
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/tests/flow/test_flow_processor.py +0 -0
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/tests/flow/triggers/test_dbus_client_triggers.py +0 -0
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/tests/template/test_templating.py +0 -0
- {dbus2mqtt-0.4.1 → dbus2mqtt-0.4.3}/tests/template/test_templating_config.py +0 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
name-template: 'v$RESOLVED_VERSION
|
|
1
|
+
name-template: 'v$RESOLVED_VERSION'
|
|
2
2
|
tag-template: 'v$RESOLVED_VERSION'
|
|
3
3
|
exclude-labels:
|
|
4
4
|
- dependencies
|
|
5
|
+
- skip-changelog
|
|
5
6
|
categories:
|
|
6
7
|
- title: 🚨 Breaking changes
|
|
7
8
|
labels:
|
|
@@ -13,13 +14,13 @@ categories:
|
|
|
13
14
|
- title: 🐛 Bug Fixes
|
|
14
15
|
labels:
|
|
15
16
|
- bugfix
|
|
16
|
-
- title: 🧰
|
|
17
|
+
- title: 🧰 Misc
|
|
17
18
|
labels:
|
|
18
19
|
- chore
|
|
19
20
|
- documentation
|
|
20
21
|
- title: ⬆️ Dependency updates
|
|
21
22
|
labels:
|
|
22
|
-
-
|
|
23
|
+
- dependencies
|
|
23
24
|
exclude-contributors:
|
|
24
25
|
- jwnmulder
|
|
25
26
|
autolabeler:
|
|
@@ -47,6 +48,4 @@ version-resolver:
|
|
|
47
48
|
default: patch
|
|
48
49
|
change-template: '* $TITLE (#$NUMBER)'
|
|
49
50
|
template: |
|
|
50
|
-
## Changes
|
|
51
|
-
|
|
52
51
|
$CHANGES
|
|
@@ -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
|
|
@@ -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.
|
|
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.
|
|
36
|
+
rev: v0.12.3
|
|
37
37
|
hooks:
|
|
38
38
|
- id: ruff
|
|
39
39
|
args:
|
|
@@ -42,11 +42,11 @@ repos:
|
|
|
42
42
|
- I
|
|
43
43
|
|
|
44
44
|
- repo: https://github.com/astral-sh/uv-pre-commit
|
|
45
|
-
rev: 0.7.
|
|
45
|
+
rev: 0.7.21
|
|
46
46
|
hooks:
|
|
47
47
|
- id: uv-lock
|
|
48
48
|
|
|
49
49
|
- repo: https://github.com/RobertCraigie/pyright-python
|
|
50
|
-
rev: v1.1.
|
|
50
|
+
rev: v1.1.403
|
|
51
51
|
hooks:
|
|
52
52
|
- id: pyright
|
|
@@ -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.
|
|
4
|
-
Summary:
|
|
5
|
-
Project-URL:
|
|
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 ::
|
|
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
|
|
@@ -32,12 +34,12 @@ Description-Content-Type: text/markdown
|
|
|
32
34
|
|
|
33
35
|
# dbus2mqtt
|
|
34
36
|
|
|
35
|
-
**dbus2mqtt** is a Python application that bridges **
|
|
36
|
-
It lets you forward D-Bus signals and properties to MQTT topics, call D-Bus methods via MQTT messages, and shape payloads using flexible **Jinja2 templating**.
|
|
37
|
+
**dbus2mqtt** is a Python application that bridges **DBus** with **MQTT**.
|
|
38
|
+
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**.
|
|
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
|
-
##
|
|
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: [
|
|
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.
|
|
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
|
-
|
|
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
|
|
|
@@ -154,6 +158,8 @@ or
|
|
|
154
158
|
mqtt:
|
|
155
159
|
host: localhost
|
|
156
160
|
port: 1883
|
|
161
|
+
subscription_topics:
|
|
162
|
+
- dbus2mqtt/#
|
|
157
163
|
```
|
|
158
164
|
|
|
159
165
|
### Exposing dbus methods
|
|
@@ -224,8 +230,8 @@ dbus:
|
|
|
224
230
|
|
|
225
231
|
## Flows
|
|
226
232
|
|
|
227
|
-
|
|
233
|
+
A reference of all supported flow triggers and actions can be found on [Flows](https://jwnmulder.github.io/dbus2mqtt/flows/)
|
|
228
234
|
|
|
229
235
|
## Jinja templating
|
|
230
236
|
|
|
231
|
-
TODO: Document Jinja templating, for now see the [MPRIS to Home Assistant Media Player integration](https://github.
|
|
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
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# dbus2mqtt
|
|
2
2
|
|
|
3
|
-
**dbus2mqtt** is a Python application that bridges **
|
|
4
|
-
It lets you forward D-Bus signals and properties to MQTT topics, call D-Bus methods via MQTT messages, and shape payloads using flexible **Jinja2 templating**.
|
|
3
|
+
**dbus2mqtt** is a Python application that bridges **DBus** with **MQTT**.
|
|
4
|
+
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**.
|
|
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
|
-
##
|
|
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: [
|
|
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.
|
|
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
|
-
|
|
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
|
|
|
@@ -122,6 +124,8 @@ or
|
|
|
122
124
|
mqtt:
|
|
123
125
|
host: localhost
|
|
124
126
|
port: 1883
|
|
127
|
+
subscription_topics:
|
|
128
|
+
- dbus2mqtt/#
|
|
125
129
|
```
|
|
126
130
|
|
|
127
131
|
### Exposing dbus methods
|
|
@@ -192,8 +196,8 @@ dbus:
|
|
|
192
196
|
|
|
193
197
|
## Flows
|
|
194
198
|
|
|
195
|
-
|
|
199
|
+
A reference of all supported flow triggers and actions can be found on [Flows](https://jwnmulder.github.io/dbus2mqtt/flows/)
|
|
196
200
|
|
|
197
201
|
## Jinja templating
|
|
198
202
|
|
|
199
|
-
TODO: Document Jinja templating, for now see the [MPRIS to Home Assistant Media Player integration](https://github.
|
|
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
|
|
@@ -25,7 +25,7 @@ RUN --mount=type=cache,target=/root/.cache/uv \
|
|
|
25
25
|
uv sync --frozen --no-dev
|
|
26
26
|
|
|
27
27
|
# Then, use a final image without uv
|
|
28
|
-
FROM python:3.13-slim-bookworm
|
|
28
|
+
FROM python:3.13-slim-bookworm@sha256:6544e0e002b40ae0f59bc3618b07c1e48064c4faed3a15ae2fbd2e8f663e8283
|
|
29
29
|
# It is important to use the image that matches the builder, as the path to the
|
|
30
30
|
# Python executable must be the same, e.g., using `python:3.12-slim-bookworm`
|
|
31
31
|
# will fail.
|
|
@@ -1,23 +1,20 @@
|
|
|
1
|
-
# Debugging
|
|
1
|
+
# Debugging dbus
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Useful snippets for checking what's going on on dbus
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
|
-
|
|
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
|
-
|
|
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
|
-
|
|
|
28
|
-
|
|
29
|
-
| `
|
|
30
|
-
| `
|
|
31
|
-
| `
|
|
32
|
-
| `
|
|
33
|
-
| `
|
|
34
|
-
| `
|
|
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
|
-
|
|
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,6 +1,8 @@
|
|
|
1
1
|
# mqtt:
|
|
2
2
|
# host:
|
|
3
3
|
# port:
|
|
4
|
+
# subscription_topics:
|
|
5
|
+
# - dbus2mqtt/#
|
|
4
6
|
|
|
5
7
|
dbus:
|
|
6
8
|
subscriptions:
|
|
@@ -37,4 +39,8 @@ flows:
|
|
|
37
39
|
payload_type: json
|
|
38
40
|
payload_template:
|
|
39
41
|
now: "{{ now().isoformat() }}"
|
|
40
|
-
|
|
42
|
+
dbus_list_res: "{{ dbus_list('*') }}"
|
|
43
|
+
- type: log
|
|
44
|
+
level: INFO
|
|
45
|
+
msg: >
|
|
46
|
+
Just published: dbus_list={{ dbus_list('*') }} to topic 'dbus2mqtt/state'
|