dbus2mqtt 0.1.2__tar.gz → 0.3.0__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.3.0/.github/release-drafter.yml +52 -0
- dbus2mqtt-0.3.0/.github/scripts/release-versions.py +66 -0
- {dbus2mqtt-0.1.2 → dbus2mqtt-0.3.0}/.github/workflows/ci.yml +9 -6
- dbus2mqtt-0.1.2/.github/workflows/docker-latest.yml → dbus2mqtt-0.3.0/.github/workflows/docker-dev.yml +11 -8
- dbus2mqtt-0.1.2/.github/workflows/docker-publish-pypi-release.yml → dbus2mqtt-0.3.0/.github/workflows/docker-stable.yml +35 -7
- {dbus2mqtt-0.1.2 → dbus2mqtt-0.3.0}/.github/workflows/pre-commit.yml +5 -5
- {dbus2mqtt-0.1.2 → dbus2mqtt-0.3.0}/.github/workflows/publish.yml +6 -5
- {dbus2mqtt-0.1.2 → dbus2mqtt-0.3.0}/.pre-commit-config.yaml +4 -4
- dbus2mqtt-0.3.0/.python-version +1 -0
- {dbus2mqtt-0.1.2 → dbus2mqtt-0.3.0}/PKG-INFO +9 -12
- {dbus2mqtt-0.1.2 → dbus2mqtt-0.3.0}/README.md +7 -10
- dbus2mqtt-0.1.2/docker/Dockerfile.latest → dbus2mqtt-0.3.0/docker/Dockerfile.dev +1 -1
- {dbus2mqtt-0.1.2 → dbus2mqtt-0.3.0}/docker/Dockerfile.pypi +2 -0
- dbus2mqtt-0.3.0/docs/examples/dbus2mqtt_internal_state.md +13 -0
- dbus2mqtt-0.3.0/docs/examples/dbus2mqtt_internal_state.yaml +40 -0
- {dbus2mqtt-0.1.2 → dbus2mqtt-0.3.0}/docs/examples/home_assistant_media_player.md +42 -32
- {dbus2mqtt-0.1.2 → dbus2mqtt-0.3.0}/docs/examples/home_assistant_media_player.yaml +40 -13
- {dbus2mqtt-0.1.2 → dbus2mqtt-0.3.0}/docs/examples/linux_desktop.yaml +5 -4
- {dbus2mqtt-0.1.2 → dbus2mqtt-0.3.0}/docs/examples.md +1 -1
- dbus2mqtt-0.3.0/docs/flows.md +122 -0
- {dbus2mqtt-0.1.2 → dbus2mqtt-0.3.0}/pyproject.toml +1 -1
- {dbus2mqtt-0.1.2 → dbus2mqtt-0.3.0}/renovate.json +5 -0
- dbus2mqtt-0.1.2/src/dbus2mqtt/config.py → dbus2mqtt-0.3.0/src/dbus2mqtt/config/__init__.py +18 -15
- dbus2mqtt-0.3.0/src/dbus2mqtt/config/jsonarparse.py +31 -0
- {dbus2mqtt-0.1.2 → dbus2mqtt-0.3.0}/src/dbus2mqtt/dbus/dbus_client.py +62 -38
- {dbus2mqtt-0.1.2 → dbus2mqtt-0.3.0}/src/dbus2mqtt/dbus/dbus_types.py +2 -2
- {dbus2mqtt-0.1.2 → dbus2mqtt-0.3.0}/src/dbus2mqtt/dbus/dbus_util.py +2 -2
- dbus2mqtt-0.3.0/src/dbus2mqtt/dbus/introspection_patches/mpris_playerctl.py +151 -0
- dbus2mqtt-0.3.0/src/dbus2mqtt/dbus/introspection_patches/mpris_vlc.py +122 -0
- {dbus2mqtt-0.1.2 → dbus2mqtt-0.3.0}/src/dbus2mqtt/event_broker.py +1 -1
- {dbus2mqtt-0.1.2 → dbus2mqtt-0.3.0}/src/dbus2mqtt/flow/__init__.py +22 -3
- {dbus2mqtt-0.1.2 → dbus2mqtt-0.3.0}/src/dbus2mqtt/flow/actions/context_set.py +2 -0
- {dbus2mqtt-0.1.2 → dbus2mqtt-0.3.0}/src/dbus2mqtt/flow/actions/mqtt_publish.py +24 -6
- {dbus2mqtt-0.1.2 → dbus2mqtt-0.3.0}/src/dbus2mqtt/flow/flow_processor.py +28 -26
- {dbus2mqtt-0.1.2 → dbus2mqtt-0.3.0}/src/dbus2mqtt/main.py +12 -18
- {dbus2mqtt-0.1.2 → dbus2mqtt-0.3.0}/src/dbus2mqtt/mqtt/mqtt_client.py +40 -24
- {dbus2mqtt-0.1.2 → dbus2mqtt-0.3.0}/src/dbus2mqtt/template/dbus_template_functions.py +2 -2
- dbus2mqtt-0.3.0/src/dbus2mqtt/template/templating.py +106 -0
- {dbus2mqtt-0.1.2 → dbus2mqtt-0.3.0}/tests/__init__.py +9 -11
- dbus2mqtt-0.3.0/tests/config/fixtures/payload_template_jinja_expressions.yaml +19 -0
- dbus2mqtt-0.3.0/tests/config/fixtures/payload_template_off.yaml +14 -0
- dbus2mqtt-0.3.0/tests/config/fixtures/schedule_cron_trigger.yaml +9 -0
- dbus2mqtt-0.3.0/tests/config/test_config.py +70 -0
- {dbus2mqtt-0.1.2 → dbus2mqtt-0.3.0}/tests/config/test_examples.py +3 -4
- {dbus2mqtt-0.1.2 → dbus2mqtt-0.3.0}/tests/dbus/test_dbus_client.py +10 -8
- {dbus2mqtt-0.1.2 → dbus2mqtt-0.3.0}/tests/flow/actions/test_context_set.py +1 -0
- {dbus2mqtt-0.1.2 → dbus2mqtt-0.3.0}/tests/flow/triggers/test_dbus_client_triggers.py +14 -6
- dbus2mqtt-0.3.0/tests/template/test_templating.py +145 -0
- dbus2mqtt-0.3.0/tests/template/test_templating_config.py +87 -0
- {dbus2mqtt-0.1.2 → dbus2mqtt-0.3.0}/uv.lock +342 -310
- dbus2mqtt-0.1.2/.github/release-drafter.yml +0 -34
- dbus2mqtt-0.1.2/.python-version +0 -1
- dbus2mqtt-0.1.2/config-test.yaml +0 -141
- dbus2mqtt-0.1.2/src/dbus2mqtt/template/templating.py +0 -129
- dbus2mqtt-0.1.2/tests/template/test_templating.py +0 -55
- {dbus2mqtt-0.1.2 → dbus2mqtt-0.3.0}/.dockerignore +0 -0
- {dbus2mqtt-0.1.2 → dbus2mqtt-0.3.0}/.env.example +0 -0
- {dbus2mqtt-0.1.2 → dbus2mqtt-0.3.0}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {dbus2mqtt-0.1.2 → dbus2mqtt-0.3.0}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {dbus2mqtt-0.1.2 → dbus2mqtt-0.3.0}/.github/workflows/release-drafter.yml +0 -0
- {dbus2mqtt-0.1.2 → dbus2mqtt-0.3.0}/.gitignore +0 -0
- {dbus2mqtt-0.1.2 → dbus2mqtt-0.3.0}/.vscode/launch.json +0 -0
- {dbus2mqtt-0.1.2 → dbus2mqtt-0.3.0}/.vscode/settings.json +0 -0
- {dbus2mqtt-0.1.2 → dbus2mqtt-0.3.0}/.yamllint.yml +0 -0
- {dbus2mqtt-0.1.2 → dbus2mqtt-0.3.0}/LICENSE +0 -0
- {dbus2mqtt-0.1.2 → dbus2mqtt-0.3.0}/docs/debugging.md +0 -0
- {dbus2mqtt-0.1.2 → dbus2mqtt-0.3.0}/docs/examples/linux_desktop.md +0 -0
- {dbus2mqtt-0.1.2 → dbus2mqtt-0.3.0}/src/dbus2mqtt/__init__.py +0 -0
- {dbus2mqtt-0.1.2 → dbus2mqtt-0.3.0}/src/dbus2mqtt/__main__.py +0 -0
- {dbus2mqtt-0.1.2 → dbus2mqtt-0.3.0}/tests/flow/actions/test_mqtt_publish.py +0 -0
- {dbus2mqtt-0.1.2 → dbus2mqtt-0.3.0}/tests/flow/test_flow_processor.py +0 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
name-template: 'v$RESOLVED_VERSION 🌈'
|
|
2
|
+
tag-template: 'v$RESOLVED_VERSION'
|
|
3
|
+
exclude-labels:
|
|
4
|
+
- dependencies
|
|
5
|
+
categories:
|
|
6
|
+
- title: 🚨 Breaking changes
|
|
7
|
+
labels:
|
|
8
|
+
- breaking-change
|
|
9
|
+
- title: 🚀 Features
|
|
10
|
+
labels:
|
|
11
|
+
- feature
|
|
12
|
+
- enhancement
|
|
13
|
+
- title: 🐛 Bug Fixes
|
|
14
|
+
labels:
|
|
15
|
+
- bugfix
|
|
16
|
+
- title: 🧰 Maintenance
|
|
17
|
+
labels:
|
|
18
|
+
- chore
|
|
19
|
+
- documentation
|
|
20
|
+
- title: ⬆️ Dependency updates
|
|
21
|
+
labels:
|
|
22
|
+
- "dependencies"
|
|
23
|
+
exclude-contributors:
|
|
24
|
+
- jwnmulder
|
|
25
|
+
autolabeler:
|
|
26
|
+
- label: enhancement
|
|
27
|
+
branch:
|
|
28
|
+
- '/feature\/.+/'
|
|
29
|
+
- label: fix
|
|
30
|
+
branch:
|
|
31
|
+
- '/fix\/.+/'
|
|
32
|
+
title:
|
|
33
|
+
- '/fix/i'
|
|
34
|
+
version-resolver:
|
|
35
|
+
major:
|
|
36
|
+
labels:
|
|
37
|
+
- major
|
|
38
|
+
minor:
|
|
39
|
+
labels:
|
|
40
|
+
- minor
|
|
41
|
+
- feature
|
|
42
|
+
- enhancement
|
|
43
|
+
- breaking-change # minor until we are on 1.x
|
|
44
|
+
patch:
|
|
45
|
+
labels:
|
|
46
|
+
- patch
|
|
47
|
+
default: patch
|
|
48
|
+
change-template: '* $TITLE (#$NUMBER)'
|
|
49
|
+
template: |
|
|
50
|
+
## Changes
|
|
51
|
+
|
|
52
|
+
$CHANGES
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
import json
|
|
3
|
+
import subprocess
|
|
4
|
+
import sys
|
|
5
|
+
|
|
6
|
+
from packaging import version
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def get_versions_from_git_tags() -> list[version.Version]:
|
|
10
|
+
result = subprocess.run(
|
|
11
|
+
["git", "tag"],
|
|
12
|
+
capture_output=True, text=True, check=True
|
|
13
|
+
)
|
|
14
|
+
tags = result.stdout.strip().splitlines()
|
|
15
|
+
versions = [t.lstrip("v") for t in tags if t.startswith("v")]
|
|
16
|
+
|
|
17
|
+
parsed_versions = []
|
|
18
|
+
for v in versions:
|
|
19
|
+
try:
|
|
20
|
+
parsed = version.parse(v)
|
|
21
|
+
parsed_versions.append(parsed)
|
|
22
|
+
except Exception as e:
|
|
23
|
+
print(f"Error parsing version {v}: {e}")
|
|
24
|
+
|
|
25
|
+
return parsed_versions
|
|
26
|
+
|
|
27
|
+
def latest_version_by_cycle(versions: list[version.Version], cycles: list[str]) -> dict[str, version.Version]:
|
|
28
|
+
res = {}
|
|
29
|
+
for cycle in cycles:
|
|
30
|
+
parsed_cycle = version.parse(cycle)
|
|
31
|
+
|
|
32
|
+
for v in versions:
|
|
33
|
+
# check if version is in cycle range
|
|
34
|
+
# cycle can be major or major.minor or major.minor.patch
|
|
35
|
+
if len(v.release) > len(parsed_cycle.release):
|
|
36
|
+
# update if version is later within cycle
|
|
37
|
+
if cycle not in cycles or v > parsed_cycle:
|
|
38
|
+
res[cycle] = v
|
|
39
|
+
return res
|
|
40
|
+
|
|
41
|
+
def main():
|
|
42
|
+
args = sys.argv[1:]
|
|
43
|
+
if not args:
|
|
44
|
+
print("Usage: release-versions.py 0.1 0.2 1.0 ...")
|
|
45
|
+
sys.exit(1)
|
|
46
|
+
|
|
47
|
+
versions = get_versions_from_git_tags()
|
|
48
|
+
cycles = latest_version_by_cycle(versions, args)
|
|
49
|
+
|
|
50
|
+
# Detect the overall latest version
|
|
51
|
+
overall_latest = max(versions) if versions else None
|
|
52
|
+
|
|
53
|
+
cycle_details = []
|
|
54
|
+
for cycle in args:
|
|
55
|
+
latest = cycles.get(cycle)
|
|
56
|
+
if latest:
|
|
57
|
+
cycle_details.append({
|
|
58
|
+
"cycle": cycle,
|
|
59
|
+
"latestVersion": latest.base_version,
|
|
60
|
+
"isLatestStable": latest == overall_latest
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
print(json.dumps(cycle_details))
|
|
64
|
+
|
|
65
|
+
if __name__ == "__main__":
|
|
66
|
+
main()
|
|
@@ -24,14 +24,17 @@ jobs:
|
|
|
24
24
|
- uses: actions/checkout@v4
|
|
25
25
|
|
|
26
26
|
- name: Install uv
|
|
27
|
-
uses: astral-sh/setup-uv@
|
|
27
|
+
uses: astral-sh/setup-uv@v6
|
|
28
28
|
with:
|
|
29
|
+
activate-environment: true
|
|
29
30
|
enable-cache: true
|
|
30
|
-
|
|
31
|
-
- name: "Set up Python"
|
|
32
|
-
uses: actions/setup-python@v5
|
|
33
|
-
with:
|
|
34
31
|
python-version: ${{ matrix.python-version }}
|
|
35
32
|
|
|
33
|
+
# - name: "Set up Python"
|
|
34
|
+
# uses: actions/setup-python@v5
|
|
35
|
+
# with:
|
|
36
|
+
# python-version: ${{ matrix.python-version }}
|
|
37
|
+
|
|
36
38
|
- name: Run tests
|
|
37
|
-
run: uv run
|
|
39
|
+
run: uv run pytest
|
|
40
|
+
# run: uv run --python ${{ matrix.python-version }} pytest
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
name:
|
|
1
|
+
name: docker-dev
|
|
2
2
|
|
|
3
3
|
"on":
|
|
4
4
|
push:
|
|
5
5
|
branches:
|
|
6
6
|
- main
|
|
7
|
+
paths-ignore:
|
|
8
|
+
- 'docs/**'
|
|
9
|
+
- '.pre-commit-config.yaml'
|
|
7
10
|
workflow_dispatch:
|
|
8
11
|
|
|
9
12
|
jobs:
|
|
@@ -16,14 +19,14 @@ jobs:
|
|
|
16
19
|
uses: actions/checkout@v4
|
|
17
20
|
|
|
18
21
|
- name: Install uv
|
|
19
|
-
uses: astral-sh/setup-uv@
|
|
22
|
+
uses: astral-sh/setup-uv@v6
|
|
20
23
|
with:
|
|
21
24
|
enable-cache: true
|
|
22
25
|
|
|
23
|
-
- name: "Set up Python"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
# - name: "Set up Python"
|
|
27
|
+
# uses: actions/setup-python@v5
|
|
28
|
+
# with:
|
|
29
|
+
# python-version-file: ".python-version"
|
|
27
30
|
|
|
28
31
|
- name: Determine version from hatch
|
|
29
32
|
id: version
|
|
@@ -37,7 +40,7 @@ jobs:
|
|
|
37
40
|
jwnmulder/dbus2mqtt
|
|
38
41
|
ghcr.io/jwnmulder/dbus2mqtt
|
|
39
42
|
tags: |
|
|
40
|
-
type=raw,value=
|
|
43
|
+
type=raw,value=dev,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
|
|
41
44
|
labels: |
|
|
42
45
|
org.opencontainers.image.source=https://github.com/jwnmulder/dbus2mqtt
|
|
43
46
|
|
|
@@ -66,7 +69,7 @@ jobs:
|
|
|
66
69
|
uses: docker/build-push-action@v6
|
|
67
70
|
with:
|
|
68
71
|
context: .
|
|
69
|
-
file: ./docker/Dockerfile.
|
|
72
|
+
file: ./docker/Dockerfile.dev
|
|
70
73
|
push: ${{ github.event_name != 'pull_request' }}
|
|
71
74
|
tags: ${{ steps.meta.outputs.tags }}
|
|
72
75
|
labels: ${{ steps.meta.outputs.labels }}
|
|
@@ -1,20 +1,46 @@
|
|
|
1
|
-
name:
|
|
1
|
+
name: docker-stable releases
|
|
2
2
|
|
|
3
3
|
"on":
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
paths:
|
|
8
|
+
- "docker/**"
|
|
9
|
+
release:
|
|
10
|
+
types: [published]
|
|
7
11
|
workflow_dispatch:
|
|
8
12
|
|
|
9
13
|
jobs:
|
|
14
|
+
setup:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
outputs:
|
|
17
|
+
versions_matrix: ${{ steps.supported_release_versions.outputs.versions_matrix }}
|
|
18
|
+
steps:
|
|
19
|
+
- name: Checkout
|
|
20
|
+
uses: actions/checkout@v4
|
|
21
|
+
with:
|
|
22
|
+
fetch-depth: 0
|
|
23
|
+
|
|
24
|
+
- name: Determine supported release versions
|
|
25
|
+
id: supported_release_versions
|
|
26
|
+
run: |
|
|
27
|
+
SUPPORTED_CYCLES=("0.1" "0.2" "0.3" "0.4" "0.5" "0.6" "0.7" "0.8" "0.9" "1.0" "2.0")
|
|
28
|
+
|
|
29
|
+
VERSIONS_JSON=$(python3 .github/scripts/release-versions.py "${SUPPORTED_CYCLES[@]}")
|
|
30
|
+
|
|
31
|
+
# Wrap the output into matrix include
|
|
32
|
+
VERSIONS_MATRIX=$(echo "$VERSIONS_JSON" | jq -c '{include: [.[] | {cycle: .cycle, version: .latestVersion, isLatestStable: .isLatestStable}]}')
|
|
33
|
+
|
|
34
|
+
echo "VERSIONS_MATRIX=$VERSIONS_MATRIX"
|
|
35
|
+
echo "versions_matrix=$VERSIONS_MATRIX" >> $GITHUB_OUTPUT
|
|
10
36
|
docker:
|
|
11
37
|
runs-on: ubuntu-latest
|
|
38
|
+
needs: setup
|
|
12
39
|
permissions:
|
|
13
40
|
packages: write
|
|
14
41
|
strategy:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
- 0.1
|
|
42
|
+
fail-fast: false
|
|
43
|
+
matrix: ${{ fromJson(needs.setup.outputs.versions_matrix) }}
|
|
18
44
|
|
|
19
45
|
steps:
|
|
20
46
|
- name: Checkout
|
|
@@ -28,8 +54,10 @@ jobs:
|
|
|
28
54
|
jwnmulder/dbus2mqtt
|
|
29
55
|
ghcr.io/jwnmulder/dbus2mqtt
|
|
30
56
|
tags: |
|
|
57
|
+
type=raw,value=latest,enable=${{ matrix.isLatestStable }}
|
|
31
58
|
type=pep440,pattern={{major}},value=${{ matrix.version }},enable=${{ !startsWith(matrix.version, '0.') }}
|
|
32
59
|
type=pep440,pattern={{major}}.{{minor}},value=${{ matrix.version }}
|
|
60
|
+
type=pep440,pattern={{major}}.{{minor}}.{{patch}},value=${{ matrix.version }}
|
|
33
61
|
# type=ref,event=branch
|
|
34
62
|
# type=ref,event=pr
|
|
35
63
|
# type=semver,pattern={{version}},value=${{ matrix.version }}
|
|
@@ -16,12 +16,12 @@ jobs:
|
|
|
16
16
|
- uses: actions/checkout@v4
|
|
17
17
|
|
|
18
18
|
- name: Install uv
|
|
19
|
-
uses: astral-sh/setup-uv@
|
|
19
|
+
uses: astral-sh/setup-uv@v6
|
|
20
20
|
|
|
21
|
-
- name: "Set up Python"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
# - name: "Set up Python"
|
|
22
|
+
# uses: actions/setup-python@v5
|
|
23
|
+
# with:
|
|
24
|
+
# python-version-file: ".python-version"
|
|
25
25
|
|
|
26
26
|
- name: Uv sync
|
|
27
27
|
run: uv sync
|
|
@@ -17,14 +17,15 @@ jobs:
|
|
|
17
17
|
persist-credentials: false
|
|
18
18
|
|
|
19
19
|
- name: Install uv
|
|
20
|
-
uses: astral-sh/setup-uv@
|
|
20
|
+
uses: astral-sh/setup-uv@v6
|
|
21
21
|
with:
|
|
22
|
+
activate-environment: true
|
|
22
23
|
enable-cache: true
|
|
23
24
|
|
|
24
|
-
- name: "Set up Python"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
# - name: "Set up Python"
|
|
26
|
+
# uses: actions/setup-python@v5
|
|
27
|
+
# with:
|
|
28
|
+
# python-version-file: ".python-version"
|
|
28
29
|
|
|
29
30
|
- name: Build
|
|
30
31
|
run: uv build
|
|
@@ -26,14 +26,14 @@ repos:
|
|
|
26
26
|
- id: codespell
|
|
27
27
|
|
|
28
28
|
- repo: https://github.com/adrienverge/yamllint.git
|
|
29
|
-
rev: v1.37.
|
|
29
|
+
rev: v1.37.1
|
|
30
30
|
hooks:
|
|
31
31
|
- id: yamllint
|
|
32
32
|
args:
|
|
33
33
|
- --strict
|
|
34
34
|
|
|
35
35
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
36
|
-
rev: v0.11.
|
|
36
|
+
rev: v0.11.9
|
|
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.
|
|
45
|
+
rev: 0.7.3
|
|
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.400
|
|
51
51
|
hooks:
|
|
52
52
|
- id: pyright
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.10
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dbus2mqtt
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
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
5
|
Project-URL: Repository, https://github.com/jwnmulder/dbus2mqtt.git
|
|
6
6
|
Project-URL: Issues, https://github.com/jwnmulder/dbus2mqtt/issues
|
|
@@ -19,7 +19,7 @@ Classifier: Programming Language :: Python :: 3.13
|
|
|
19
19
|
Requires-Python: >=3.10
|
|
20
20
|
Requires-Dist: apscheduler>=3.11.0
|
|
21
21
|
Requires-Dist: colorlog>=6.9.0
|
|
22
|
-
Requires-Dist: dbus-
|
|
22
|
+
Requires-Dist: dbus-fast>=2.44.1
|
|
23
23
|
Requires-Dist: janus>=2.0.0
|
|
24
24
|
Requires-Dist: jinja2-ansible-filters>=1.3.2
|
|
25
25
|
Requires-Dist: jinja2>=3.1.6
|
|
@@ -51,12 +51,6 @@ This makes it easy to integrate Linux desktop services or system signals into MQ
|
|
|
51
51
|
|
|
52
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)
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
TODO list
|
|
56
|
-
|
|
57
|
-
* Improve error handling when deleting message with 'retain' set. WARNING:dbus2mqtt.mqtt_client:on_message: Unexpected payload, expecting json, topic=dbus2mqtt/org.mpris.MediaPlayer2/command, payload=, error=Expecting value: line 1 column 1 (char 0)
|
|
58
|
-
* Property set only works the first time, need to restart after which the first set will work again
|
|
59
|
-
|
|
60
54
|
## Getting started with dbus2mqtt
|
|
61
55
|
|
|
62
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](docs/examples.md) for more examples
|
|
@@ -86,7 +80,7 @@ dbus:
|
|
|
86
80
|
topic: dbus2mqtt/org.mpris.MediaPlayer2/state
|
|
87
81
|
payload_type: json
|
|
88
82
|
payload_template: |
|
|
89
|
-
{{ dbus_call(mpris_bus_name, path, 'org.freedesktop.DBus.Properties', 'GetAll', ['org.mpris.MediaPlayer2.Player'])
|
|
83
|
+
{{ dbus_call(mpris_bus_name, path, 'org.freedesktop.DBus.Properties', 'GetAll', ['org.mpris.MediaPlayer2.Player']) }}
|
|
90
84
|
```
|
|
91
85
|
|
|
92
86
|
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.
|
|
@@ -117,6 +111,7 @@ cp docs/examples/home_assistant_media_player.yaml $HOME/.config/dbus2mqtt/config
|
|
|
117
111
|
cp .env.example $HOME/.config/dbus2mqtt/.env
|
|
118
112
|
|
|
119
113
|
# run image and automatically start on reboot
|
|
114
|
+
docker pull jwnmulder/dbus2mqtt
|
|
120
115
|
docker run --detach --name dbus2mqtt \
|
|
121
116
|
--volume "$HOME"/.config/dbus2mqtt:"$HOME"/.config/dbus2mqtt \
|
|
122
117
|
--volume /run/user:/run/user \
|
|
@@ -143,7 +138,7 @@ dbus2mqtt leverages [jsonargparse](https://jsonargparse.readthedocs.io/en/stable
|
|
|
143
138
|
### MQTT and D-Bus connection details
|
|
144
139
|
|
|
145
140
|
```bash
|
|
146
|
-
#
|
|
141
|
+
# dbus_fast configuration
|
|
147
142
|
export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
|
|
148
143
|
|
|
149
144
|
# dbus2mqtt configuration
|
|
@@ -170,13 +165,15 @@ dbus:
|
|
|
170
165
|
path: /org/mpris/MediaPlayer2
|
|
171
166
|
interfaces:
|
|
172
167
|
- interface: org.mpris.MediaPlayer2.Player
|
|
173
|
-
|
|
168
|
+
mqtt_command_topic: dbus2mqtt/org.mpris.MediaPlayer2/command
|
|
174
169
|
methods:
|
|
175
170
|
- method: Pause
|
|
176
171
|
- method: Play
|
|
177
172
|
```
|
|
178
173
|
|
|
179
|
-
This configuration will expose 2 methods. Triggering methods can be done by publishing json messages to the `dbus2mqtt/org.mpris.MediaPlayer2/command` MQTT topic. Arguments can be passed along in `args
|
|
174
|
+
This configuration will expose 2 methods. Triggering methods can be done by publishing json messages to the `dbus2mqtt/org.mpris.MediaPlayer2/command` MQTT topic. Arguments can be passed along in `args`.
|
|
175
|
+
|
|
176
|
+
Note that methods are called on **all** bus_names matching the configured pattern
|
|
180
177
|
|
|
181
178
|
```json
|
|
182
179
|
{
|
|
@@ -19,12 +19,6 @@ This makes it easy to integrate Linux desktop services or system signals into MQ
|
|
|
19
19
|
|
|
20
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)
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
TODO list
|
|
24
|
-
|
|
25
|
-
* Improve error handling when deleting message with 'retain' set. WARNING:dbus2mqtt.mqtt_client:on_message: Unexpected payload, expecting json, topic=dbus2mqtt/org.mpris.MediaPlayer2/command, payload=, error=Expecting value: line 1 column 1 (char 0)
|
|
26
|
-
* Property set only works the first time, need to restart after which the first set will work again
|
|
27
|
-
|
|
28
22
|
## Getting started with dbus2mqtt
|
|
29
23
|
|
|
30
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](docs/examples.md) for more examples
|
|
@@ -54,7 +48,7 @@ dbus:
|
|
|
54
48
|
topic: dbus2mqtt/org.mpris.MediaPlayer2/state
|
|
55
49
|
payload_type: json
|
|
56
50
|
payload_template: |
|
|
57
|
-
{{ dbus_call(mpris_bus_name, path, 'org.freedesktop.DBus.Properties', 'GetAll', ['org.mpris.MediaPlayer2.Player'])
|
|
51
|
+
{{ dbus_call(mpris_bus_name, path, 'org.freedesktop.DBus.Properties', 'GetAll', ['org.mpris.MediaPlayer2.Player']) }}
|
|
58
52
|
```
|
|
59
53
|
|
|
60
54
|
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.
|
|
@@ -85,6 +79,7 @@ cp docs/examples/home_assistant_media_player.yaml $HOME/.config/dbus2mqtt/config
|
|
|
85
79
|
cp .env.example $HOME/.config/dbus2mqtt/.env
|
|
86
80
|
|
|
87
81
|
# run image and automatically start on reboot
|
|
82
|
+
docker pull jwnmulder/dbus2mqtt
|
|
88
83
|
docker run --detach --name dbus2mqtt \
|
|
89
84
|
--volume "$HOME"/.config/dbus2mqtt:"$HOME"/.config/dbus2mqtt \
|
|
90
85
|
--volume /run/user:/run/user \
|
|
@@ -111,7 +106,7 @@ dbus2mqtt leverages [jsonargparse](https://jsonargparse.readthedocs.io/en/stable
|
|
|
111
106
|
### MQTT and D-Bus connection details
|
|
112
107
|
|
|
113
108
|
```bash
|
|
114
|
-
#
|
|
109
|
+
# dbus_fast configuration
|
|
115
110
|
export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
|
|
116
111
|
|
|
117
112
|
# dbus2mqtt configuration
|
|
@@ -138,13 +133,15 @@ dbus:
|
|
|
138
133
|
path: /org/mpris/MediaPlayer2
|
|
139
134
|
interfaces:
|
|
140
135
|
- interface: org.mpris.MediaPlayer2.Player
|
|
141
|
-
|
|
136
|
+
mqtt_command_topic: dbus2mqtt/org.mpris.MediaPlayer2/command
|
|
142
137
|
methods:
|
|
143
138
|
- method: Pause
|
|
144
139
|
- method: Play
|
|
145
140
|
```
|
|
146
141
|
|
|
147
|
-
This configuration will expose 2 methods. Triggering methods can be done by publishing json messages to the `dbus2mqtt/org.mpris.MediaPlayer2/command` MQTT topic. Arguments can be passed along in `args
|
|
142
|
+
This configuration will expose 2 methods. Triggering methods can be done by publishing json messages to the `dbus2mqtt/org.mpris.MediaPlayer2/command` MQTT topic. Arguments can be passed along in `args`.
|
|
143
|
+
|
|
144
|
+
Note that methods are called on **all** bus_names matching the configured pattern
|
|
148
145
|
|
|
149
146
|
```json
|
|
150
147
|
{
|
|
@@ -20,7 +20,7 @@ RUN --mount=type=cache,target=/root/.cache/uv \
|
|
|
20
20
|
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
|
|
21
21
|
uv sync --frozen --no-install-project --no-dev
|
|
22
22
|
|
|
23
|
-
ADD src/ pyproject.toml uv.lock
|
|
23
|
+
ADD src/ pyproject.toml uv.lock README.md /app
|
|
24
24
|
RUN --mount=type=cache,target=/root/.cache/uv \
|
|
25
25
|
uv sync --frozen --no-dev
|
|
26
26
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# dbus2mqtt internal state example
|
|
2
|
+
|
|
3
|
+
Execute the following command to run dbus2mqtt with the example configuration in this repository.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
dbus2mqtt --config docs/examples/dbus2mqtt_internal_state.yaml
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
This will publish the dbus2mqtt's internal state to the `dbus2mqtt/state` MQTT topic every 5 seconds
|
|
10
|
+
|
|
11
|
+
```json
|
|
12
|
+
{"now": "2025-04-23T16:01:34.985452", "dbus_list": ["org.freedesktop.systemd1", "org.gnome.SessionManager"]}
|
|
13
|
+
```
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# mqtt:
|
|
2
|
+
# host:
|
|
3
|
+
# port:
|
|
4
|
+
|
|
5
|
+
dbus:
|
|
6
|
+
subscriptions:
|
|
7
|
+
|
|
8
|
+
# https://manpages.ubuntu.com/manpages/lunar/man5/org.freedesktop.systemd1.5.html
|
|
9
|
+
- bus_name: org.freedesktop.systemd1
|
|
10
|
+
path: /org/freedesktop/systemd1
|
|
11
|
+
interfaces:
|
|
12
|
+
- interface: org.freedesktop.DBus.Properties
|
|
13
|
+
signals:
|
|
14
|
+
- signal: PropertiesChanged
|
|
15
|
+
methods:
|
|
16
|
+
- method: GetAll
|
|
17
|
+
|
|
18
|
+
# https://lira.no-ip.org:8443/doc/gnome-session/dbus/gnome-session.html
|
|
19
|
+
- bus_name: org.gnome.SessionManager
|
|
20
|
+
path: /org/gnome/SessionManager
|
|
21
|
+
interfaces:
|
|
22
|
+
- interface: org.freedesktop.DBus.Properties
|
|
23
|
+
signals:
|
|
24
|
+
- signal: PropertiesChanged
|
|
25
|
+
methods:
|
|
26
|
+
- method: GetAll
|
|
27
|
+
|
|
28
|
+
flows:
|
|
29
|
+
- name: "publish internal state"
|
|
30
|
+
triggers:
|
|
31
|
+
- type: bus_name_added
|
|
32
|
+
- type: schedule
|
|
33
|
+
interval: {seconds: 5}
|
|
34
|
+
actions:
|
|
35
|
+
- type: mqtt_publish
|
|
36
|
+
topic: dbus2mqtt/state
|
|
37
|
+
payload_type: json
|
|
38
|
+
payload_template:
|
|
39
|
+
now: "{{ now().isoformat() }}"
|
|
40
|
+
dbus_list: "{{ dbus_list('*') }}"
|