Add-on: Home Assistant Google Drive Backup

Thats pretty funny, I think I know exactly the video you’re talking about because its what kickstarted my motivation for making this add-on.

In a few releases (once ingress is working + a few weeks probably for stability reasons) I plan to start publicizing this in places like that. There are a number of reddit threads also where people are trying to cobble together similar solutions.

I’ve made another release, v0.91. Refresh the add-on page to make it see the new version. No significant features this time, just some usability tweaks and polish, especially for new installers.

  • Snapshots now present the newest up top (ie. reverse chronologically).
  • A warning icon shows up on a snapshot if its the next to be deleted when a new snapshot is created.
  • Settings menu asks for confirmation if you try to leave it after making unsaved changes.
  • “Getting Started” screen now tells you what is going to do after you authenticate with Google Drive with your configured settings, eg delete N old snapshots and backup M newest snapshots. Also changed up the page’s formatting for readability.
  • Added a TOS and privacy policy.
6 Likes

Amazing work there mate @sabeechen

Great “attention-to-detail” and pretty clever configuration options.

If I could feature request something: Maybe have a way to avoid deletion of some backups (either the user generated ones or maybe by adding a keyword in the name like "[keep] ") would be great because sometimes you have certain HA setups that are just perfect and want to retain them just in case.

Other than that, seems like a pretty dope addon man!

2 Likes

Like @forums2012 suggestion!

1 Like

Hrm permanent retention would be nice. I’ll try to add it into the next release as something you can select from the actions drop down on a snapshot.

1 Like

Awesome. Thanks a lot mate.

Loving the addon so far. Great “user-first” approach man!

Pushed another release just now, refresh the add-on store page to see version 0.92.

  • Added the ability to keep snapshots forever in Home Assistant or Google Drive. Try clicking “Never Delete” from a snapshot’s menu.
  • Added better help and messaging for the majority of errors I’m seeing come through (mostly issues reaching Google’s servers). Special thanks again to those who’ve opted in to sending error reports, it really helps me track these down.

There is one outstanding bug that I saw come in through an automatic error about “non timezone aware” time comparisons. If you’re reading this and saw that error, please reach out to me. I’ve been driving myself insane trying to reproduce it. I’d really like to figure out how you managed that. Please.

2 Likes

Holy smokes, amazing update man!
That was pretty quick.

Admire your attention to detail yet again.

  • Option of choosing drive or hassio or both
  • An icon showing that snapshot has been locked
  • I had a snapshot that was about to get deleted (had the yellow warning) I was kind of expecting a developer to miss that GUI thingy, but nope our man @sabeechen is amazing!
  • great documentation yet again
  • number of snapshots also displaying how many are kept indefinitely

You sir are awesome!

Although I am pretty confident that you might have taken care of this, but the thing to see is whether or not the last but one snapshot gets deleted or not.
I have a limit of 5 with the oldest locked (which was supposed to delete tonight after a snapshot gets created). As soon as the new backup is created, there will be 6 and maybe the system will try to delete the last one (which won’t be deleted because of the lock option) (but maybe it might try to delete the last but one)

Also, I’ll report back tomorrow if the addon is able to delete the oldest unlocked backup day after to maintain the “keep in hassio limit”

Love the ability to choose Never Delete, and that the saved snapshots don’t count toward the number saved. May I ask for a feature request? I’d love it if I could give the snapshot a custom name when I choose to make one manually. I like to name them when I make one for a particular HA version update, or when I’ve made a significant change somehow. These are typically the ones I’d mark for non-deletion. I know I can do this via the regular snapshot page, but it would be nice to just do/see everything in one place.

Thanks for all the new features!

Thats a solid idea, for a while I’ve wanted to present a confirmation dialog for creating a new snapshot (kinda janky to have the add-on “do something” without asking confirmation first) so I’ll add that in and give an option to set a custom name for on-offs while I’m at it. I’m also going to make the snapshot name configurable while I’m knee deep in that particular part of the code.

1 Like

Just pushed version 0.93. Refresh the add-on store page to see the new version. This release includes:

  • Custom Snapshot Names change the name template for snapshots in the settings menu. You have an assortment of variables at your disposable to set use custom dates, verison strings, etc.
  • One-off Snapshot Names When making a new snapshot outside of the schedule, you’re given the option to set a custom name and modify the “Never Delete” settings for just that snapshot.
  • Better Errors Added some more dialogs for common errors from Google Drive (HTTP 500 and 404).
  • Debug Information Erorr reports now include HA version, HassOS version, Supervisor version, google server DNS resolution information, and metrics about snapshot sync progress to aid in debugging.
  • Spelling Fixes some spielling.
