updates2mqtt 1.6.0__py3-none-any.whl
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/__init__.py +5 -0
- updates2mqtt/__main__.py +6 -0
- updates2mqtt/app.py +233 -0
- updates2mqtt/config.py +176 -0
- updates2mqtt/hass_formatter.py +89 -0
- updates2mqtt/integrations/__init__.py +1 -0
- updates2mqtt/integrations/docker.py +607 -0
- updates2mqtt/integrations/git_utils.py +123 -0
- updates2mqtt/model.py +128 -0
- updates2mqtt/mqtt.py +349 -0
- updates2mqtt/py.typed +0 -0
- updates2mqtt-1.6.0.dist-info/METADATA +211 -0
- updates2mqtt-1.6.0.dist-info/RECORD +15 -0
- updates2mqtt-1.6.0.dist-info/WHEEL +4 -0
- updates2mqtt-1.6.0.dist-info/entry_points.txt +3 -0
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: updates2mqtt
|
|
3
|
+
Version: 1.6.0
|
|
4
|
+
Summary: System update and docker image notification and execution over MQTT
|
|
5
|
+
Keywords: mqtt,docker,updates,automation,home-assistant,homeassistant,selfhosting
|
|
6
|
+
Author: jey burrows
|
|
7
|
+
Author-email: jey burrows <jrb@rhizomatics.org.uk>
|
|
8
|
+
License-Expression: Apache-2.0
|
|
9
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
10
|
+
Classifier: License :: Other/Proprietary License
|
|
11
|
+
Classifier: Natural Language :: English
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Topic :: Home Automation
|
|
15
|
+
Classifier: Topic :: System :: Systems Administration
|
|
16
|
+
Classifier: Topic :: System :: Monitoring
|
|
17
|
+
Classifier: Intended Audience :: System Administrators
|
|
18
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
19
|
+
Classifier: Typing :: Typed
|
|
20
|
+
Classifier: Programming Language :: Python
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Requires-Dist: docker>=7.1.0
|
|
23
|
+
Requires-Dist: paho-mqtt>=2.1.0
|
|
24
|
+
Requires-Dist: omegaconf>=2.3.0
|
|
25
|
+
Requires-Dist: structlog>=25.4.0
|
|
26
|
+
Requires-Dist: rich>=14.0.0
|
|
27
|
+
Requires-Dist: httpx>=0.28.1
|
|
28
|
+
Requires-Dist: hishel[httpx]>=0.1.4
|
|
29
|
+
Requires-Dist: usingversion>=0.1.2
|
|
30
|
+
Requires-Python: >=3.13
|
|
31
|
+
Project-URL: Changelog, https://github.com/rhizomatics/updates2mqtt/blob/main/CHANGELOG.md
|
|
32
|
+
Project-URL: Documentation, https://updates2mqtt.rhizomatics.org.uk
|
|
33
|
+
Project-URL: Homepage, https://updates2mqtt.rhizomatics.org.uk
|
|
34
|
+
Project-URL: Issues, https://github.com/rhizomatics/updates2mqtt/issues
|
|
35
|
+
Project-URL: Repository, https://github.com/rhizomatics/updates2mqtt
|
|
36
|
+
Description-Content-Type: text/markdown
|
|
37
|
+
|
|
38
|
+
{ align=left }
|
|
39
|
+
|
|
40
|
+
# updates2mqtt
|
|
41
|
+
|
|
42
|
+
[](https://github.com/rhizomatics)
|
|
43
|
+
|
|
44
|
+
[](https://pypi.org/project/updates2mqtt/)
|
|
45
|
+
[](https://github.com/rhizomatics/updates2mqtt)
|
|
46
|
+
[](https://updates2mqtt.rhizomatics.org.uk/developer/coverage/)
|
|
47
|
+

|
|
48
|
+
[](https://results.pre-commit.ci/latest/github/rhizomatics/updates2mqtt/main)
|
|
49
|
+
[](https://github.com/rhizomatics/updates2mqtt/actions/workflows/pypi-publish.yml)
|
|
50
|
+
[](https://github.com/rhizomatics/updates2mqtt/actions/workflows/python-package.yml)
|
|
51
|
+
[](https://github.com/rhizomatics/updates2mqtt/actions/workflows/github-code-scanning/codeql)
|
|
52
|
+
[](https://github.com/rhizomatics/updates2mqtt/actions/workflows/dependabot/dependabot-updates)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
<br/>
|
|
56
|
+
<br/>
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
## Summary
|
|
60
|
+
|
|
61
|
+
Let Home Assistant tell you about new updates to Docker images for your containers.
|
|
62
|
+
|
|
63
|
+

|
|
64
|
+
|
|
65
|
+
Read the release notes, and optionally click *Update* to trigger a Docker *pull* (or optionally *build*) and *update*.
|
|
66
|
+
|
|
67
|
+
{width=480}
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
## Description
|
|
71
|
+
|
|
72
|
+
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.
|
|
73
|
+
|
|
74
|
+
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.
|
|
75
|
+
|
|
76
|
+
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.
|
|
77
|
+
|
|
78
|
+
To get started, read the [Installation](installation.md) and [Configuration](configuration.md) pages.
|
|
79
|
+
|
|
80
|
+
For a quick spin, try this:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
docker run -v /var/run/docker.sock:/var/run/docker.sock -e MQTT_USER=user1 -e MQTT_PASS=user1 -e MQTT_HOST=192.168.1.5 ghcr.io/rhizomatics/updates2mqtt:release
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
or without Docker, using [uv](https://docs.astral.sh/uv/)
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
export MQTT_HOST=192.168.1.1;export MQTT_USER=user1;export MQTT_PASS=user1;uv run --with updates2mqtt python -m updates2mqtt
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Release Support
|
|
93
|
+
|
|
94
|
+
Presently only Docker containers are supported, although others are planned, probably with priority for `apt`.
|
|
95
|
+
|
|
96
|
+
| Ecosystem | Support | Comments |
|
|
97
|
+
|-----------|-------------|----------------------------------------------------------------------------------------------------|
|
|
98
|
+
| Docker | Scan. Fetch | Fetch is ``docker pull`` only. Restart support only for ``docker-compose`` image based containers. |
|
|
99
|
+
|
|
100
|
+
## Heartbeat
|
|
101
|
+
|
|
102
|
+
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.
|
|
103
|
+
|
|
104
|
+
## Healthcheck
|
|
105
|
+
|
|
106
|
+
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.
|
|
107
|
+
|
|
108
|
+
!!! tip
|
|
109
|
+
|
|
110
|
+
Check healthcheck is working using `docker inspect --format "{{json .State.Health }}" updates2mqtt | jq` (can omit `| jq` if you don't have jsonquery installed, but much easier to read with it)
|
|
111
|
+
|
|
112
|
+
Another approach is using a restarter service directly in Docker Compose to force a restart, in this case once a day:
|
|
113
|
+
|
|
114
|
+
```yaml title="Example Compose Service"
|
|
115
|
+
restarter:
|
|
116
|
+
image: docker:cli
|
|
117
|
+
volumes: ["/var/run/docker.sock:/var/run/docker.sock"]
|
|
118
|
+
command: ["/bin/sh", "-c", "while true; do sleep 86400; docker restart updates2mqtt; done"]
|
|
119
|
+
restart: unless-stopped
|
|
120
|
+
environment:
|
|
121
|
+
- UPD2MQTT_UPDATE=AUTO
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Target Containers
|
|
125
|
+
|
|
126
|
+
While `updates2mqtt` will discover and monitor all containers running under the Docker daemon,
|
|
127
|
+
there are some options to make to those containers to tune how it works.
|
|
128
|
+
|
|
129
|
+
These happen by adding environment variables to the containers, typically inside an `.env`
|
|
130
|
+
file, or as `environment` options inside `docker-compose.yaml`.
|
|
131
|
+
|
|
132
|
+
### Automated updates
|
|
133
|
+
|
|
134
|
+
If Docker containers should be immediately updated, without any confirmation
|
|
135
|
+
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`)
|
|
136
|
+
|
|
137
|
+
```yaml title="Example Compose Snippet"
|
|
138
|
+
restarter:
|
|
139
|
+
image: docker:cli
|
|
140
|
+
command: ["/bin/sh", "-c", "while true; do sleep 86400; docker restart mailserver; done"]
|
|
141
|
+
environment:
|
|
142
|
+
- UPD2MQTT_UPDATE=AUTO
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
This can be used in conjunction with the `UPD2MQTT_VERSION_INCLUDE` and `UPD2MQTT_VERSION_EXCLUDE` to
|
|
146
|
+
limit which updates get automatically applied, for example excluding nightly builds.
|
|
147
|
+
|
|
148
|
+
Automated updates can also apply to local builds, where a `git_repo_path` has been defined - if there are remote
|
|
149
|
+
commits available to pull, then a `git pull`, `docker compose build` and `docker compose up` will be executed.
|
|
150
|
+
|
|
151
|
+
### Environment Variables
|
|
152
|
+
|
|
153
|
+
The following environment variables can be used to configure containers for `updates2mqtt`:
|
|
154
|
+
|
|
155
|
+
| Env Var | Description | Default |
|
|
156
|
+
|----------------------------|----------------------------------------------------------------------------------------------|-----------------|
|
|
157
|
+
| `UPD2MQTT_UPDATE` | Update mode, either `Passive` or `Auto`. If `Auto`, updates will be installed automatically. | `Passive` |
|
|
158
|
+
| `UPD2MQTT_PICTURE` | URL to an icon to use in Home Assistant. | Docker logo URL |
|
|
159
|
+
| `UPD2MQTT_RELNOTES` | URL to release notes for the package. | |
|
|
160
|
+
| `UPD2MQTT_GIT_REPO_PATH` | Relative path to a local git repo if the image is built locally. | |
|
|
161
|
+
| `UPD2MQTT_IGNORE` | If set to `True`, the container will be ignored by Updates2MQTT. | False |
|
|
162
|
+
| `UPD2MQTT_VERSION_INCLUDE` | Only recognize versions matching this string or regular expression | |
|
|
163
|
+
| `UPD2MQTT_VERSION_EXCLUDE` | Skip update if version matches this string or regular expression | |
|
|
164
|
+
|
|
165
|
+
### Docker Labels
|
|
166
|
+
|
|
167
|
+
Alternatively, use Docker labels
|
|
168
|
+
|
|
169
|
+
| Label | Env Var |
|
|
170
|
+
|--------------------------------|----------------------------|
|
|
171
|
+
| `updates2mqtt.update` | `UPD2MQTT_UPDATE` |
|
|
172
|
+
| `updates2mqtt.picture` | `UPD2MQTT_PCITURE` |
|
|
173
|
+
| `updates2mqtt.relnotes` | `UPD2MQTT_RELNOTES` |
|
|
174
|
+
| `updates2mqtt.git_repo_path` | `UPD2MQTT_GIT_REPO_PATH` |
|
|
175
|
+
| `updates2mqtt.ignore` | `UPD2MQTT_IGNORE` |
|
|
176
|
+
| `updates2mqtt.version_include` | `UPD2MQTT_VERSION_INCLUDE` |
|
|
177
|
+
| `updates2mqtt.version_exclude` | `UPD2MQTT_VERSION_EXCLUDE` |
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
```yaml title="Example Compose Snippet"
|
|
181
|
+
restarter:
|
|
182
|
+
image: docker:cli
|
|
183
|
+
command: ["/bin/sh", "-c", "while true; do sleep 86400; docker restart mailserver; done"]
|
|
184
|
+
labels:
|
|
185
|
+
updates2mqtt.relnotes: https://component.my.com/release_notes
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
## Related Projects
|
|
190
|
+
|
|
191
|
+
Other apps useful for self-hosting with the help of MQTT:
|
|
192
|
+
|
|
193
|
+
- [psmqtt](https://github.com/eschava/psmqtt) - Report system health and metrics via MQTT
|
|
194
|
+
|
|
195
|
+
Find more at [awesome-mqtt](https://github.com/rhizomatics/awesome-mqtt)
|
|
196
|
+
|
|
197
|
+
For a more powerful Docker update manager, try [What's Up Docker](https://getwud.github.io/wud/)
|
|
198
|
+
|
|
199
|
+
## Development
|
|
200
|
+
|
|
201
|
+
This component relies on several open source packages:
|
|
202
|
+
|
|
203
|
+
- [docker-py](https://docker-py.readthedocs.io/en/stable/) SDK for Python for access to Docker APIs
|
|
204
|
+
- [Eclipse Paho](https://eclipse.dev/paho/files/paho.mqtt.python/html/client.html) MQTT client
|
|
205
|
+
- [OmegaConf](https://omegaconf.readthedocs.io) for configuration and validation
|
|
206
|
+
- [structlog](https://www.structlog.org/en/stable/) for structured logging and [rich](https://rich.readthedocs.io/en/stable/) for better exception reporting
|
|
207
|
+
- [hishel](https://hishel.com/1.0/) for caching metadata
|
|
208
|
+
- [httpx](https://www.python-httpx.org) for retrieving metadata
|
|
209
|
+
- The Astral [uv](https://docs.astral.sh/uv/) and [ruff](https://docs.astral.sh/ruff/) tools for development and build
|
|
210
|
+
- [pytest](https://docs.pytest.org/en/stable/) and supporting add-ins for automated testing
|
|
211
|
+
- [usingversion](https://pypi.org/project/usingversion/) to log current version info
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
updates2mqtt/__init__.py,sha256=gnmHrLOSYc-N1-c5VG46OpNpoXEybKzYhEvFMm955P8,237
|
|
2
|
+
updates2mqtt/__main__.py,sha256=HBF00oH5fhS33sI_CdbxNlaUvbIzuuGxwnRYdhHqx0M,194
|
|
3
|
+
updates2mqtt/app.py,sha256=uTgGgZX0xT7ee2-AB7tWTV8zKmtZiIWXHInmP8mrYZs,9357
|
|
4
|
+
updates2mqtt/config.py,sha256=VN594apCjeUAwCekl0ItEMx-4eSeJsZIamHzsKoS0Ns,6136
|
|
5
|
+
updates2mqtt/hass_formatter.py,sha256=6UfBhQLmFEYVVct_JeepIERwNvdwM2z8jkHAv-vOWa0,3191
|
|
6
|
+
updates2mqtt/integrations/__init__.py,sha256=KmNTUxvVWvqI7rl4I0xZg7XaCmcMS2O4OSv-ClsWM4Q,109
|
|
7
|
+
updates2mqtt/integrations/docker.py,sha256=3BQWgAENaoZjmJizrv_yHc3L6GXn8iQuUAXLcrXCS6g,28079
|
|
8
|
+
updates2mqtt/integrations/git_utils.py,sha256=ODCKecWnom1NEKsmDZ2vFmYfnVGtWUgq7svVGcOtSaU,4369
|
|
9
|
+
updates2mqtt/model.py,sha256=YkJyeoEgO1ApqEfcCmeMu9ROk9tOZPYxGx2oBkbXyy0,4657
|
|
10
|
+
updates2mqtt/mqtt.py,sha256=W5kerew922CwaPvaNczVm61bvh3DGJ3k41BNZ1WJuuE,14987
|
|
11
|
+
updates2mqtt/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
|
+
updates2mqtt-1.6.0.dist-info/WHEEL,sha256=eycQt0QpYmJMLKpE3X9iDk8R04v2ZF0x82ogq-zP6bQ,79
|
|
13
|
+
updates2mqtt-1.6.0.dist-info/entry_points.txt,sha256=Nt1kQQfJ1M2RvcRUnVxe3KCMiX8puHPqz-D7BwqV1L8,55
|
|
14
|
+
updates2mqtt-1.6.0.dist-info/METADATA,sha256=iVHtji5oJMxb05RD5rSoECjIgD_Bk6aa_vGwBQuCoyI,11769
|
|
15
|
+
updates2mqtt-1.6.0.dist-info/RECORD,,
|