Add-on: Home Assistant Google Drive Backup

I’ve released a new version, v0.6, with some fixes and new features. This release includes:

  • Support for generational backup, which lets you keep older snapshtos on daily, weekly, monthly, and yearly rotations.
  • The ability to disable automatic snapshots, for example if you already have an automation for creatign backups and just want this to back them up to Google Drive.
  • Better logging and easy access to the debug logs (if you need to file a bug for example) from a top level menu.
  • A menu option for “simulating” stale backups.
  • Some better error messaging when you run out of space in Google Drive or your credentials expire.
  • Moved “easy” authentication to a webserver, so project credentials aren’t stored locally.
  • Added an option to authenticate with Google Drive by creating your own client secret and client ID, in case you don’t trust my server.

I’m not planning to add support for creating partial snapshots in add-on any time soon, but if you’re interested in setting up a slightly more hacky solution then with the latest release (v0.6) you could:

  • disable automatic snapshots in the add-on, which will still make it upload any snapshots it finds to drive and cleanup old ones. It just won’t create new ones on a schedule automatically.
  • Create an automation that calls hass.io.partial_snapshot on a daily schedule (or whatever schedule you want) to handle creating partial snapshots to your liking. This thread has some guidance for using that service.

You wouldn’t get staleness notifications anymore if creating the snapshot failed, but you’d still be notified if one of the snapshots couldn’t be uploaded to Google Drive. Doming soemthign like this should work flawlessly with generational backups too, if you plan to use that.

What would you be interested in calling from node red? Hassio already exposes a service for creating snapshots (this add-on basically just calls that) and the state of the snapshots are already exposed through sensors that node red can read.

Actually I’m using another addon for GDrive Backup and I call it X minutes after calling the Snapshot.

When I asked my question, I didn’t notice that you can define this directly in the config.

Thanks for making this! works perfect.

Will there be an opportunity to make hourly backups in a given time frame in the future? For example, every X hours in the period from 09.00am - 09.00pm.

You can specify the time of day, but the add-on won’t do anything faster than once a day.

If you want a more custom schedule, you can set time_between_snapshots=0, which will prevent the add-on from creating snapshots on a schedule, and then create an automation that calls the hassio.full_snapshot service to create snapshots using whatever rules and intervals you configure it with. The add-on will still upload snapshots you create like this to Google Drive, cleanup old ones, etc.

Out of curiosity, what are you doing that makes hourly snapshots desirable? Even daily seems like overkill to me.

Beeen running this now for some week and it works great. Best backup addon. Also, very nice that it implements the security that it only has access to the specific folder in Drive. Some of the other addons get access to everything on ones Drive which is really dangerous.

Great work!

So, saw this in the log. What needs to be done?

api_password is going to deprecate. You need to use a bearer token to access /api/states/binary_sensor.snapshots_stale

Thanks for the explanation. If I have time, and change the one or the other of the configuration files, it is great to fall back on an “intact” version in case of errors.

This seems to have broken my Home Assistant. I installed it, went through the motions, everything worked fine and then suddenly HA frontend became inaccessible, can’t SSH in to it - it’s completely dead. Any idea how to rectify?

Ironically, I never back it up so wanted to use this addon to do that.

EDIT: After about 20 minutes of waiting HA has finally started up again but the addon has not started on boot. I think I’ll just leave it and find another way to back up.

The add-on runs in its own little docker container that only starts up after home assistant (like any add-on) so its unlikely to be able to prevent HA from booting, but if I had to guess it could be:

  • Your instance has gone non-responsive while its creating a snapshot. Unlikely but possible, I’ve seen my little rpi get pretty sluggish while it struggles to compress a big sensor database.
  • Creating a snapshot made you run out of space. Home assistant doesn’t really handle an exhausted disk well and to the best of my knowledge Hassio will happily run the system into the ground if it doesn’t have enough space to make a snapshot. I think you should be able to pop the SD card into another computer to verify if this is the case if you’re running this off an rpi.

This looks particularly interesting. Loving the web front end. I wonder though if this could go a step further with both onedrive and dropbox integration :thinking:

