Hass.io Add-on: Upload hassio snapshots to Dropbox

Nope it doesn’t touch dropbox

I’ve thought about adding this sort of functionality, but it would probably require adding a dependency. I don’t think the dropbox_uploader script used by this add-on let’s you inspect file metadata (but I’d have to check). The way the current keep_last option works is by getting the creation date from the hassio api, which is obviously not an option for sorting and clearing snapshots on Dropbox.

Thank you for your answers!
For now I’m using this PowerShell command which runs every night:

Get-ChildItem –Path “C:\path\to\folder” -Recurse | Where-Object {($_.LastWriteTime -lt (Get-Date).AddDays(-7))} | Remove-Item

How does this help in removing files from the remote Dropbox? Or are you saying you use that instead of the keep_last feature?

I still use the “keep_last: 7” in the plugin to remove the files locally in Home Assistant.
Then I have Dropbox installed on a Windows VM with this Powershell command scheduled to run every night.
A workaround :slight_smile:

1 Like

If I use {“addon”:“7be23ff5_dropbox_sync”,“input”:{“command”:“upload”}} (via the service dev tool), I get a message logged “Error on Hass.io API: Addon is not installed”.

So I figured I probably should use {“addon”:“local_dropbox_sync”,“input”:{“command”:“upload”}} but that doesn’t seem to work also.

Any thought on this?

I can’t replicate this. Pardon the obvious question, but… Did you install the add-on? If so, how?

I just followed the instructions on GitHub, I installed the AddOn using the repository. It is version 3.2.4 I got.

Go to your hass.io dropbox sync page and look at the url, see if it matches the “7be23ff5” part of the addon.

Probably fixed it trough reinstalling the addon, looks fine now!

This looks awesome! Is there a way when calling the Hassio snapshot service to password protect it? Just a bit concerned about putting my full snapshot unprotected into a cloud service…

Yes, you can password protect backups by adding the "password" field to the service call or your automation.

Great! Thanks

Hey @Belgarion, thanks for posting. I’d like to help but not sure I understand what you’re asking for. Are you saying it would be helpful if I included an example yaml snippet used for automating in home assistant?

Also, you just need to set the keep_last option in the add on to whatever number of backups you’d like to keep locally. I’d recommend checking out the add-on documentation.

Hey, what’s the format for uploading to a folder? Does it need backslashes before, after, both or not at all? Thanks :slight_smile:

For example: use the following to save to a sub folder:

/hassio/backups

The hassio folder will be located in the top level directory of your Dropbox.

hi Thx!

I currently condensed the code a bit to:

  - alias: Daily Backup at 11 PM and upload at 11.30 PM
    id: daily_backup_and_cleaning
    trigger:
      platform: time
      at: '23:00:00'
    action:
      - service: hassio.snapshot_full
        data_template:
          name: Automated Backup {{ now().strftime('%Y-%m-%d') }}
    - delay '00:30:00'
    - service: hassio.addon_stdin
      data_template:
        addon: "7be23ff5_dropbox_sync"
        input: {"command":"upload"}

would this work ok? what do you think?

I like as few code as possible with the fewest automations possible :slight_smile:

Thanks @danielwelch !

Is there a way to give a better name to the snapshots placed in dropbox, instead of e37aba0a.tar?

No I don’t believe so. if you ever want to restore them they need to have the old name.