v5.2.1 - Restore Script & Backup Improvements
New Features
-
Restore script — new
backups/restore.sh.sample, an automated companion tobackup.sh.sample, based onrestore_v16a.shby @JonMurphy (#836). One command restores a backup archive on the same machine or migrates to a new one:- Auto-detects the Powerwall-Dashboard directory from the script's own location
- Checks staging disk space before extracting (warns and offers
TMPDIRoverride — protects RAM-backed/tmpfrom multi-GB archives) - Non-destructive — moves existing InfluxDB
data/meta/walandgrafana.dbaside as.pre-restore.<timestamp>copies (rollback path) instead of deleting - Restores InfluxDB from the
influxd backup -portablesnapshot into a clean instance, then re-creates continuous queries from the archive'scontinuous_queries.txt(live CQ state, including customizations) withinfluxdb.sqlas fallback —influxd restore -portabledoes not reliably restore CQs (known InfluxDB 1.x limitation). CQ replay output is checked for errors (the influx CLI exits 0 even on failed statements). - Restores Grafana database and provisioning files with correct ownership, deriving
PWD_USERas the invoking user'suid:gid(SUDO_UID:SUDO_GID) — the same conventionsetup.shuses — with a guard against running from a root shell - Restores user configuration files (
*.env,telegraf.local, etc.) while skipping git-managed project files (powerwall.yml,telegraf.conf,influxdb.conf,VERSION) so an older backup can never downgrade the stack or break futuregit pull/upgrades - Restores
weather/weather411.confand.auth/Tesla cloud tokens (when present in the archive), so cross-machine migrations keep weather and cloud-mode credentials without re-authenticating - Finishes with
compose-dash.sh up -dso containers are recreated and restored settings (including the rewrittenPWD_USER) actually take effect
-
Backup script improvements —
backup.sh.samplenow auto-detects the dashboard directory (no more editingDASHBOARD=by hand), verifies the influxdb container is running and checks dashboard-disk free space before taking the snapshot, exports live continuous queries into the archive as a safety net, capturesweather/weather411.confand.auth/tokens, checks the exit code ofinfluxd backup(no more silently archiving a failed snapshot), verifies archive integrity after creation, creates archives with mode 600 (they contain credentials), and aborts with a clear message if the staging area can't hold the snapshot (withTMPDIRoverride). -
tesla-history
--dry-runand--version— new--dry-runoption to preview API actions without making calls, and--versionflag to print the build number. (PR #841)
Bug Fixes
- weather411 timestamp deprecation — replaced deprecated
datetime.utcfromtimestamp()calls (scheduled for removal in Python 3.12+) with the documented equivalent. (PR #839 by @youzer-name) - Ctrl-C during backup/restore — SIGINT now exits cleanly instead of continuing with partial data.
- CQ restore reliability — continuous query replay now detects failures (the influx 1.x CLI exits 0 even on statement errors), normalizes semicolons for batch parsing, and falls back to
influxdb.sqlwhen archive replay reports errors.
Documentation
backups/README.md— documents the restore script as the recommended method; manual restore steps retained as a fallback and corrected to exclude git-managed files and usecompose-dash.sh up -d.tools/DOCKER.md— replacednewgrpwith clearer log out/in instructions for the docker group. (PR #837)
Files Changed
backups/restore.sh.sample— new — companion restore scriptbackups/backup.sh.sample— rewritten with auto-detect, pre-flight checks, weather/.auth coverage, archive verificationbackups/README.md— restore documentationweather/server.py— timestamp deprecation fixtools/tesla-history/tesla-history.py— --dry-run, --version, build numberstools/weather-history/weather-history.py— --dry-run, --version, build numberstools/tesla-history/README.md,tools/weather-history/README.md— documentation updatestools/DOCKER.md— docker group instructionsVERSION—5.2.0→5.2.1upgrade.sh— version consistency
Contributors
Thanks to the community members who made this release possible:
- @JonMurphy — wrote the original
restore_v16a.sh, tested every iteration cross-machine (RPi5 → Dell OptiPlex), caught the CQ format mismatch, missing semicolons, SUDO_UID derivation, Ctrl-C trap, disk-space ordering, config glob simplification, and the compression time UX issue. Every real bug in the restore script was found by Jon on real hardware. (#836, PR #838) - @hulkster — feedback on filename timestamp collisions, compression time UX, and chmod 600 copy friction that shaped the final design. (PR #838)
- @mcbirse — tesla-history improvements:
--versionoption, build numbers,--dry-runoption refinements, and not counting standard API calls as paid usage. (PR #841) - @youzer-name — weather411
datetime.utcfromtimestamp()deprecation fix. (PR #839)