Created new add-on to backup snapshots to Google Drive

Not sure how the purges is supposed to work - I have 2 backups on the rpi and on google drive I had 4. So I just have removed 2 in hassio.

In the addon I have purge parameter set to 3, but the response from the web call is:

{"fromPattern": "/backup/*.tar", "backupDirID": "funny_string_here", "fileCount": 2, "alreadyCount": 2, "backedUpCount": 0, "deletedCount": 0}

So that means I have to leave the files in hassio until the addon has done its work and only then I can remove them? I suppose it uses the filenames of the image files to look them up in google drive in order to decide what needs to be done: keep or remove?

This is very useful - thank you for sharing it!

Jhh

Actually, thatā€™s not what itā€™s doing. The purge takes no consideration of Google Drive whatsoever, nor does it consider what files in your hassio backup folder have been backed up at all. The ā€œpurgeā€ feature is simply to purge older files from your hassio backup folder. The number, labeled ā€œpreserveā€, is the number of files that you want to preserver in your hassio backup folder. So, to say ā€œpreserve 3ā€ means to say ā€œI want you to delete all the older files in my hassio backup folder, but preserve for me, please, the newest 3 files.ā€

Iā€™m sorry that wasnā€™t clearer in the Readme.

By the way, Iā€™m contemplating adding a similar feature for Google Drive where you can tell it to keep your Google Drive purged of older backups, while preserving more recent ones.

I donā€™t look into google drive that often so if cleanup was automated that would be great. Iā€™m not sure if the readme is unclear as I took it for granted that everything the addon did was on the google drive side :blush: once more.

Okay. I had a little time on my hands, so I went ahead and added the purge from Google Drive option. Version 1.2.0 of the add-on is available now.

Earlier had an issue where it created a duplicate file on google drive but installed latest version now and it looks really good! Synched and cleaned up nicely.

Thx!

1 Like

Itā€™s always possible that there was/is an issue with my add-on. But, keep in mind that it does have the potential to create apparent duplicates. If someone other than my add-on creates a file on your Google Drive with the same name as one of the files that my add-on copies to your Google Drive, it will not detect a duplicate, because it has no visibility to the file that it did not create. It can only see files that it creates itself.

Great idea! I was struggling with this for a while, so I had to put something together with Samba, and then SyncToy and Task Scheduler on my Windows computer to sync it to my Google Drive folder

1 Like

Hi there,

Thanks for the plugin! Really keen to give it a go, but a have a question regarding security and how it would work with it.
To allow it to work, youā€™d need to set up a port forward from external 8055 to internal 8055 right? If so, how safe is this?

Thanks again

Actually, no, the add-on does not rely on port forwarding at all. In fact, I strongly recommend against exposing this port outside of your home network. You can either setup a scheduled Home Assistant Automation (an automation with a time-based trigger) to run your backups periodically and automatically, or, you can request backups manually by calling the REST service (the /gb/doBackup operation) from somewhere on your home network. The only reason imaginable to setup port forwarding would be if you want to be able to manually initiate a backup while you are away from home. But, I wouldnā€™t recommend it.

Ok, then maybe Iā€™m missing somethingā€¦
To set the plugin up initiallyā€¦ I click on the Open WebUI link which sends me to https://ExternalURL:8055/gb which isnā€™t allowed.

Thats why I thought that the ports need to be forwarded and am not keen to do so at all.

How would one get around this?

1 Like

Use your local IP - so http://xxx.xxx.xxx.xxx:8055/gb/ should work. No need to open anything. On my setup it is http rather than https.

2 Likes

Aaah, I thought I was overcomplicating it for myself! :man_facepalming:
Thanks for the help!

1 Like

Thanks for making this add-on. It just saved me a ton of frustration. My SD Card decided it would be a good day to die. I had just set up your add-on to backup to my google drive this past weekend. A simple restore later, and my system is back in action!

2 Likes

Wow! Iā€™m glad to hear that it helped you out. Thanks for sharing this.

I just tried to set this up but I get ā€˜server error 500ā€™ when I click ā€˜ingest codeā€™ā€¦ any ideas?

is that an ssl error?

not sureā€¦ I am trying to do it within my network so the SSL cert isnā€™t for that addressā€¦ maybe thats the issue?

most probably. Like Google Assistant only works over SSL (the component) You have to give Google a https endpoint to connect to. I would assume google drive is the same.

You could use caddy to proxy to whatever you want and use thatā€¦ that would work.

i temporarily opened the port so I could go through the auth process using my duckdns address and that worked.

This backup is awesome, also saved me a bunch of pain when my SD Card decide to lock itself and became unusable. Luckily Iā€™d just set this up with a fresh back-up and was running a few hours later again.

Question, if I setup a weekly snapshot (as per this thread, based on the advice earlier - Hassio 0.61 Snapshot Service) - how do I get it to also trigger this tool to then run the backup?