Created new add-on to backup snapshots to Google Drive

It works fine. Thanks a lot

Well, the good news is that it worked. The bad news is that it’s still a mystery as to why it would not add directly from my repository, and this is not a very good long-term workaround because you won’t get updates with this setup.

I’ll keep giving this some thought. It seems more likely now that the problem is with my repository rather than with my add-on. That at least helps narrow down where I need to focus. Thank you for your patience.

I get the following error when trying to perform the backup, any idea?

{“errorMessage”: “<HttpError 404 when requesting https://www.googleapis.com/drive/v3/files?q=name%3D’34347d59.tar’+and+‘hassio-backup’+in+parents+and+trashed+%3D+false&spaces=drive&fields=files(id%2C+name)&alt=json returned “File not found: .”>”}

You are using the wrong string for the google drive folder - follow instructions in the documentation. I had the same issue. :blush:

Blockquote

You must instead provide Google Drive’s unique opaque ID of the folder. Google Drive doesn’t make it easy to get this value. But, here’s how you can get it:

  1. In your favorite web browser, navigate to the Google Drive folder to which you plan to upload your files (create a new folder in Google Drive if you wish). Be sure that you have the perferred folder open so that its contents (even if it’s empty) are displayed.
  2. From the address bar of your browser, copy the last portion of the URL. That value is Google Drive’s unique opaque ID for the folder. Paste that value in for the backupDirID value in the configuration.

Blockquote

1 Like

hi guys,

is it possible to set up an automation to create a snapshot daily or once a week, i so could you please share the config code?

many thanks

Yes. It’s described in this thread.

1 Like

Version 1.1.0 is out now and it has this “purge” support added to it.

1 Like

I completely missed this on my search
Thank you

1 Like

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