Links on the site may earn us an affiliate commission. Learn more.

Some of us have gone through the experience where our Home Assistant breaks. Whether due to a change we made to the configuration or even that the drive gets corrupted, and we have to start over. And there is nothing worse than not having a backup of our Home Assistant instance to make the process of starting over simple. So, in this guide, I will show you how to automatically backup Home Assistant and send copies of the backups to Google Drive. So you can have them in the cloud and quickly recover your Home Assistance configuration.

Default backup system

By default, Home Assistant comes with a backup feature that you can use to create partial or full backups of your Home Assistant instance. You can also create an automation to automatically create backups on a specific date and time. The created backups can also be manually downloaded to your computer to keep a copy of the backup in a remote location.

Home Assistant Google Drive Backup add-on

There is one feature that the default backup lacks, and it’s the ability to send a copy of the backup to a cloud service like Google Drive for safekeeping. However, there is an add-on created by Stephen Beechen that can automatically create new backups in Home Assistant. It also connects with Google Drive to automatically upload copies of your backups and saves them in the cloud.

Installation

To install the add-on, go to ConfigurationAdd-ons, Backups & Supervisor, and click on Add-on Store. The add-on to install is not available in the official Home Assistant add-ons or the community add-ons. However, you can add the GitHub repo to add the add-on by clicking on the 3 dots on the top right and then clicking on Repositories. Then, enter the following link: https://github.com/sabeechen/hassio-google-drive-backup. Click on Add and then close the pop-up. Scroll down, and the Home Assistant Google Drive Backup add-on is now available.

Open the add-on and then click on Install. After the installation completes, toggle the option Show in sidebar to easily access the add-on from the sidebar. Lastly, click on Start to initiate the add-on.

Configuration

To access the web interface for the add-on, click on Open Web UI. You need to authenticate with Google so the add-on can access your Google Drive and upload the Home Assistant backups. So, click on Authenticate with Google Drive and sign in to your Google account. Then click on Continue to allow the add-on to upload the backups to Google drive. The last thing you need to do is click on Send Credentials. If you get a blank page with an error message, go back to the previous screen and copy the Authorization String. Then, go to the add-on web UI and paste that code on the text box below.

Click on Save, and you are good to go. The add-on has some default settings, so it will start syncing with your Google Drive and upload any existing backups that you have in Home Assistant. If you open your Google Drive, you will see a new Home Assistant Backups folder. Open it, and it will have the backups uploaded from your Home Assistant instance.

Web interface overview

Going over the add-on interface, there is a section with backup statistics on the left. It shows how many backups are available in Home Assistant and Google Drive. It also provides information on how much storage is available, both local and the cloud. On top of that, you can see when the last backup was made and when the next one will be.

In the middle, you have the available backups in Home Assistant. If you click on one of them, a pop-up comes up where you can see details about the backup. You can see if the backup is present locally in Home Assistant and Google Drive. You also have the option to delete or to never delete the backup from either location. And if you want to save a copy of the backup to your computer, you can click on the Download button to download it.

Settings overview

Going over the settings, the add-on has several settings that you can configure. You can set up how many backups to keep in Home Assistant and how many to keep in Google Drive. If you have limited storage in your Home Assistant, you can select to delete the backups after they are uploaded to Google drive. You can also select to delete the oldest backup before creating a new one.

The add-on is set up to create new backups every 5 days by default. However, you can change the frequency depending on how you use your Home Assistant. In addition to that, you can also set up the time when you want the backups to run.

If you want the backups to be password-protected, you can set up a password in the settings to be used for all backups that the add-on creates. If you restore from a password-protected backup, Home Assistant will require entering the password you set up in the add-on settings.

Next, you have the Backup Name Template, which includes a few options by default. For example, if the backup is a full or a partial backup. Also, the date and the time the backup is created. You can change the format if you would like. You can click where it says “See here” to see all the variables you can use. I personally like the name shorter, so I use the {type} variable, along with the text Backup and the variable {date}.

The add-on has enabled by default the option Enable Staleness Notification, which shows a notification in the Home Assistant notification panel when there is an issue with the backups. There is also a binary sensor for this and another sensor to show the status of the backups. These 2 sensors come in handy because you can create automations to send, for example, a notification to your mobile device when there is an issue with the backups.

