It appears that the answer is yes. Select the backup particular file, and it provides a screen with “Select what to restore” with tick boxes of each item. For HA core it has tick boxes for “settings” and “history”, for AddOns, its a tick box for each AddOn
I also use the Samba backup add-on as well but I don’t know if it will continue to work with 2025.1 since it call’s HA’s backup service. Hoping to get more info on this option since I don’t want to use encryption either.
The team eluded to how some of us use the backups as our version system to find older files when needed, and not having access to them any more is a deal breaker for me.
I don’t mind trying to use a python decrypt script though; hopefully they will make that available upon request.
But you can’t open the file from a saved local network location and browse the file to extract just one file or folder. Tell me how and I might re-install the update.
The time of the auto backup is an issue too as you can’t alter it
My current 3-2-1 involves using Restic to backup my Home Assistant backups. Once backup integrations are a thing, a Restic integration may be feasible.
Many backup programs like Restic offer:
- encryption
- compression
- deduplication
Having all 3 managed by the backup program makes for “better” results across all 3. I hope the backup/restore integration architecture will enable a fully-capable backup to handle all 3 directly.
In pre-2025.1 HA, backups are tar of tars (up to 3 layers of tar and with compression on some of the layers). For these, Restic was not able to effectively de-dupe, so the data movement that comes with 3-2-1 backups was more than it could have been. To get around this, I wrote some scripts that unpack the HA backups and repack them if/when needed for restore.
With 2025.1, this repacking may not be possible. In the near term, I hope a “disable encryption” option is added, and longer term, integrations that enable fully-capable backup solutions to do their thing without friction will be great.
For now it still works. How long…noone knows, i guess…
So I ran a couple of tests to see if there was a way:
In one test, I used the “Backup Now”, which unfortunately still leaves the archive encrypted.
The second test, I used the Service/Action “Home Assistant Supervisor: Create a full backup”
action: hassio.backup_full
data:
name: Test Unencrypted2
This archive is unencrypted and the individual files can be browsed/opened.
Thanks, that’s interesting I will have a play around on my test HA install tommorrow.
When I try to download (10MB/s) a 4.5GB Backup from the Homeassistant cloud I am getting an unauthorized error after 5 minutes. Maybe the token vakidity is a little bit too short?
I love the new backup feature as with that I’m getting rid of my current additional backup addon.
But somehow I only have HA Cloud as a backup location and not the local storage (aka “This system”):
any ideas why?
For me its not possible to set any number for backups and days as well.
It might be a browser problem. I do have latest FFesr.
edit:
This happens only at the first backup config at custom level.
Now I choosed the automatic settings and afterwoods I can change everything now.
Please provide an decryption utility so in case we can just extract a single file from the backup. thx
FYI, it’s not a stand-alone tool, but I was able to hack the code in HA here (backup_restore.py) to decrypt and extract a backup.
My hack for what it’s worth was to:
1.wget https://raw.githubusercontent.com/home-assistant/core/8a880d613468c27b51c066ae22365011960ef8af/homeassistant/backup_restore.py
2. Delete some stuff that wasn’t needed and didn’t work for me (HA_VERSION stuff, and fitler=
). I didn’t investigate why filter=
wasn’t working for me - maybe a version issue with my securetar
. Patch text below.
3. mkdir /tmp/foo
for where I wanted to test it out. This is hard-coded into the patch as restore_backup("/tmp/foo")
.
4. make a json file in that directory : /tmp/foo/.HA_RESTORE
in the form that the backup_restore.py
expects.
{
"path": "/home/pi/home_assistant/backups/8a24d68e.tar ... ie, wherever your backup is",
"password": "****-****... this is the HA backup encryption key",
"remove_after_restore": false,
"restore_database": true,
"restore_homeassistant": true
}
python backup_restore.py
The patch:
--- backup_restore.py.1 2025-01-04 09:46:13.612253029 -0800
+++ backup_restore.py 2025-01-04 09:49:44.161357293 -0800
@@ -12,10 +12,8 @@
import sys
from tempfile import TemporaryDirectory
-from awesomeversion import AwesomeVersion
import securetar
-from .const import __version__ as HA_VERSION
RESTORE_BACKUP_FILE = ".HA_RESTORE"
KEEP_BACKUPS = ("backups",)
@@ -101,25 +99,16 @@
ostf.extractall(
path=Path(tempdir, "extracted"),
members=securetar.secure_path(ostf),
- filter="fully_trusted",
)
backup_meta_file = Path(tempdir, "extracted", "backup.json")
backup_meta = json.loads(backup_meta_file.read_text(encoding="utf8"))
- if (
- backup_meta_version := AwesomeVersion(
- backup_meta["homeassistant"]["version"]
- )
- ) > HA_VERSION:
- raise ValueError(
- f"You need at least Home Assistant version {backup_meta_version} to restore this backup"
- )
with securetar.SecureTarFile(
Path(
tempdir,
"extracted",
- f"homeassistant.tar{'.gz' if backup_meta["compressed"] else ''}",
+ f"homeassistant.tar{'.gz' if backup_meta['compressed'] else ''}",
),
gzip=backup_meta["compressed"],
key=password_to_key(restore_content.password)
@@ -130,7 +119,6 @@
istf.extractall(
path=Path(tempdir, "homeassistant"),
members=securetar.secure_path(istf),
- filter="fully_trusted",
)
if restore_content.restore_homeassistant:
keep = list(KEEP_BACKUPS)
@@ -182,3 +170,12 @@
backup_file_path.unlink(missing_ok=True)
_LOGGER.info("Restore complete, restarting")
return True
+
+
+if restore_backup("/tmp/foo"):
+ print("yay")
+else:
+ print("boo")
This Backup topic brings to the top of my head how I will deal with a possible disaster. Ok, I have a daily backup, now what?
If Home Assistant fails to start, I guess I will flash the SD from scratch, put it back and restore the backup (I have RPI5 + NVME SSD, with data moved to SSD and SO in the SD card). But how much time does this take? It’s not something I can do remotely, right?
Worst scenario is a hardware failure. Now what? Run to buy other Raspberry, or to install Virtual box/VMware and try to make it work, or just cry and apologize to my family.
I’m starting to think about a production environment and a restore environment (in my personal computer or buying a spare RPI? What about the ZigBee dongle?), and automate the most I can to switch as soon as possible and without much knowledge (maybe I’m not at home when disaster comes).
Interested in trying this but not fully sure what to do here. I grabbed the python code - do I just delete the lines you marked in red (- minus sign) and add your green lines? But also, what’s an example of what to put in a JSON file called .HA_RESTORE
- that’s not clear to me.
Thanks for the work on this!
Better than nothing but I want the ability to look at individual files. My most common case is I mess up one dashboard or say my template sensors yaml. So it would be amazing to be able to browse and view the file and just copy / paste it.
Being able to restore just core config without history I guess will help but it’s frustrating we cannot browse our own files with a password
Oops - “make a json” step - I see your example there. going to try this out when I decide to upgrade.
You can make an unencrypted backup by calling the action backup.create from the developer tools actions. (or by an automation)
OK then. How about "encryption which is enabled by default (because we all know we don’t read) but which can be disabled if the user wants to.
I create my own backups, including off-site storage following the 3-2-1 rule but I DON’T want encryption. I want to be able to read the backup and extract a single file from it if need be. I can’t do that now. Not with WinRar (7.01) and not with the extraction tool that comes with my Synology DS224+.
See my reply #49 above
The main “wrong” here is that dev’s obviously believe that backups are here for HA crash occasion only, which can’t be further away from truth. In all years of my HA existence i never had a HA crash yet (ok, call me lucky…), so i never needed a backup for this reason. But i did mess up a piece of yaml code many times, and extracting a piece of old working one from my backup saved me hundred’s of times.