Upload your Home Assistant backups to Dropbox.
This add-on allows you to upload your Home Assistant backups to your Dropbox, keeping your backups safe and available in case of hardware failure. Uploads are triggered via a service call, making it easy to automate periodic backups or trigger uploads to Dropbox via script as you would with any other Home Assistant service.
This add-on is inspired by Dropbox Sync from Daniel Welch. Major thanks for his work!
- Go to the Supervisor add-on store in Home Assistant.
- Click on the "three-dots-menu" and choose
Repositories
. - Add this repository to your Home Assistant instance:
https://github.com/mikevansighem/dropbox-backup
. - Install the Dropbox backup add-on.
- Configure the add-on with your Dropbox OAuth Token and desired output directory (see configuration below).
To access your personal Dropbox, this add-on requires an access token. Follow these steps to create an access token:
- Go to Your Dropbox apps.
- Click on
Create App
. - Select
Scoped Access
and choose between full or app folder only access. - Give your app a unique name and click on
Create App
. - Now your app is created go to the permissions tab and tick
files.metadata.write
. - Back on the settings tab, go to "Generated access token" and click
Generate
. - Copy the access code for use in your configuration.
Once you have created the token, copy it into this add-on's configuration under
the oauth_access_token
label.
Parameter | Required | Description |
---|---|---|
oauth_access_token |
Yes | The "app" access token you generated above via the Dropbox UI. |
output |
No | The target directory in Dropbox to which you want to upload. If left empty, defaults to / , which represents the top level of directory of your Dropbox. |
keep_last |
No | If set, the number of backups to keep locally. If there are more than this number of backups stored locally, the older backups will be deleted from local storage after being uploaded to Dropbox. If not set, no backups are deleted from local storage. |
preserve filename |
No | If set to true the backup filename will remain the original slug e.g. d6f0919b.tar otherwise the files will be renamed to the backup name e.g. My Backup 2020-01-23.tar . |
Example configuration:
{
oauth_access_token: "<YOUR_TOKEN>"
output: "/hasssio-backups/"
keep_last: 2
preserve_filename: false
}
Dropbox Sync uploads all backup files (specifically, all .tar
files) in the
Home Assistant /backup
directory to a specified path in your Dropbox. This
target path is specified via the output
option. Once the add-on is started, it
is listening for service calls.
After the add-on is configured and started, trigger an upload by calling the
hassio.addon_stdin
service with the following service data:
service: hassio.addon_stdin
data:
addon: 782428ea_dropbox-backup
input:
command: upload
This triggers the dropbox_uploader.sh
script with the provided access token.
You can use Home Assistant automations or scripts to run uploads at certain
time intervals, under certain conditions, etc.
A sample automation can be found here. To use it simply create a new automation and copy the YAML.
This add-on is covered under the MIT license refer to LICENSE.md for details.