Skip to main content

System update and docker image notification and execution over MQTT

Project description

Rhizomatics Open Source

updates2mqtt

Rhizomatics Open Source

PyPI - Version Ruff Coverage Tests pre-commit.ci status Publish Python 🐍 distribution 📦 to PyPI and TestPyPI Github Deploy CodeQL Dependabot Updates

Summary

Let Home Assistant tell you about new updates to Docker images for your containers.

Example Home Assistant update page

Read the release notes, and optionally click Update to trigger a Docker pull (or optionally build) and update.

Example Home Assistant update dialog{width=480}

Description

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.

Currently only Docker containers are supported, either via an image registry check, or a git repo for source (see Local Builds). The design is modular, so other update sources can be added, at least for notification. The next anticipated is apt for Debian based systems.

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 for details.

To get started, read the Installation and Configuration pages.

For a quick spin, try this:

docker run -e MQTT_USER=user1 -e MQTT_PASS=pass1 -e MQTT_HOST=192.168.1.5 ghcr.io/rhizomatics/updates2mqtt:release

Release Support

Presently only Docker containers are supported, although others are planned, probably with priority for apt.

Ecosystem Support Comments
Docker Scan. Fetch Fetch is docker pull only. Restart support only for docker-compose image based containers.

Healthcheck

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.

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.

!!! tip

Check healthcheck is working using `docker inspect --format "{{json .State.Health }}" updates2mqtt | jq`

Another approach is using a restarter service directly in Docker Compose to force a restart, in this case once a day:

restarter:
    image: docker:cli
    volumes: ["/var/run/docker.sock:/var/run/docker.sock"]
    command: ["/bin/sh", "-c", "while true; do sleep 86400; docker restart updates2mqtt; done"]
    restart: unless-stopped
    environment:
      - UPD2MQTT_UPDATE=AUTO

Target Containers

While updates2mqtt will discover and monitor all containers running under the Docker daemon, there are some options to make to those containers to tune how it works.

These happen by adding environment variables to the containers, typically inside an .env file, or as environment options inside docker-compose.yaml.

Automated updates

If Docker containers should be immediately updated, without any confirmation 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)

restarter:
    image: docker:cli
    command: ["/bin/sh", "-c", "while true; do sleep 86400; docker restart mailserver; done"]
    environment:
      - UPD2MQTT_UPDATE=AUTO

Environment Variables

The following environment variables can be used to configure containers for updates2mqtt:

Env Var Description Default
UPD2MQTT_UPDATE Update mode, either Passive or Auto. If Auto, updates will be installed automatically. Passive
UPD2MQTT_PICTURE URL to an icon to use in Home Assistant. Docker logo URL
UPD2MQTT_RELNOTES URL to release notes for the package.
UPD2MQTT_GIT_REPO_PATH Relative path to a local git repo if the image is built locally.
UPD2MQTT_IGNORE If set to True, the container will be ignored by updates2mqtt. False

Related Projects

Other apps useful for self-hosting with the help of MQTT:

  • psmqtt - Report system health and metrics via MQTT

Find more at awesome-mqtt

Development

This component relies on several open source packages:

  • docker-py SDK for Python for access to Docker APIs
  • Eclipse Paho MQTT client
  • OmegaConf for configuration and validation
  • structlog for structured logging and rich for better exception reporting
  • hishel for caching metadata
  • httpx for retrieving metadata
  • The Astral uv and ruff tools for development and build
  • pytest and supporting add-ins for automated testing
  • usingversion to log current version info

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

updates2mqtt-1.4.1.tar.gz (676.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

updates2mqtt-1.4.1-py3-none-any.whl (26.6 kB view details)

Uploaded Python 3

File details

Details for the file updates2mqtt-1.4.1.tar.gz.

File metadata

  • Download URL: updates2mqtt-1.4.1.tar.gz
  • Upload date:
  • Size: 676.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for updates2mqtt-1.4.1.tar.gz
Algorithm Hash digest
SHA256 2100c374c3f8c10c28a4b5a82fee7454c8e009044a4191bfa3bab6b2d54df739
MD5 56ecc7571661a7cd50a2c9efbf14f01d
BLAKE2b-256 9dfea9b557afaffeb7216a49144b1f5f53af1521e0e4c51d355946e9697b5c63

See more details on using hashes here.

Provenance

The following attestation bundles were made for updates2mqtt-1.4.1.tar.gz:

Publisher: pypi-publish.yml on rhizomatics/updates2mqtt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file updates2mqtt-1.4.1-py3-none-any.whl.

File metadata

  • Download URL: updates2mqtt-1.4.1-py3-none-any.whl
  • Upload date:
  • Size: 26.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for updates2mqtt-1.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 08aca12d6a0bf613e7efb599a19341b57368544fc5dfb8538baa02f519290f41
MD5 feed3508226c1055eda695f52fe9a307
BLAKE2b-256 058053c2ac93a665cb01d14873bedb94dbe2b5f50138046ac3e3345e6ce1acd3

See more details on using hashes here.

Provenance

The following attestation bundles were made for updates2mqtt-1.4.1-py3-none-any.whl:

Publisher: pypi-publish.yml on rhizomatics/updates2mqtt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page