I couldn't find a Home Assistant integration for Backrest, so I built one [HACS]

Backrest for Home Assistant

I run Backrest on my homelab and wanted all my backup stats on my Home Assistant
dashboard alongside everything else. Went looking for an existing integration,
couldn’t find one so I built it myself.

For anyone who doesn’t know, Backrest
is a self-hosted UI and scheduler for restic backups. If you’re using it to manage
your backups, you can now pull everything into Home Assistant.


What you get

Per-plan sensors

  • Last Backup Time & Status (Success / Warning / Error / Cancelled)
  • Last Backup Duration
  • Bytes Added & New Files (last backup)
  • Bytes Added & Backup Count (last 30 days)
  • Failure Count (30 days)
  • Next Scheduled Backup
  • Hours Since Last Backup

Binary sensors

  • Backup Running
  • Backup Stale (configurable threshold per plan)
  • Last Backup Failed

Buttons

  • Trigger Backup
  • Apply Retention Policy
  • Run Prune / Integrity Check / Refresh Stats / Unlock Repository

Some automations you could build with this

  • Push notification when a backup fails
  • Alert when a plan hasn’t run in over 25 hours
  • Trigger a backup before a planned shutdown or power cut

Installation

  1. Add this as a custom repository in HACS:
    https://github.com/vakhariaheet/backrest-hacs
  2. Install Backrest Backup Manager
  3. Restart Home Assistant
  4. Settings → Devices & Services → Add Integration → Backrest

Works with both authenticated and no-auth Backrest setups. HTTP and HTTPS supported.


Links

Still early days so feedback is very welcome especially if your setup looks
different from mine. Happy to fix things.

4 Likes

Nice work! I just started using Backrest and wanted to get notifications from it, this should do the job.

One oddity so far -- it created system entities and showed that "backup" as stale. I think I figured out this was the scheduled cleanup tasks, such as check, prune, and forget, which I have set to run monthly. I'm not sure those should be treated the same as backups. But for me these aren't as important to monitor, so I'll just disable those entities for now.

Thanks for the contribution!