5 Likes

This is brilliant! Thanks for adding my request! I can’t believe how quickly you did that :slight_smile:

Not sure if that’s on purpose, or needing a fix :wink: :grin:

I think you’re providing a helpful alternative so don’t mean for you to interpret this as as attack, but I’m going to try to use this as an opportunity to provide a wall of text making a case for this add-on instead. Been meaning to get this particular rant off my chest for a while :stuck_out_tongue:

I totally agree that robocopy can get the job done. Before making this add-on I spent a lot of time researching how everybody else was setting up there snapshots/backups. I’m pretty impressed at the work some have done linking together automations, scripts, node red flows, and cron jobs to make something that works. My main beef is how long it takes to set up those up and how prone they are to failure. Rolling your own solution to make snapshots, copy them somewhere, and delete old ones it at least a few hours of work, configuration, and frustration (or a full weekend for someone new). Home Assistant is not an easy system to learn. Plus at that point you’ve built what is essentially a custom software product for personal use that you have to debug and maintain, and honestly, most people using Home Assistant are not experienced programmers who know how to do that effectively. When you install this add-on you’re 3 clicks away from having something that:

  • Creates snapshots regularly.
  • Backs them up reliably.
  • Cleans up old ones in both places.
  • Notifies you when it isn’t working (eg if Google Drive is full).
  • Doesn’t require educating yourself about external tools or API’s (not even Home Assistant’s!)

For people who want more flexibility, I’ve provided a ton of configuration options for partial snapshots, password protection, historical (generational) backups, custom snapshot names, and notifications. All of which can be configured from a very convenient and self-explanatory web interface. When something does go wrong, I’ve gone to great lengths to try and make it clear what the specific nature of the problem is and recommend steps to resolve it. Every error I’m aware of (at this point) comes with a help dialog recommending a remedy. Where possible, I’ve provided links to get more information so you don’t have to go digging around through documentation and forums.

My background is in large data systems, and I tried to apply the lessons learned there about reliability, documentation, and notification to this add-on. Namely:

  • Always retry errors with exponential backoff.
  • Never hide errors, always provide guidance when they come up.
  • Always require confirmation when changing something (eg deletions).
  • Always provide an indication of what the application is doing and why (mainly through the web UI, but also sensors)
  • Only notify about problems that have existed for a while so you can ignore transient errors and avoid alarm fatigue.

For robocopy in particular, that adds another big point of failure. If you’re like me then someday in the future you’ll forget that you set this all up, reinstall your OS and then not notice that backups aren’t happening until you actually need one and its too late. There is value in keeping everything self-contained to the machine also running Home Assistant.

5 Likes

I get you, I just wanted to give my two cents but it ended up being about a buck fifty after I started writing :expressionless:

Have you tried installing the addon? You might find the setup easier than you’re expecting.

Hi, just installed it today and I can’t think of a simpler solution for cloud backups than this addon.
I don’t need to know anything except my google account login, everything else is self-explanatory and well guided.

Great work, thank you so much @sabeechen

1 Like

I also see this in my log today. Is this a known issue?

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

I think its a Hassio bug (context), I expect to see the log message go away with the next Hassio release.

Aaaaaaaaand I’ve released version 0.94, refresh the add-ons store page to make sure it sees the update. This release is targeted at bug fixes.

  • Fixes An issue that prevented it from seeing new snapshots in Hassio up to an hour after they were created.
  • Fixes A number of issues with snapshot name templating.
  • DNS Info Google server DNS information and server availability (eg a ping result) is displayed in the error dialog when the add-on sees timeouts or read errors from Google. This is to help a few users who have reached out about that particular problem.

In upcoming releases I’m going to be targeting ingress support (now that its looking pretty feature complete) and some features to make generational backups less confusing. In the near term I’m going to be offline for a few days so next release probably won’t be for another week, bear that in mind if you try to reach out to me.

4 Likes

I just did a little digging around on the console Google provides for inspecting how much traffic is being used by my app, and I’m pretty sure I’ve got over 1000 active users, not including those who opted to use their own API credentials. Wow!

11 Likes