2 Likes

Hi,
this looks really good, just one question

whats the difference between this one and this one linked below

Feature request: Ingress :slight_smile:

1 Like

@phairplay Some of the existing backup add-ons are similar (especially that one), but the problem I’ve had with most things in Home Assistant is that its a huge pain to robustly configure. I’m a pretty adept technology enthusiast, and it still takes me hours to adapt every add-on/plugin/feature to work reliably.
Right out of the box when you install this add-on and authenticate it with Google Drive:

  • It starts making snapshots and backing them up.
  • It has default settings that make sense for most people.
  • It notifies you in Home Assistant if it runs into problems (other notifications, like mobile, are easy to configure too, see the FAQ).

I’ve designed the web UI around making very clear what its doing, eg when is the next snapshot, how often they happen, when was the last snapshot, etc. When its doing something with a snapshot (creating one, backing one up, etc) I also try to make that clear. You don’t have to set up any node-red flows, automations, service calls, or lookup esoteric yaml settings to make it work well or understand what its doing in the background.

Errors are presented front-and-center in the UI so you don’t have to parse through logs. I also haven’t seen an add-on that makes recovery simple, eg if you want to restore a snapshot from a fresh install. I’ll be pushing a new release soon (optimistically today) targeted at this. I’m getting pretty close to what I envisioned this being a completed product, but its still a work in progress so some of the differentiating features are yet to come.

2 Likes

@teachingbirds Ingress might be a bit complicated for this add-on to support because of how Google authentication works. The authentication mechanism needs a way to redirect the browser from Google’s auth page to an address that hits the add-ons webserver. Its also nto clear to me if ti can be enabled in a way thats backwards compatible with ingress-unaware versions of Hassio. Ingress is still a pretty new feature (just a few weeks old I think) and the docs on it are a little sparse, so I’ll spend some time seeing if I can make it work.

1 Like

I made a small unannounced release last week, and today I’m releasing a much bigger one. This represents the completion of the feature set I imagined when first creating the add-on, thank you to those of you who have been testing this and filing issues. Refresh the add-on store page to make Hassio see the v0.8 release.

Since the last release announcement I made, the current version includes:

  • Passwords you can configure archives to be saved with a password (details).
  • Partial Snapshots You can exclude specific folders and addons from scheduled snapshots (details).
  • Settings menu. You can change the add-on’s settings from a form within the add-on web UI. This is equivalent to editing the add-on’s settings from the Hassio dashboard (they both save to the same place), but its much less error prone. Especially for configuring partial snapshots.
  • UI tweaks Lots of little tweaks everywhere, and now it renders well on everything down to a phone sized screen.
  • Upload Upload snapshots from Google Drive back to Hassio with one click form the “Actions” menu.
  • Error Reports Optionally, you can enable sending error reports to a database I maintain. By default this is off but it really helps me make things work better if you turn it on (details).
  • Download The UI includes a direct link to downlaod snapshots from the browser (Actions -> Download).
    Resue Existing Snapshot Folders If you install the add-on fresh, it trys to find the last snapshot folder in Drive and reuse it
  • Restore Together, this release makes an easy way to restoring snapshots in the event of total failure (eg the SD card on your raspberry pi kicks the bucket). This make for a very convenient way to restore an old snapshot on a fresh install. For example if your HA instance died you could:
    • Boot up a fresh Hassio, install the add-on and connect it with Drive. Your existing snapshots will show up.
    • Connect the add-on with Google Drive (it will find your old snapshots)
    • Click Actions -> Upload on the snapshot you want to restore. Wait for the upload.
    • Click Actions -> Restore to be taken to the Hassio restore page, where the uploaded snapshot shows up.
  • Logging Shows a link to debug logs in the top right of the web UI and when it gets an unexpected error. Usefull if you need to file a bug with me.
  • Fixes Resolves a few bugs users have noticed, especially one that would cause it to always fail and hog memory large for very snapshots. Special thanks to whoever enabled error reports so I could be made aware of this memory error.
5 Likes

Great work awesome add-on

Thank You

Thanks for the add-on. Installed it, and had it working in 5 min!