Skip to main content

Borg -> MQTT

Send borgbackup updates over MQTT, including support for Home Assistant MQTT autodiscovery. Sensors include

  • Total/unique chunks
  • (Un)compressed size
  • Depuplicated (Un)compressed size
  • Total number of backups
  • Most recent backup

Installation

Install on any system as python library using

pip install borg2mqtt

Whatever system it is installed on will need the ssh keys for your backup locations.

Configuration

borg2mqtt reads MQTT and repository information from a configuration yaml file. An example configuration file can be generated by running

borg2mqtt -c path/config.yml generate

If portion path/config.yml is left off, borg2mqtt defaults to saving/looking for the configuration file at $HOME/.config/borg2mqtt/config.yml.

The configuration file is mostly self-explanatory and looks as follows:

# -------------- Sample configuration file -------------- #
# These are the default MQTT values - none are required
mqtt:
  host: localhost
  port: 1883
  user: ""
  password: ""

# Put in as many repositories as desired
repos:
    # Required
  - repo: user@address:/path/to/backup
    # Optional, defaults to the same as repo if not specified
    # This will be used to make entity_ids in HA
    name: Local Data
    # Optional
    key: ""
    # Optional, will use the given ssh command
    # Can be used to authenticate with a ssh key (ssh -i /path-to-key)
    rsh: ""
    # Optional, choose one of kB, MB, GB, TB. Defaults to GB.
    units: GB

Usage

To send the Home Assistant MQTT auto-discovery message, run

borg2mqtt setup

Then to update sensor information run

borg2mqtt update

This can be included in a cron job, borgmatic, etc to send updates as needed. As this is a "local push" option, it should be more efficient than any local polling option that could be included in Home Assistant.

Additionally, a single repository can be updated through it's name found in the configuration file by

borg2mqtt update -n "My Repo"

Additional Options

All options can always be shown by using flag --help. Additionally, varying levels of verbose output can be included through -vvv, put before the command type.

Contributing

All pull requests are more than welcome. Please usse the pre-commit hooks to verify your code before making a pull request. If any bugs are found, feel free to open an issue with your verbose output (-vvv) included.

Metadata

Release files for borg2mqtt 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for borg2mqtt 0.2.1
File Size Uploaded
borg2mqtt-0.2.1.tar.gz 146.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for borg2mqtt 0.2.1
File Interpreter ABI Platform
borg2mqtt-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 154.5 kB

Release files / borg2mqtt-0.2.1.tar.gz

Download URL borg2mqtt-0.2.1.tar.gz
Size 146.2 kB
Tags Source
SHA-256 checksum
How to use checksums
7e23b68f96cef5820012a2c6fbefed70f24416e59168915e2c80bf6e803e69bf
BLAKE2b-256 checksum
How to use checksums
904d11ce8c9a4f8cad212bb65c3ba4c5b5af60fa2cf50e023e9eed9365a7128f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 11, 2026.

Transparency log

Release files / borg2mqtt-0.2.1-py3-none-any.whl

Download URL borg2mqtt-0.2.1-py3-none-any.whl
Size 8.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6fb011124da829068547080b4718a09516ce6ab15aaf0c7c493901bd1e0788e0
BLAKE2b-256 checksum
How to use checksums
beea7c8db2b43d9ddcc84a2219e15936e7bd49ff57f6ac6d5867357be98cf47d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 11, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page