Backing up to Dropbox

:warning: This guide has been migrated from our website and might be outdated. Feel free to edit this guide to update it, and to remove this message after that.

Backing up and regularly syncing your Home Assistant configuration to Dropbox.

This guide is aimed at users running Home Assistant Core.

Requirements

You need two parts in order to get it working correctly.

Become the user that runs Home Assistant.

  • A separate Python script that syncs a specific folder. Which can be found here

  • The excellent dropbox uploader script you can grab the .sh file only.

Download those files to a folder of your liking, after that edit both files and change paths accordingly.

In the Python script, you can specify which files and directories should be excluded. This allows you to skip secrets.yaml or the deps folder.

Step 1: Linking your Dropbox account


chmod +x dropbox_uploader.sh

./dropbox_uploader.sh

Follow the instructions you see on your screen.

Step 2: Running the Dropbox uploader

Go to the folder you have placed dropbox.py.

  • Option A:

    Copy file dropbox_uploader.sh to : .homeassistant/extraconfig/shell_code/ (so the full path would be similar to: /home/homeassistant/.homeassistant/extraconfig/shell_code/dropbox_uploader.sh)

  • Option B:

    Edit dropbox.py:

    Change the following line:

    uploader = "/home/homeassistant/.homeassistant/extraconfig/shell_code/dropbox_uploader.sh"
    

    to where you placed your file: (for example):

    uploader = "/home/homeassistant/MyFolder/dropbox_uploader.sh"
    
    python dropbox.py
    

The first time can take a lot of time since it will upload all your files!

Do note, this will backup your passwords to Dropbox.

Automate the backup

So you just made a full backup, next time you want it to be done automatically. Since your database can change and so do other files over time.

Add it to your crontab, edit the path/to part.

(crontab -l 2>/dev/null; echo "0 3 * * * python /path/to/dropbox.py") | crontab -
1 Like

Hi get a lot of ERROR in uploading files to dropbox:

any suggestion?

This feels like it has so much potential to run routine backups of my config directory! However I don’t seem to be able to un python on my installation. I have found the link files to files which appear to be the python install but no luck running this dropbox.py using them. Have also tried to install pyscript via HACS but that hasn’t helped me resolve it! Maybe the combination of the two would present a good way to progress. Any ideas welcome!