Setting up Google Drive backups in Home Assistant

Disclosure: This post contains affiliate links. If you click through and make a purchase, I will earn a commission, at no additional cost to you. Read my full disclosure here.

Thou shall not use Home Assistant without regularly backing up your configuration. Despite becoming increasingly stable and harder to break, the first thing I suggest doing after setting up Home Assistant is to configure automated backups. Especially if you are using a Raspberry Pi. While the backup prompts Home Assistant automatically presents when installing an update, are great, they aren't quite enough. Let me guide you through configuring Home Assistant to automatically send backups to Google Drive and sparing you any future headaches.

It used to be the case that YAML-errors were the main reason for backing up your Home Assistant configuration. In the early days, before any integration could be set up in the Dashboard, it was all too easy to stop Home Assistant from starting up due to configuration errors. The more user-friendly Home Assistant we have to today does much to circumvent that. However, what it can't do is stop a microSD card from corrupting or braking altogether.

You see, microSD cards are fragile little things, and frequently don't like being written to repeatedly. That is why keeping backups on the same storage medium that is running the Home Assistant Operating System makes no sense.

Contents

Creating a dedicated Google account (optional)

This step is optional, but you might want to create a dedicated Google account just for your Home Assistant backups. Google gives you 15 GB of free storage for, which will be more than enough for Home Assistant. As you hopefully won't need to frequently access the backups, you also won't need to stay logged in to the dedicated account. Besides using up your storage, there are no disadvantages to using your personal account.

Installing the Home Assistant Google Drive Backup add-on

This guide requires a frequently used Home Assistant add-on. Developer Stephen Beechen created the Home Assistant Google Drive Backup add-on, and its full source code is available on GitHub. The add-on being open source does not mean that anyone will be able to see your Google credentials or have access to your Drive. What it does mean is that anyone can view the source, contribute code, and sound the alarm bells if something seems fishy.

The first step is to enable Advanced Mode in Home Assistant. You will find this option in your user profile settings. This is required to be able to make use of third-party add-ons. Next, enter the settings and select add-ons from the top-level list. If you haven't installed any add-ons yet, you will be notified that that is so. You can continue by clicking on that note.

Once you are in the Add-on Store, click on the kebab menu (three vertical dots in the upper-right corner), and select the repositories option. In the following pop-up, enter the URL displayed below and click on add: https://github.com/sabeechen/hassio-google-drive-backup

A screenshot of the Home Assistant Dashboard showing the user settings. Highlighted is the option “Advanced Mode”.
A screenshot of the Home Assistant Dashboard showing the settings menu. The option “Add-ons” is highlighted.
Home Assistant Google Drive Backup 03

Once the repository is added, you can close the pop-up and scroll to the bottom of the list of available add-ons. You should now see a card with the Home Assistant Google Drive Backup add-on. Click on this card and install it.

A screenshot of the Home Assistant add-on store, showing the text field where a user can add custom repositories. Shown in the image is the URL for the Google Drive Backup being entered.
A screenshot of the Home Assistant Add-on Store showing the “Home Assistant Google Drive Backup” add-on.
Home Assistant Google Drive Backup 06 Edit

Configuring the Home Assistant Google Drive Backup add-on

Once Home Assistant has completed the installation, you are presented with four options, which you can individually enable or disable. To start off with, I highly recommend enabling all four options. In the future, you might want to hide the add-on from your sidebar, or perhaps you will only want to manually install updates after waiting to see if any other users reported errors. With all four options enabled, you can start the add-on by clicking on the button in the bottom-right corner.

A screenshot of the Home Assistant Dashboard showing the options for the “Home Assistant Google Drive Backup”.

Connecting Google Drive

With the Home Assistant Google Drive Backup add-on installed and started, you should see a cloud icon in your sidebar. Click on the cloud to enter the add-on's settings. You will be presented with a button for the authentication with Google Drive. Click on this button, log in to your Google Drive account in the new window that opens, and give the add-on the permissions it needs.

