updates2mqtt 1.3.6__tar.gz → 1.4.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.
- {updates2mqtt-1.3.6 → updates2mqtt-1.4.0}/.github/dependabot.yml +6 -0
- {updates2mqtt-1.3.6 → updates2mqtt-1.4.0}/.github/workflows/docker-publish.yml +1 -1
- {updates2mqtt-1.3.6 → updates2mqtt-1.4.0}/.github/workflows/pypi-publish.yml +3 -3
- {updates2mqtt-1.3.6 → updates2mqtt-1.4.0}/.github/workflows/python-package.yml +3 -1
- {updates2mqtt-1.3.6 → updates2mqtt-1.4.0}/.pre-commit-config.yaml +5 -5
- {updates2mqtt-1.3.6 → updates2mqtt-1.4.0}/CHANGELOG.md +9 -0
- {updates2mqtt-1.3.6 → updates2mqtt-1.4.0}/Dockerfile +1 -1
- {updates2mqtt-1.3.6 → updates2mqtt-1.4.0}/PKG-INFO +71 -24
- updates2mqtt-1.4.0/README.md +124 -0
- {updates2mqtt-1.3.6 → updates2mqtt-1.4.0}/docs/configuration.md +50 -19
- updates2mqtt-1.4.0/docs/home_assistant.md +34 -0
- updates2mqtt-1.4.0/docs/images/ha_entities.png +0 -0
- updates2mqtt-1.4.0/docs/images/ha_update_dialog.png +0 -0
- updates2mqtt-1.4.0/docs/images/logo-blank-256x256.png +0 -0
- {updates2mqtt-1.3.6 → updates2mqtt-1.4.0}/docs/installation.md +15 -0
- updates2mqtt-1.4.0/docs/troubleshooting.md +93 -0
- {updates2mqtt-1.3.6 → updates2mqtt-1.4.0}/examples/config.yaml.maximal +1 -0
- {updates2mqtt-1.3.6 → updates2mqtt-1.4.0}/mkdocs.yml +24 -1
- {updates2mqtt-1.3.6 → updates2mqtt-1.4.0}/pyproject.toml +11 -4
- {updates2mqtt-1.3.6 → updates2mqtt-1.4.0}/src/updates2mqtt/config.py +5 -7
- {updates2mqtt-1.3.6 → updates2mqtt-1.4.0}/src/updates2mqtt/integrations/docker.py +1 -1
- {updates2mqtt-1.3.6 → updates2mqtt-1.4.0}/src/updates2mqtt/integrations/git_utils.py +3 -1
- {updates2mqtt-1.3.6 → updates2mqtt-1.4.0}/src/updates2mqtt/mqtt.py +48 -4
- {updates2mqtt-1.3.6 → updates2mqtt-1.4.0}/tests/test_docker.py +8 -7
- {updates2mqtt-1.3.6 → updates2mqtt-1.4.0}/tests/test_mqtt.py +3 -2
- {updates2mqtt-1.3.6 → updates2mqtt-1.4.0}/uv.lock +267 -128
- updates2mqtt-1.3.6/README.md +0 -79
- {updates2mqtt-1.3.6 → updates2mqtt-1.4.0}/.dockerignore +0 -0
- {updates2mqtt-1.3.6 → updates2mqtt-1.4.0}/.gitignore +0 -0
- {updates2mqtt-1.3.6 → updates2mqtt-1.4.0}/.hintrc +0 -0
- {updates2mqtt-1.3.6 → updates2mqtt-1.4.0}/.python-version +0 -0
- {updates2mqtt-1.3.6 → updates2mqtt-1.4.0}/.safety-project.ini +0 -0
- {updates2mqtt-1.3.6 → updates2mqtt-1.4.0}/LICENSE +0 -0
- {updates2mqtt-1.3.6 → updates2mqtt-1.4.0}/SECURITY.md +0 -0
- {updates2mqtt-1.3.6 → updates2mqtt-1.4.0}/common_packages.yaml +0 -0
- {updates2mqtt-1.3.6 → updates2mqtt-1.4.0}/conftest.py +0 -0
- {updates2mqtt-1.3.6 → updates2mqtt-1.4.0}/docs/examples/config_maximal.md +0 -0
- {updates2mqtt-1.3.6 → updates2mqtt-1.4.0}/docs/examples/config_minimal.md +0 -0
- {updates2mqtt-1.3.6 → updates2mqtt-1.4.0}/docs/examples/docker_compose.md +0 -0
- {updates2mqtt-1.3.6 → updates2mqtt-1.4.0}/docs/images/ha_mqtt_discovery.png +0 -0
- {updates2mqtt-1.3.6 → updates2mqtt-1.4.0}/docs/images/ha_update_detail.png +0 -0
- {updates2mqtt-1.3.6 → updates2mqtt-1.4.0}/docs/images/ha_update_page.png +0 -0
- {updates2mqtt-1.3.6 → updates2mqtt-1.4.0}/docs/index.md +0 -0
- {updates2mqtt-1.3.6 → updates2mqtt-1.4.0}/docs/local_builds.md +0 -0
- {updates2mqtt-1.3.6 → updates2mqtt-1.4.0}/examples/config.yaml.minimal +0 -0
- {updates2mqtt-1.3.6 → updates2mqtt-1.4.0}/examples/docker-compose.yaml +0 -0
- {updates2mqtt-1.3.6 → updates2mqtt-1.4.0}/no_config.yaml +0 -0
- {updates2mqtt-1.3.6 → updates2mqtt-1.4.0}/refresh-deps.sh +0 -0
- {updates2mqtt-1.3.6 → updates2mqtt-1.4.0}/scripts/healthcheck.sh +0 -0
- {updates2mqtt-1.3.6 → updates2mqtt-1.4.0}/src/updates2mqtt/__init__.py +0 -0
- {updates2mqtt-1.3.6 → updates2mqtt-1.4.0}/src/updates2mqtt/__main__.py +0 -0
- {updates2mqtt-1.3.6 → updates2mqtt-1.4.0}/src/updates2mqtt/app.py +0 -0
- {updates2mqtt-1.3.6 → updates2mqtt-1.4.0}/src/updates2mqtt/hass_formatter.py +0 -0
- {updates2mqtt-1.3.6 → updates2mqtt-1.4.0}/src/updates2mqtt/integrations/__init__.py +0 -0
- {updates2mqtt-1.3.6 → updates2mqtt-1.4.0}/src/updates2mqtt/model.py +0 -0
- {updates2mqtt-1.3.6 → updates2mqtt-1.4.0}/src/updates2mqtt/py.typed +0 -0
- {updates2mqtt-1.3.6 → updates2mqtt-1.4.0}/tests/__init__.py +0 -0
- {updates2mqtt-1.3.6 → updates2mqtt-1.4.0}/tests/test_config.py +0 -0
- {updates2mqtt-1.3.6 → updates2mqtt-1.4.0}/tests/test_git_utils.py +0 -0
|
@@ -9,16 +9,22 @@ updates:
|
|
|
9
9
|
directory: "/" # Location of package manifests
|
|
10
10
|
schedule:
|
|
11
11
|
interval: "weekly"
|
|
12
|
+
cooldown:
|
|
13
|
+
default-days: 7
|
|
12
14
|
|
|
13
15
|
- package-ecosystem: "github-actions"
|
|
14
16
|
directory: "/"
|
|
15
17
|
schedule:
|
|
16
18
|
interval: "monthly"
|
|
19
|
+
cooldown:
|
|
20
|
+
default-days: 7
|
|
17
21
|
|
|
18
22
|
- package-ecosystem: "docker"
|
|
19
23
|
directory: "/"
|
|
20
24
|
schedule:
|
|
21
25
|
interval: "weekly"
|
|
26
|
+
cooldown:
|
|
27
|
+
default-days: 7
|
|
22
28
|
|
|
23
29
|
|
|
24
30
|
|
|
@@ -42,7 +42,7 @@ jobs:
|
|
|
42
42
|
uses: docker/setup-buildx-action@v3
|
|
43
43
|
- name: Extract metadata (tags, labels) for Docker
|
|
44
44
|
id: meta
|
|
45
|
-
uses: docker/metadata-action@
|
|
45
|
+
uses: docker/metadata-action@8d8c7c12f7b958582a5cb82ba16d5903cb27976a
|
|
46
46
|
with:
|
|
47
47
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
48
48
|
tags: |
|
|
@@ -22,7 +22,7 @@ jobs:
|
|
|
22
22
|
- name: Build a binary wheel and a source tarball
|
|
23
23
|
run: uv build
|
|
24
24
|
- name: Store the distribution packages
|
|
25
|
-
uses: actions/upload-artifact@
|
|
25
|
+
uses: actions/upload-artifact@v5
|
|
26
26
|
with:
|
|
27
27
|
name: python-package-distributions
|
|
28
28
|
path: dist/
|
|
@@ -42,7 +42,7 @@ jobs:
|
|
|
42
42
|
|
|
43
43
|
steps:
|
|
44
44
|
- name: Download all the dists
|
|
45
|
-
uses: actions/download-artifact@
|
|
45
|
+
uses: actions/download-artifact@v6
|
|
46
46
|
with:
|
|
47
47
|
name: python-package-distributions
|
|
48
48
|
path: dist/
|
|
@@ -64,7 +64,7 @@ jobs:
|
|
|
64
64
|
|
|
65
65
|
steps:
|
|
66
66
|
- name: Download all the dists
|
|
67
|
-
uses: actions/download-artifact@
|
|
67
|
+
uses: actions/download-artifact@v6
|
|
68
68
|
with:
|
|
69
69
|
name: python-package-distributions
|
|
70
70
|
path: dist/
|
|
@@ -25,6 +25,7 @@ jobs:
|
|
|
25
25
|
python-version-file: "pyproject.toml"
|
|
26
26
|
- name: Install dependencies
|
|
27
27
|
run: uv sync --all-extras --dev
|
|
28
|
+
|
|
28
29
|
- name: Ruff
|
|
29
30
|
uses: chartboost/ruff-action@v1
|
|
30
31
|
- name: Test with pytest
|
|
@@ -32,11 +33,12 @@ jobs:
|
|
|
32
33
|
- name: Build a binary wheel and a source tarball
|
|
33
34
|
run: uv build
|
|
34
35
|
- name: Prep for mkdocs
|
|
35
|
-
run:
|
|
36
|
+
run: uv pip compile pyproject.toml -o requirements_docs.txt --group mkdocs
|
|
36
37
|
- name: Deploy docs
|
|
37
38
|
uses: mhausenblas/mkdocs-deploy-gh-pages@master
|
|
38
39
|
env:
|
|
39
40
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
41
|
+
EXTRA_PACKAGES: pngquant
|
|
40
42
|
REQUIREMENTS: requirements_docs.txt
|
|
41
43
|
CUSTOM_DOMAIN: updates2mqtt.rhizomatics.org.uk
|
|
42
44
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
repos:
|
|
2
2
|
- repo: https://github.com/asottile/pyupgrade
|
|
3
|
-
rev: v3.21.
|
|
3
|
+
rev: v3.21.2
|
|
4
4
|
hooks:
|
|
5
5
|
- id: pyupgrade
|
|
6
6
|
args: [--py313-plus]
|
|
@@ -17,11 +17,11 @@ repos:
|
|
|
17
17
|
- id: check-shebang-scripts-are-executable
|
|
18
18
|
name: Check shell scripts are executable
|
|
19
19
|
- repo: https://github.com/astral-sh/uv-pre-commit
|
|
20
|
-
rev: 0.9.
|
|
20
|
+
rev: 0.9.13
|
|
21
21
|
hooks:
|
|
22
22
|
- id: uv-lock
|
|
23
23
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
24
|
-
rev: v0.14.
|
|
24
|
+
rev: v0.14.7
|
|
25
25
|
hooks:
|
|
26
26
|
# Run the linter.
|
|
27
27
|
- id: ruff-check
|
|
@@ -39,7 +39,7 @@ repos:
|
|
|
39
39
|
exclude_types: [csv, json]
|
|
40
40
|
|
|
41
41
|
- repo: https://github.com/pre-commit/mirrors-mypy
|
|
42
|
-
rev: v1.
|
|
42
|
+
rev: v1.19.0
|
|
43
43
|
hooks:
|
|
44
44
|
- id: mypy
|
|
45
45
|
args:
|
|
@@ -64,7 +64,7 @@ repos:
|
|
|
64
64
|
- usingversion
|
|
65
65
|
|
|
66
66
|
- repo: https://github.com/PyCQA/bandit
|
|
67
|
-
rev: '1.
|
|
67
|
+
rev: '1.9.2'
|
|
68
68
|
hooks:
|
|
69
69
|
- id: bandit
|
|
70
70
|
args: ["-c", "pyproject.toml"]
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
## 1.4.0
|
|
4
|
+
- MQTT protocol can now be set, to one of `3.1`,`3.11` or `5`
|
|
5
|
+
- Debug messages now provided for `on_subscribe` and `on_unsubscribe` callbacks
|
|
6
|
+
- Troubleshooting, installation, configuration docs updated, images optimized
|
|
7
|
+
|
|
8
|
+
## 1.3.7
|
|
9
|
+
- Improved initial setup when run without config or env vars for MQTT
|
|
10
|
+
- Minor test deps update and pyproject docs
|
|
11
|
+
|
|
3
12
|
## 1.3.6
|
|
4
13
|
- Changed exit code on graceful shutdown to 143
|
|
5
14
|
- App now exits if the MQTT username / password is not authorized
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: updates2mqtt
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.4.0
|
|
4
4
|
Summary: System update and docker image notification and execution over MQTT
|
|
5
|
+
Project-URL: Homepage, https://updates2mqtt.rhizomatics.org.uk
|
|
5
6
|
Project-URL: Repository, https://github.com/rhizomatics/updates2mqtt
|
|
6
7
|
Project-URL: Documentation, https://updates2mqtt.rhizomatics.org.uk
|
|
7
8
|
Project-URL: Issues, https://github.com/rhizomatics/updates2mqtt/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/rhizomatics/updates2mqtt/blob/main/CHANGELOG.md
|
|
8
10
|
Author-email: jey burrows <jrb@rhizomatics.org.uk>
|
|
9
11
|
License-Expression: Apache-2.0
|
|
10
12
|
License-File: LICENSE
|
|
@@ -37,6 +39,7 @@ Description-Content-Type: text/markdown
|
|
|
37
39
|
|
|
38
40
|
# updates2mqtt
|
|
39
41
|
|
|
42
|
+
[](https://pypi.org/project/updates2mqtt/)
|
|
40
43
|
[](https://github.com/rhizomatics/supernotify)
|
|
41
44
|
[](https://results.pre-commit.ci/latest/github/rhizomatics/updates2mqtt/main)
|
|
42
45
|
[](https://github.com/rhizomatics/updates2mqtt/actions/workflows/pypi-publish.yml)
|
|
@@ -46,9 +49,14 @@ Description-Content-Type: text/markdown
|
|
|
46
49
|
|
|
47
50
|
## Summary
|
|
48
51
|
|
|
49
|
-
|
|
52
|
+
Let Home Assistant tell you about new updates to Docker images for your containers.
|
|
53
|
+
|
|
54
|
+

|
|
55
|
+
|
|
56
|
+
Read the release notes, and optionally click *Update* to trigger a Docker *pull* (or optionally *build*) and *update*.
|
|
57
|
+
|
|
58
|
+
{width=480}
|
|
50
59
|
|
|
51
|
-

|
|
52
60
|
|
|
53
61
|
## Description
|
|
54
62
|
|
|
@@ -56,7 +64,7 @@ updates2mqtt perioidically checks for new versions of components being available
|
|
|
56
64
|
|
|
57
65
|
Currently only Docker containers are supported, either via an image registry check, or a git repo for source (see [Local Builds](local_builds.md)). The design is modular, so other update sources can be added, at least for notification. The next anticipated is **apt** for Debian based systems.
|
|
58
66
|
|
|
59
|
-
Components can also be updated, either automatically or triggered via MQTT, for example by hitting the *Install* button in the HomeAssistant update dialog. Icons and release notes can be specified for a better HA experience.
|
|
67
|
+
Components can also be updated, either automatically or triggered via MQTT, for example by hitting the *Install* button in the HomeAssistant update dialog. Icons and release notes can be specified for a better HA experience. See [Home Assistant Integration](home_assistant.md) for details.
|
|
60
68
|
|
|
61
69
|
To get started, read the [Installation](installation.md) and [Configuration](configuration.md) pages.
|
|
62
70
|
|
|
@@ -68,8 +76,7 @@ docker run -e MQTT_USER=user1 -e MQTT_PASS=pass1 -e MQTT_HOST=192.168.1.5 ghcr.i
|
|
|
68
76
|
|
|
69
77
|
## Release Support
|
|
70
78
|
|
|
71
|
-
Presently only Docker containers are supported, although others are planned,
|
|
72
|
-
probably with priority for `apt`.
|
|
79
|
+
Presently only Docker containers are supported, although others are planned, probably with priority for `apt`.
|
|
73
80
|
|
|
74
81
|
| Ecosystem | Support | Comments |
|
|
75
82
|
|-----------|-------------|----------------------------------------------------------------------------------------------------|
|
|
@@ -79,36 +86,76 @@ probably with priority for `apt`.
|
|
|
79
86
|
|
|
80
87
|
A heartbeat JSON payload is optionally published periodically to a configurable MQTT topic, defaulting to `healthcheck/{node_name}/updates2mqtt`. It contains the current version of updates2mqtt, the node name, a timestamp, and some basic stats.
|
|
81
88
|
|
|
82
|
-
A `healthcheck.sh` script is included in the Docker image, and can be used as a Docker healthcheck, if the container environment variables are set for `MQTT_HOST`, `MQTT_PORT`, `MQTT_USER` and `MQTT_PASS`.
|
|
89
|
+
A `healthcheck.sh` script is included in the Docker image, and can be used as a Docker healthcheck, if the container environment variables are set for `MQTT_HOST`, `MQTT_PORT`, `MQTT_USER` and `MQTT_PASS`. It uses the `mosquitto-clients` Linux package which provides `mosquitto_sub` command to subscribe to topics.
|
|
83
90
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
91
|
+
!!! tip
|
|
92
|
+
|
|
93
|
+
Check healthcheck is working using `docker inspect --format "{{json .State.Health }}" updates2mqtt | jq`
|
|
94
|
+
|
|
95
|
+
Another approach is using a restarter service directly in Docker Compose to force a restart, in this case once a day:
|
|
96
|
+
|
|
97
|
+
```yaml title="Example Compose Service"
|
|
98
|
+
restarter:
|
|
99
|
+
image: docker:cli
|
|
100
|
+
volumes: ["/var/run/docker.sock:/var/run/docker.sock"]
|
|
101
|
+
command: ["/bin/sh", "-c", "while true; do sleep 86400; docker restart updates2mqtt; done"]
|
|
102
|
+
restart: unless-stopped
|
|
103
|
+
environment:
|
|
104
|
+
- UPD2MQTT_UPDATE=AUTO
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Target Containers
|
|
87
108
|
|
|
88
|
-
|
|
89
|
-
|
|
109
|
+
While `updates2mqtt` will discover and monitor all containers running under the Docker daemon,
|
|
110
|
+
there are some options to make to those containers to tune how it works.
|
|
90
111
|
|
|
91
|
-
|
|
112
|
+
These happen by adding environment variables to the containers, typically inside an `.env`
|
|
113
|
+
file, or as `environment` options inside `docker-compose.yaml`.
|
|
92
114
|
|
|
93
|
-
|
|
115
|
+
### Automated updates
|
|
94
116
|
|
|
95
|
-
|
|
117
|
+
If Docker containers should be immediately updated, without any confirmation
|
|
118
|
+
or trigger, *e.g.* from the HomeAssistant update dialog, then set an environment variable `UPD2MQTT_UPDATE` in the target container to `Auto` ( it defaults to `Passive`)
|
|
119
|
+
|
|
120
|
+
```yaml title="Example Compose Snippet"
|
|
121
|
+
restarter:
|
|
122
|
+
image: docker:cli
|
|
123
|
+
command: ["/bin/sh", "-c", "while true; do sleep 86400; docker restart mailserver; done"]
|
|
124
|
+
environment:
|
|
125
|
+
- UPD2MQTT_UPDATE=AUTO
|
|
126
|
+
```
|
|
96
127
|
|
|
97
|
-
|
|
128
|
+
### Environment Variables
|
|
98
129
|
|
|
99
|
-
|
|
130
|
+
The following environment variables can be used to configure containers for `updates2mqtt`:
|
|
100
131
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
132
|
+
| Env Var | Description | Default |
|
|
133
|
+
|---------| ------------|----------|
|
|
134
|
+
| `UPD2MQTT_UPDATE` | Update mode, either `Passive` or `Auto`. If `Auto`, updates will be installed automatically. | `Passive` |
|
|
135
|
+
| `UPD2MQTT_PICTURE` | URL to an icon to use in Home Assistant. | Docker logo URL |
|
|
136
|
+
| `UPD2MQTT_RELNOTES` | URL to release notes for the package. | |
|
|
137
|
+
| `UPD2MQTT_GIT_REPO_PATH` | Relative path to a local git repo if the image is built locally. | |
|
|
138
|
+
| `UPD2MQTT_IGNORE` | If set to `True`, the container will be ignored by updates2mqtt. | False |
|
|
104
139
|
|
|
105
|
-
If the package supports automated update, then *Skip* and *Install* buttons will appear on the Home Assistant
|
|
106
|
-
interface, and the package can be remotely fetched and the component restarted.
|
|
107
140
|
|
|
108
141
|
## Related Projects
|
|
109
142
|
|
|
143
|
+
Other apps useful for self-hosting with the help of MQTT:
|
|
144
|
+
|
|
110
145
|
- [psmqtt](https://github.com/eschava/psmqtt) - Report system health and metrics via MQTT
|
|
111
|
-
|
|
146
|
+
|
|
147
|
+
Find more at [awesome-mqtt](https://github.com/rhizomatics/awesome-mqtt)
|
|
148
|
+
|
|
112
149
|
## Development
|
|
113
150
|
|
|
114
|
-
|
|
151
|
+
This component relies on several open source packages:
|
|
152
|
+
|
|
153
|
+
- [docker-py](https://docker-py.readthedocs.io/en/stable/) SDK for Python for access to Docker APIs
|
|
154
|
+
- [Eclipse Paho](https://eclipse.dev/paho/files/paho.mqtt.python/html/client.html) MQTT client
|
|
155
|
+
- [OmegaConf](https://omegaconf.readthedocs.io) for configuration and validation
|
|
156
|
+
- [structlog](https://www.structlog.org/en/stable/) for structured logging and [rich](https://rich.readthedocs.io/en/stable/) for better exception reporting
|
|
157
|
+
- [hishel](https://hishel.com/1.0/) for caching metadata
|
|
158
|
+
- [httpx](https://www.python-httpx.org) for retrieving metadata
|
|
159
|
+
- The Astral [uv](https://docs.astral.sh/uv/) and [ruff](https://docs.astral.sh/ruff/) tools for development and build
|
|
160
|
+
- [pytest](https://docs.pytest.org/en/stable/) and supporting add-ins for automated testing
|
|
161
|
+
- [usingversion](https://pypi.org/project/usingversion/) to log current version info
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
[](https://github.com/rhizomatics)
|
|
2
|
+
|
|
3
|
+
# updates2mqtt
|
|
4
|
+
|
|
5
|
+
[](https://pypi.org/project/updates2mqtt/)
|
|
6
|
+
[](https://github.com/rhizomatics/supernotify)
|
|
7
|
+
[](https://results.pre-commit.ci/latest/github/rhizomatics/updates2mqtt/main)
|
|
8
|
+
[](https://github.com/rhizomatics/updates2mqtt/actions/workflows/pypi-publish.yml)
|
|
9
|
+
[](https://github.com/rhizomatics/updates2mqtt/actions/workflows/python-package.yml)
|
|
10
|
+
[](https://github.com/rhizomatics/updates2mqtt/actions/workflows/github-code-scanning/codeql)
|
|
11
|
+
[](https://github.com/rhizomatics/updates2mqtt/actions/workflows/dependabot/dependabot-updates)
|
|
12
|
+
|
|
13
|
+
## Summary
|
|
14
|
+
|
|
15
|
+
Let Home Assistant tell you about new updates to Docker images for your containers.
|
|
16
|
+
|
|
17
|
+

|
|
18
|
+
|
|
19
|
+
Read the release notes, and optionally click *Update* to trigger a Docker *pull* (or optionally *build*) and *update*.
|
|
20
|
+
|
|
21
|
+
{width=480}
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
## Description
|
|
25
|
+
|
|
26
|
+
updates2mqtt perioidically checks for new versions of components being available, and publishes new version info to MQTT. HomeAssistant auto discovery is supported, so all updates can be seen in the same place as Home Assistant's own components and add-ins.
|
|
27
|
+
|
|
28
|
+
Currently only Docker containers are supported, either via an image registry check, or a git repo for source (see [Local Builds](local_builds.md)). The design is modular, so other update sources can be added, at least for notification. The next anticipated is **apt** for Debian based systems.
|
|
29
|
+
|
|
30
|
+
Components can also be updated, either automatically or triggered via MQTT, for example by hitting the *Install* button in the HomeAssistant update dialog. Icons and release notes can be specified for a better HA experience. See [Home Assistant Integration](home_assistant.md) for details.
|
|
31
|
+
|
|
32
|
+
To get started, read the [Installation](installation.md) and [Configuration](configuration.md) pages.
|
|
33
|
+
|
|
34
|
+
For a quick spin, try this:
|
|
35
|
+
|
|
36
|
+
```yaml
|
|
37
|
+
docker run -e MQTT_USER=user1 -e MQTT_PASS=pass1 -e MQTT_HOST=192.168.1.5 ghcr.io/rhizomatics/updates2mqtt:release
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Release Support
|
|
41
|
+
|
|
42
|
+
Presently only Docker containers are supported, although others are planned, probably with priority for `apt`.
|
|
43
|
+
|
|
44
|
+
| Ecosystem | Support | Comments |
|
|
45
|
+
|-----------|-------------|----------------------------------------------------------------------------------------------------|
|
|
46
|
+
| Docker | Scan. Fetch | Fetch is ``docker pull`` only. Restart support only for ``docker-compose`` image based containers. |
|
|
47
|
+
|
|
48
|
+
## Healthcheck
|
|
49
|
+
|
|
50
|
+
A heartbeat JSON payload is optionally published periodically to a configurable MQTT topic, defaulting to `healthcheck/{node_name}/updates2mqtt`. It contains the current version of updates2mqtt, the node name, a timestamp, and some basic stats.
|
|
51
|
+
|
|
52
|
+
A `healthcheck.sh` script is included in the Docker image, and can be used as a Docker healthcheck, if the container environment variables are set for `MQTT_HOST`, `MQTT_PORT`, `MQTT_USER` and `MQTT_PASS`. It uses the `mosquitto-clients` Linux package which provides `mosquitto_sub` command to subscribe to topics.
|
|
53
|
+
|
|
54
|
+
!!! tip
|
|
55
|
+
|
|
56
|
+
Check healthcheck is working using `docker inspect --format "{{json .State.Health }}" updates2mqtt | jq`
|
|
57
|
+
|
|
58
|
+
Another approach is using a restarter service directly in Docker Compose to force a restart, in this case once a day:
|
|
59
|
+
|
|
60
|
+
```yaml title="Example Compose Service"
|
|
61
|
+
restarter:
|
|
62
|
+
image: docker:cli
|
|
63
|
+
volumes: ["/var/run/docker.sock:/var/run/docker.sock"]
|
|
64
|
+
command: ["/bin/sh", "-c", "while true; do sleep 86400; docker restart updates2mqtt; done"]
|
|
65
|
+
restart: unless-stopped
|
|
66
|
+
environment:
|
|
67
|
+
- UPD2MQTT_UPDATE=AUTO
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Target Containers
|
|
71
|
+
|
|
72
|
+
While `updates2mqtt` will discover and monitor all containers running under the Docker daemon,
|
|
73
|
+
there are some options to make to those containers to tune how it works.
|
|
74
|
+
|
|
75
|
+
These happen by adding environment variables to the containers, typically inside an `.env`
|
|
76
|
+
file, or as `environment` options inside `docker-compose.yaml`.
|
|
77
|
+
|
|
78
|
+
### Automated updates
|
|
79
|
+
|
|
80
|
+
If Docker containers should be immediately updated, without any confirmation
|
|
81
|
+
or trigger, *e.g.* from the HomeAssistant update dialog, then set an environment variable `UPD2MQTT_UPDATE` in the target container to `Auto` ( it defaults to `Passive`)
|
|
82
|
+
|
|
83
|
+
```yaml title="Example Compose Snippet"
|
|
84
|
+
restarter:
|
|
85
|
+
image: docker:cli
|
|
86
|
+
command: ["/bin/sh", "-c", "while true; do sleep 86400; docker restart mailserver; done"]
|
|
87
|
+
environment:
|
|
88
|
+
- UPD2MQTT_UPDATE=AUTO
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Environment Variables
|
|
92
|
+
|
|
93
|
+
The following environment variables can be used to configure containers for `updates2mqtt`:
|
|
94
|
+
|
|
95
|
+
| Env Var | Description | Default |
|
|
96
|
+
|---------| ------------|----------|
|
|
97
|
+
| `UPD2MQTT_UPDATE` | Update mode, either `Passive` or `Auto`. If `Auto`, updates will be installed automatically. | `Passive` |
|
|
98
|
+
| `UPD2MQTT_PICTURE` | URL to an icon to use in Home Assistant. | Docker logo URL |
|
|
99
|
+
| `UPD2MQTT_RELNOTES` | URL to release notes for the package. | |
|
|
100
|
+
| `UPD2MQTT_GIT_REPO_PATH` | Relative path to a local git repo if the image is built locally. | |
|
|
101
|
+
| `UPD2MQTT_IGNORE` | If set to `True`, the container will be ignored by updates2mqtt. | False |
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
## Related Projects
|
|
105
|
+
|
|
106
|
+
Other apps useful for self-hosting with the help of MQTT:
|
|
107
|
+
|
|
108
|
+
- [psmqtt](https://github.com/eschava/psmqtt) - Report system health and metrics via MQTT
|
|
109
|
+
|
|
110
|
+
Find more at [awesome-mqtt](https://github.com/rhizomatics/awesome-mqtt)
|
|
111
|
+
|
|
112
|
+
## Development
|
|
113
|
+
|
|
114
|
+
This component relies on several open source packages:
|
|
115
|
+
|
|
116
|
+
- [docker-py](https://docker-py.readthedocs.io/en/stable/) SDK for Python for access to Docker APIs
|
|
117
|
+
- [Eclipse Paho](https://eclipse.dev/paho/files/paho.mqtt.python/html/client.html) MQTT client
|
|
118
|
+
- [OmegaConf](https://omegaconf.readthedocs.io) for configuration and validation
|
|
119
|
+
- [structlog](https://www.structlog.org/en/stable/) for structured logging and [rich](https://rich.readthedocs.io/en/stable/) for better exception reporting
|
|
120
|
+
- [hishel](https://hishel.com/1.0/) for caching metadata
|
|
121
|
+
- [httpx](https://www.python-httpx.org) for retrieving metadata
|
|
122
|
+
- The Astral [uv](https://docs.astral.sh/uv/) and [ruff](https://docs.astral.sh/ruff/) tools for development and build
|
|
123
|
+
- [pytest](https://docs.pytest.org/en/stable/) and supporting add-ins for automated testing
|
|
124
|
+
- [usingversion](https://pypi.org/project/usingversion/) to log current version info
|
|
@@ -4,7 +4,8 @@ Create file `config.yaml` in `conf` directory. If the file is not present, a def
|
|
|
4
4
|
|
|
5
5
|
### Example configuration file
|
|
6
6
|
|
|
7
|
-
This is a maximal config file, the minimum is no config file at all, which will generate a default config file. The only mandatory values are the MQTT user name and password, everything else can be omitted
|
|
7
|
+
This is a maximal config file, the minimum is no config file at all, which will generate a default config file. The only mandatory values are the MQTT user name and password, everything else can be omitted ( although
|
|
8
|
+
its best to have at least a `node` `name` value so HomeAssistant doesn't show some ugly generated Docker host name).
|
|
8
9
|
|
|
9
10
|
```yaml
|
|
10
11
|
|
|
@@ -21,6 +22,7 @@ mqtt:
|
|
|
21
22
|
password: ${oc.env:MQTT_PASS}$ # Use an environment variable for secrets
|
|
22
23
|
port: ${oc.env:MQTT_PORT}
|
|
23
24
|
topic_root: updates2mqtt
|
|
25
|
+
protocol: 3.11 # Can be changed to 5 if your broker supports it
|
|
24
26
|
homeassistant:
|
|
25
27
|
discovery:
|
|
26
28
|
prefix: homeassistant # Matches the default MQTT discovery prefix in Home Assistant
|
|
@@ -44,6 +46,8 @@ log:
|
|
|
44
46
|
level: INFO
|
|
45
47
|
```
|
|
46
48
|
|
|
49
|
+
## Improving Security
|
|
50
|
+
|
|
47
51
|
### Moving Secrets Out of Config
|
|
48
52
|
|
|
49
53
|
Example use of environment variables, e.g. for secrets:
|
|
@@ -52,7 +56,50 @@ Example use of environment variables, e.g. for secrets:
|
|
|
52
56
|
mqtt:
|
|
53
57
|
password: ${oc.env:MQTT_PASS}
|
|
54
58
|
```
|
|
55
|
-
|
|
59
|
+
|
|
60
|
+
### Running as non-root
|
|
61
|
+
|
|
62
|
+
It is good practice not to run Docker containers as root, and `updates2mqtt` will
|
|
63
|
+
work with any user so long as it has Docker permissions, usually as a result
|
|
64
|
+
of being a member of the `docker` group.
|
|
65
|
+
|
|
66
|
+
To create a suitable use, use the shell command below - it will create a user
|
|
67
|
+
that can only be used for this purpose, and can't otherwise login. It assumes there is already a group called `docker` with access to the Docker Daemon, if you dont
|
|
68
|
+
have one, follow the [Docker Post Install Steps](https://docs.docker.com/engine/install/linux-postinstall/) which explain how and why to do it.
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
sudo adduser --system --ingroup docker --no-create-home -shell /sbin/nologin updates2mqtt
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Note the `uid` that is reported here. If you don't know the `gid` for the `docker` group, use `grep docker /etc/group`. In this example, our `uid` is `130` and the `gid` of `docker` group is `119`.
|
|
75
|
+
|
|
76
|
+
In the `docker-compose.yaml`, set the user and group using [user](https://docs.docker.com/reference/compose-file/services/#user) attribute:
|
|
77
|
+
|
|
78
|
+
```yaml
|
|
79
|
+
services:
|
|
80
|
+
updates2mqtt:
|
|
81
|
+
container_name: updates2mqtt
|
|
82
|
+
image: ghcr.io/rhizomatics/updates2mqtt:release
|
|
83
|
+
user: 130:119
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
If you're using Updates2MQTT to update local git repos, then the user created above will also need `rw` access to those, which you can do by making it a member of the
|
|
87
|
+
same group as owns the repos and making sure they have group `rw` access configured.
|
|
88
|
+
|
|
89
|
+
For more information, see the [Understanding the Docker USER Instruction](https://www.docker.com/blog/understanding-the-docker-user-instruction/) article from Docker.
|
|
90
|
+
|
|
91
|
+
### MQTT Access Control
|
|
92
|
+
|
|
93
|
+
Its best to have a dedicated MQTT user for Updates2MQTT, for security and debug. For most
|
|
94
|
+
secure installations, only use secure ports with validated certificates, although this will
|
|
95
|
+
require more complicated setup and ongoing support, including using host names rather than
|
|
96
|
+
IP addresses, and with [LetsEncrypt](https://letsencrypt.org) to update certificates.
|
|
97
|
+
|
|
98
|
+
The two brokers most commonly used with Home Assistant, **Mosquitto** and **EMQX**, both have
|
|
99
|
+
access control mechanisms, so you can restrict the user account for Updates2MQTT to only be able
|
|
100
|
+
to read and write its own topics.
|
|
101
|
+
|
|
102
|
+
## Customizing images and release notes
|
|
56
103
|
|
|
57
104
|
Individual docker containers can have customized entity pictures or release notes, using env variables, for example in the `docker-compose.yaml` or in a separate `.env` file:
|
|
58
105
|
|
|
@@ -65,6 +112,7 @@ Individual docker containers can have customized entity pictures or release note
|
|
|
65
112
|
The images will show up in the *Update* section of *Settings* menu in HomeAssistant,
|
|
66
113
|
as will the release notes link. SVG icons should be used.
|
|
67
114
|
|
|
115
|
+
|
|
68
116
|
#### Icon Sources
|
|
69
117
|
|
|
70
118
|
Updates look nicer in Home Assistant with a suitable icon. Updates2mqtt comes
|
|
@@ -79,20 +127,3 @@ If you have something not covered, here are some good places to look for self-ho
|
|
|
79
127
|
- [Papirus Icons](https://github.com/PapirusDevelopmentTeam/papirus-icon-theme)
|
|
80
128
|
- [Homelab SVG Assets](https://github.com/loganmarchione/homelab-svg-assets)
|
|
81
129
|
|
|
82
|
-
### Automated updates
|
|
83
|
-
|
|
84
|
-
If Docker containers should be immediately updated, without any confirmation
|
|
85
|
-
or trigger, *e.g.* from the HomeAssistant update dialog, then set an environment variable `UPD2MQTT_UPDATE` in the target container to `Auto` ( it defaults to `Passive`)
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
### Environment Variables
|
|
89
|
-
|
|
90
|
-
The following environment variables can be used to configure updates2mqtt:
|
|
91
|
-
|
|
92
|
-
| Env Var | Description | Default |
|
|
93
|
-
|---------| ------------|----------|
|
|
94
|
-
| `UPD2MQTT_UPDATE` | Update mode, either `Passive` or `Auto`. If `Auto`, updates will be installed automatically. | `Passive` |
|
|
95
|
-
| `UPD2MQTT_PICTURE` | URL to an icon to use in Home Assistant. | Docker logo URL |
|
|
96
|
-
| `UPD2MQTT_RELNOTES` | URL to release notes for the package. | |
|
|
97
|
-
| `UPD2MQTT_GIT_REPO_PATH` | Relative path to a local git repo if the image is built locally. | |
|
|
98
|
-
| `UPD2MQTT_IGNORE` | If set to `True`, the container will be ignored by updates2mqtt. | False |
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# HomeAssistant Integration
|
|
2
|
+
|
|
3
|
+
`updates2mqtt` represents each component being managed as a [MQTT Update](https://www.home-assistant.io/integrations/update.mqtt/) entity, and uses [MQTT discovery](https://www.home-assistant.io/integrations/mqtt/#mqtt-discovery) so that HomeAssistant automatically picks up components discovered by updates2mqtt with zero configuration on HomeAssistant itself.
|
|
4
|
+
|
|
5
|
+
## Configuration
|
|
6
|
+
|
|
7
|
+
If Home Assistant is already running with MQTT, and the defaults haven't been changed, then
|
|
8
|
+
`updates2mqtt` will likely work as is, so long as its publishing to the same broker.
|
|
9
|
+
|
|
10
|
+
Any updates that have support for automated install will automatically show in the
|
|
11
|
+
Home Assistant settings page if the [MQTT Integration](https://www.home-assistant.io/integrations/mqtt/) is installed and automatic discovery is not disabled.
|
|
12
|
+
|
|
13
|
+

|
|
14
|
+
|
|
15
|
+
The `homeassistant` default topic prefix matches the default updates2mqtt config, if its changed in HomeAssistant, then the updates2mqtt config must be changed to match.
|
|
16
|
+
|
|
17
|
+

|
|
18
|
+
|
|
19
|
+
## MQTT Topics
|
|
20
|
+
|
|
21
|
+
There are 3 separate types of MQTT topic used for HomeAssisstant integration:
|
|
22
|
+
|
|
23
|
+
- *Config* to support auto discovery. A topic is created per component, with a name like `homeassistant/update/dockernuc_docker_jellyfin/update/config`. This can be disabled in the config file, and the `homeassistant` topic prefix can also be configured.
|
|
24
|
+
- *State* to report the current version and the latest version available, again one topic per component, like `updates2mqtt/dockernuc/docker/jellyfin`.
|
|
25
|
+
- *Command* to support triggering an update. These will be created on the fly by HomeAssistant when an update is requested, and updates2mqtt subscribes to pick up the changes, so you won't typically see these if browsing MQTT topics. Only one is needed per updates2mqtt agent, with a name like `updates2mqtt/dockernuc/docker`
|
|
26
|
+
|
|
27
|
+
If the package supports automated update, then *Skip* and *Install* buttons will appear on the Home Assistant interface, and the package can be remotely fetched and the component restarted.
|
|
28
|
+
|
|
29
|
+
## More Home Assistant information
|
|
30
|
+
|
|
31
|
+
- [MQTT Integration](https://www.home-assistant.io/integrations/mqtt/)
|
|
32
|
+
- Includes setting up a MQTT broker, MQTT Discovery, and trouble-shooting
|
|
33
|
+
- [MQTT Update](https://www.home-assistant.io/integrations/update.mqtt/)
|
|
34
|
+
- [Update Integration](https://www.home-assistant.io/integrations/update/)
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
updates2mqtt prefers to be run inside a Docker container, though can run standalone, for example scripted via cron or systemd.
|
|
6
6
|
|
|
7
|
+
The only mandatory configuration is the MQTT broker host, user name and password, which can be set by environment variable, or the config file. See [Configuration](configuration.md).
|
|
8
|
+
|
|
7
9
|
### Docker
|
|
8
10
|
|
|
9
11
|
See `examples` directory for a working `docker-compose.yaml`.
|
|
@@ -27,3 +29,16 @@ uv run --with updates2mqtt updates2mqtt
|
|
|
27
29
|
pip install updates2mqtt
|
|
28
30
|
python3 -m updates2mqtt
|
|
29
31
|
```
|
|
32
|
+
|
|
33
|
+
## Verifying it Works
|
|
34
|
+
|
|
35
|
+
Rather than wait for a container to need an update, you can check right away that
|
|
36
|
+
Home Assistant has recognized the containers as MQTT Update targets.
|
|
37
|
+
|
|
38
|
+
From the [Entities View](https://www.home-assistant.io/docs/configuration/entities_domains/), or the
|
|
39
|
+
[Developer Tools](https://www.home-assistant.io/docs/tools/dev-tools/), filter
|
|
40
|
+
the entities by `update.` If there are lots of other updates (HassOS apps, Zigbee
|
|
41
|
+
device firmware etc), then pick one of the container names you know.
|
|
42
|
+
|
|
43
|
+
{width=640}
|
|
44
|
+
|