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
789 B
789 B
ha-backup v3.1.1
Go port of home_assistant_backup.sh. Uses the same home_assistant_backup.conf.
Build
CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o ha-backup .
Override the version at build time if needed: CGO_ENABLED=0 go build -trimpath -ldflags="-s -w -X main.version=3.1.2" -o ha-backup .
Check the version: ./ha-backup -version
Cross-compile examples: GOOS=linux GOARCH=amd64 go build -o ha-backup-linux-amd64 . GOOS=linux GOARCH=arm64 go build -o ha-backup-linux-arm64 . # Raspberry Pi / ARM NAS
Run
./ha-backup # looks for home_assistant_backup.conf next to the binary, then in cwd
./ha-backup -config /path/to.conf
Requires ssh and scp on the machine running it. jq and yq are no longer needed.