You might notice that you are giving the permissions to https://habackup.io/ and not to Home Assistant or the Google Drive Backup add-on. Threat not, this is the creator's website, and it is needed to make the add-on work. This does not mean that any third party will have access to your Google Drive.

A screenshot of the Home Assistant Google Drive Backup add-on showing the option to authenticate with Google Drive.
A screenshot of the Home Assistant Google Drive Backup add-on showing the authorization string.
A screenshot of the Home Assistant Google Drive Backup add-on showing a text field in which the authorization code has to be pasted.

Once you are logged in and have granted the permissions, you will be presented with the options to send the credentials to the add-on automatically and also a string in a text field. You can try to send the credentials, and if that doesn't work (as was the case for me), copy the string using the button and return to the add-on. Underneath the button titled 'Authenticate with Google Drive', you will find an empty field where you can paste the previously copied string. By clicking the button titled 'Save', your Google account should be connected.

It is of utmost importance that you do not share this string with anyone. If you know or suspect that you have done that, head over to https://myaccount.google.com/, remove the add-on from the list of apps with access to your account, and restart this guide from scratch.

Finishing things up

With the account connected, you need to wait a few minutes for the Home Assistant Google Drive Backup add-on to create its first backup. Once that is complete, there are a few options you might want to explore. The first is whether you want to share error reports. Generally, I opt out of such offers when there is a big company behind a product, such as Google or Microsoft. Here we are talking about a handful of developers doing things in their spare time. Considering this add-on might one day save you hours or even days of work, I think the list one can do is to share these reports. At the bottom of the screen, you have ways to monetarily support the developers. Again, this add-on can save you hours of work, if you have a few pennies to spare, please consider helping the developers out.

A screenshot of the Home Assistant Google Drive Backup showing the backup statistics and information such as when the last backup was performed and when the next one will be performed.

By selecting the settings at the top of the screen, you gain additional control over how the add-on functions. The two most relevant options for now are how often the add-on creates a backup, and how many are stored. If you are a complete beginner, I suggest increasing the number of stored backups, and also the frequency.

If you have enough storage available, I recommend a daily backup, which will be kept for one to two weeks by setting the number of backups from anywhere between 7 and 14. Additionally, I recommend setting the time the add-ons run to when the Raspberry Pi running Home Assistant has most free resources, which is usually during the night when everyone is sleeping. I recommend you go through the options one by one, and apply what seems appropriate for you. Keep in mind that you can always come back and change things, once you are used to working with Home Assistant.

A screenshot of the Home Assistant Google Drive Backup settings showing the toggle whether the user wants to ignore upgrade backups.
A screenshot of the Home Assistant Google Drive Backup settings. The user can set the number of backups stored, the number of backups stored on their Google Drive, whether to delete backups after upload, whether to delete the oldest backup before making a new one, and whether to ignore other backups.

Finally, you have the option to move the folder in your Google Drive. Google Drive uses IDs for folders, so you are free to place it wherever you want. What you can't do is delete the folder and create a new one with the same name. In that case, the add-on will recreate the original folder.

A portrait photo oif Liam Alexander Colman, the author, creator, and owner of Home Assistant Guide wearing a suit.

About Liam Alexander Colman

is an experienced Home Assistant user who has been utilizing the platform for a variety of projects over an extended period. His journey began with a Raspberry Pi, which quickly grew to three Raspberry Pis and eventually a full-fledged server. Liam's current operating system of choice is Unraid, with Home Assistant comfortably running in a Docker container.
With a deep understanding of the intricacies of Home Assistant, Liam has an impressive setup, consisting of various Zigbee devices, and seamless integrations with existing products such as his Android TV box. For those interested in learning more about Liam's experience with Home Assistant, he shares his insights on how he first started using the platform and his subsequent journey.

Leave a comment

Share to...