logo smart home family kruse

Kruse Smart Home

Easy living in our smart home & Garden

Restoring a Home Assistant backup after failure

Restoring a Home Assistant backup after failure

1 April 2023


1. Introduction

In case Home Assistant is not working anymore or not stable (for example due to updating Home Assistant, add-ons or a crashing microSD card) you are lucky if you had Home Assistant automatic backups setup. Restoring a Home Assistant backup is easy to do as the functionality is already by default available within Home Assistant.

The add-on OneDrive Backup is installed on our Home Assistant instance and configured such that it makes a full backup every day on the SD-card and synchronises it with our OneDrive account. This saved my day when after installing some updates of add-ons/integrations Home Assistant was behaving strange after reboot. It gave warnings about the operating system itself, was very slow and the add-on page was blank like some other pages.

Also items were missing in the sidebar and in the settings page, such as for example the Add-ons. I tried several restarts and hard reboots by switching off/on the power (software based reboot option was not available anymore in Home Assistant). This did not solve the issue and hence the only option I could see to get a stable Home Assistant back again was a fresh install and restoring a Home Assistant backup.

Luckily I had an empty SD card available to do this without touching the actual used SD card (just in case backup restore would not work and I needed to get some files from it). For restoring a Home Assistant backup I performed the following steps:

  1. Safeguard existing backup files
  2. Install a fresh Home Assistant on a microSD card
  3. Restore the last backup from a moment Home Assistant was working fine
  4. Check everything is working
  5. Create a new backup

These steps are explained in detail in the next section.

2. Restoring a Home Assistant backup

2.1 Safeguard existing backup files

In this critical situation the last thing I wanted to happen is losing my backups due to a stupid mistake. Luckily I used the Home Assistant add-on OneDrive Backup, which synchronises backup files also to my OneDrive. To be safe I copied the last full backup from my working Home Assistance instance to my local drive of my Windows computer.

2.2 Install a fresh Home Assistant

Before we can start restoring a Home Assistant backup we need to have a freshly installed Home Assistant by following the steps below:

  1. Follow the instructions on the official Home Assistant web page how to install Home Assistant on a microSD for us in a Raspberry Pi.
  2. Put the microSD card in your Raspberry Pi4 when flashing it is ready.
  3. Reconnect the power.
  4. Go to http://homeassistant.local:8123/
    Be aware that as Home Assistant is now freshly installed it has not yet a secured web access (SSL) via a https URL configured, so access via http is required.
  5. Home Assistant is starting up and automatically starts its initial configuration, which can take up to 20 minutes. On our Raspberry Pi 4 with 8Gb RAM it took 6 minutes.

2.3 Restoring a Home Assistant backup

Follow the steps below for restoring a Home Assistant backup made when your instance was working stable:

  1. Go to http://homeassistant.local:8123/
  2. Click on the link “Alternatively you can restore from a previous backup.” shown at the bottom of the dialog shown.
  3. The file select dialog will be shown to select the backup to upload  to Home Assistant

    Select a backup file which is known to be from a stable functioning Home Assistant instance. In our case the file is named “hass_backup_onedrive_2023-04-02-01-35.tar” and has a size of 2.5 Gb.

  4. Select full backup and click on restore.
  5. Click  on restore to confirm restore of the backup.

  6. Restoring a Home Assistant backup will now start by decompressing the backup. file first. Unfortunately no progress will be shown and the webpage does not work anymore till backup has been restored and Home Assistant is starting up.
  7. I opened new browser tabs with the following URLs as I was not sure if secured connection would already work:
    http://homeassistant.local:8123/And as I use duckdns.org also:
    https://<your subdomain name>.duckdns.org:8123/Only the duckdns.org link showed some signs of live:

    The local links only showed the message “This site can’t be reached”.
  8. So just be patient. In my case it took about 30-40 minutes before Home Assistant was starting up.After approximately 10 minutes I could access the Raspberry Pi 4 Home Assistant from my WIndows computer (I had samba configured within Home Assistant). It indicated the backup restore was happening on the files I saw being decompressed.

2.4 Check everything is working as expected

Always check Home Assistant is working fine after restoring a Home Assistant backup by for following the steps below:

  1. Reboot the system via Settings and then clicking the upper right menu dots. Select Restart Home Assistant.
  2. In the dialog shown click on advanced options and select Reboot system.
  3. When Home Assistant has been rebooted check if notifications are shown which indicate actions.

    In our case our Withings integration (used for blood pressure measurements and weightings scale) required re-authentication.

  4. Go to Settings > Devices & Services and check for integrations having issues. In our case the Z-Wave integration required attention showing a worrying error message:

    I have seen this before and it is related to the Z-Wave integration being linked to the wrong USB port. This can easily be corrected, see our article “How to fix Home Assistant Z-Wave connection issue?“.

  5. Check the rest of Home Assistant such as dashboards and automations. Does everything look like as before and is it working fine?
  6. Last check is again a full reboot. When rebooted Home Assistant should work as expected.

2.6 Create a new backup

Initiate manually a backup and make sure you store a copy elsewhere. I use the OneDrive Backup to make sure local backups are synchronised with my OneDrive automatically so restoring a Home Assistant backup if needed is not an issue.

3. Finally

Although a crashing Home Assistant is worrying, restoring a Home Assistant backup is fairly easy if you have backups made. Making backups can be done automatically within Home Assistant; several add-ons are available to help you.

Article by <a href="https://smarthome.familykruse.eu/author/iamjwk/" target="_self">Jan-Willem</a>

Article by Jan-Willem


Writen by the website owner


Submit a Comment

Your email address will not be published. Required fields are marked *