If you want to exclude folders or add-ons from the backups. You can enable, Partial Backups and select which folder or add-on to exclude. Now, if you set up a new add-on, it will be automatically set up to backup. So, if you want to exclude a new add-on from the backups, you would need to update this setting.

If you are using a theme with your Home Assistant, you probably noticed that the add-on UI doesn’t change with the theme. However, you can change the background color and accent color in the add-on settings to match your current theme.

The add-on, by default, checks Home Assistant and Google Drive for backups every hour. However, under Sync Interval, you can change how frequently you want the add-on to sync. After you make changes to the settings, click on Save, and the changes will take effect right away.

Create manual backups

If you want to create a backup manually, you can also do it from the add-on. You can click on the “+” plus icon on the bottom right, or you can also go to the Actions menu and click on Backup Now. When manually creating a backup from the add-on, you can set a different name for the backup or leave it blank to use the default naming scheme. You can also select to keep the backup indefinitely in Home Assistant or your Google Drive. This action will only apply to this one manual backup and not affect the settings for the scheduled backups.

How to monitor backups

When the add-on has issues creating backups and uploading them, it shows a persistent alert in the Home Assistant notification panel. However, notifications in that panel can sometimes be easily missed. But, because the add-on has a couple of sensors that show the status of the backups, you can create an automation to send an alert to a mobile device or show a card on the main Home Assistant view when there is an issue.

Automation to send alerts to a mobile device

To set up an automation to send a notification to a mobile device, go to ConfigurationAutomations & Scenes, and click on Add Automation. On the pop-up that comes up, select Start with an empty automation. Set up a name for the automation. Then, under Triggers, set the Trigger type to State. For the Entity, search and select binary_sensor.backups_stale and set From to off and To to on.

Next, under Actions, set the Action type to Call service, for Service search for notify.mobile_app and select the device to send the notification. You can set the Message to Access the Home Assistant Google Drive Backup add-on for details. Then, the Title to There is an issue with the backups.

If you want to tap on the notification and go straight to the add-on web interface, open the add-on Web UI on your browser and copy the path from the address bar.

# It should look like this 
/hassio/ingress/cebe7a76_hassio_google_drive_backup

Go back to the automation and under Data enter url: and paste the path for the add-on web interface. If you are on an Android device, you will use clickAction instead of url.

Save the automation, and if you click on Run actions on the top, you will get a notification on your device. If you click on it, it should take you directly to the Home Assistant Google Drive Backup add-on.

# Automation to send backups issue notification to a mobile device

alias: Backups Issue Notification
description: ''
trigger:
  - platform: state
    entity_id: binary_sensor.backups_stale
    from: 'off'
    to: 'on'
condition: []
action:
  - service: notify.mobile_app_[Your_Device_name]
    data:
      message: Access the Home Assistant Google Drive Backup add-on for details
      title: There is an issue with the backups
      data:
        url: /hassio/ingress/cebe7a76_hassio_google_drive_backup
        # For Android use clickAction instead of url
mode: single

Backups Alert Lovelace card

If you want to create a card that will show up on your Home Assistant dashboard when there is an issue with the backups, you can create a conditional card that will be hidden until there is an issue.

On the Overview page, click on the 3 dots at the top right and click on Edit Dashboard. Then click on Add Card and select the Conditional card. Under the Conditions tab, click on Entity, search for binary_sensor.backups_stale, and select it. Where it says State is equal to change it to State is not equal to and set the state to off.

Next, go to the Card tab and select the Markdown card. For the Title, you can set it to something like Backups Issue! and under Content, you can add the following:

There seems to be an issue with the Home Assistant backups. Please access the [Home Assistant Google Drive Backup](/hassio/ingress/cebe7a76_hassio_google_drive_backup) add-on for more details.

If you would like to get more details on the card like for example, the last time a backup was created and the last time a backup was uploaded, you can add the following below:

- **Last Backup:** {{ state_attr('sensor.backup_state', 'last_backup') }}
- **Last Upload:** {{ state_attr('sensor.backup_state', 'last_uploaded') }}

Click on Save and then move the card to the top of the first row, so the card always shows at the top if you open Home Assistant on a mobile device. Exit the Edit UI, and the card will be hidden until an issue happens with the backups.

Want to support my work?