Commit Graph
15 Commits
Author SHA1 Message Date
phil d45c309110 Moved V1 and V2 of the scripts into their own Repos and archived them
V1 - https://git.ncltech.co.uk/phil/Home-Assistant-Backup-Script-V1/
V2 - https://git.ncltech.co.uk/phil/Home-Assistant-Backup-Script-V2

Moved V3 code into main dir
Updated and merged README file
2026-11-06 23:16:49 +00:00
phil caae2fb707 Updated main README file 2026-11-06 22:59:58 +00:00
phil 1af0a20429 ## 3.2.1
### Fixed
- Backup failures caused by low disk space on the Home Assistant host are now
  reported as such, e.g. "not enough disk space on Home Assistant server
  (1.2 GB free, threshold 2.0 GB)", instead of only "failed to extract backup slug".
- A failed `ha backup new` now includes Home Assistant's own error message in
  the notification and log.

### Changed
- Free space is re-checked after the remote cleanup runs. If it is still below
  `STORAGE_THRESHOLD_KB`, a warning is sent to ntfy/Discord before the backup
  is attempted.
- The remote cleanup now logs how many backups it found, and says when none are
  older than `REMOTE_BACKUP_CLEANUP` days.
2026-11-06 22:53:27 +00:00
phil 0444e0d45c Fixed README version 2026-11-06 22:41:17 +00:00
phil 6b9bd80fa8 ## 3.2.0
### Added
- File logging to `/var/log/ha-backup.log`. Each line has a full date and time,
  and the file is appended to on every run.
- New `LOG_FILE` setting in `home_assistant_backup.conf`. Set it to a custom
  path, or to `"none"` to disable file logging.
- `ssh`/`scp` error output is also written to the log file.
- Deletions of old local backups are now logged.

### Changed
- All console messages now go through the same logger, so remote cleanup,
  notification failures and config validation errors appear in the log too.
- If the log file can't be opened (for example, no write permission to
  `/var/log`), a warning is printed and the backup continues without file logging.
- The terminal progress bar stays on the console only and is not written to the log.
2026-11-06 22:40:15 +00:00
phil 5c05a27ae2 Port Home Assistant backup script to Go (v3.1.1)
Rewrite home_assistant_backup.sh as a single Go binary that reads the
existing home_assistant_backup.conf unchanged.

- Create a backup over SSH, scp it locally, and prune old backups both
  on the HA host (when free space is low) and locally
- Send ntfy and Discord notifications at the same points as the script
- Drop the jq and yq dependencies: parse `ha backups --raw-json` and
  `ha backup new --raw-json` in Go, falling back to `slug:` line parsing
- Add timestamped progress output, a heartbeat while HA builds the
  backup, and live size/percent/speed reporting during the copy
- Build the Discord payload with json.Marshal and validate backup slugs
  before using them in remote commands
- Abort with a notification if the remote disk-space check fails
- Add -config and -version flags
- Build with CGO_ENABLED=0 for a static binary that runs on older glibc
2026-11-05 16:40:40 +00:00
phil 70e1b1cc6e Added version 3
Go port of the script
2026-11-05 16:28:52 +00:00
phil cab5d0cfda Updated the script so it now has a separate config file and also fixed issue calculating the storage on the server 2026-10-17 18:33:35 +01:00
phil ce835ec488 Forgot to upload the script 2025-02-01 15:34:17 +00:00
phil 4ca301bb8a Fixed main README.md typo 2025-01-05 18:24:01 +00:00
phil 686eed2422 Added SCP and SSH requirements into V2 README.md 2025-01-05 18:21:48 +00:00
phil b1d764f9b0 Updated script names to home_assistant_backup.sh 2025-01-05 18:19:24 +00:00
phil 400955fdb5 In the updated version of the script (V2), we've added a critical feature that checks the available storage on the Home Assistant server. If the available storage falls below 2GB, the script will automatically remove a defined number of days' worth of old backups, ensuring that the system doesn't run out of space. This storage threshold is configurable, and you can adjust the number of days' worth of backups to be retained according to your needs. This feature is designed to help manage storage effectively—because, as we all know, storage isn't infinite! 😄 Additionally, both V1 and V2 of the scripts now include much more detailed and comprehensive README.md files, offering users a clearer understanding of the setup, configuration, and usage. The documentation includes step-by-step instructions, explanations of configurable options, and tips for maintaining a reliable backup routine for your Home Assistant server. 2025-01-05 18:16:51 +00:00
phil e6b7068fe5 Added following additions: Ability to send notifications to Discord webhook. Ability to disable NTFY and Discord notifications if not needed. BACKUP_FILE_LOCATION variable to change the location when the backup files are located on the Home Assistant server. 2024-11-27 21:16:36 +00:00
phil 8af78dc249 Added V2 of the script 2024-11-27 20:36:02 +00:00