I have created a small hassio addon for uploading snapshots to Dropbox.
After having problems with hassio-dropbox-sync (which otherwise I hear works for many people and seem great), I created a pure Python version to solve my problems. However, I wanted to share it and see if it would be useful for anyone else.
Add the above address in Hassio addon repos. and install. Then configuration is very simple…
{
"access_token": "DROPBOX TOKEN",
"dropbox_dir": "/snapshots",
"keep": 10, # keeps the 10 most recent snapshots
"mins_between_backups": 60 # Checks for new snapshots every hour
}
Contributions, feedback and ideas are very welcome! I have been using it for a couple of months now and it has gotten to a point of being fairly stable.
Do I have to create the folder in my Dropbox, or will the add-on do it if it doesn’t exist?
Do I need the “password:” line if I don’t use a password in my snapshots?
I am a total newb with Automations, but don’t they all require an “id:” line?
Your sample automation generates this config error:
Invalid config for [automation]: [trigger] is an invalid option for [automation]. Check: automation->action->1->trigger. (See /config/configuration.yaml, line 215). Please check the docs at https://home-assistant.io/components/automation/
Also, the add-on crashes. Here’s what’s in the log file:
Traceback (most recent call last):
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/app/dropbox_upload/__main__.py", line 52, in <module>
main(config.DEFAULT_CONFIG)
File "/app/dropbox_upload/__main__.py", line 25, in main
dbx.users_get_current_account()
File "/usr/lib/python3.6/site-packages/dropbox/base.py", line 4245, in users_get_current_account
None,
File "/usr/lib/python3.6/site-packages/dropbox/dropbox.py", line 274, in request
timeout=timeout)
File "/usr/lib/python3.6/site-packages/dropbox/dropbox.py", line 365, in request_json_string_with_retry
timeout=timeout)
File "/usr/lib/python3.6/site-packages/dropbox/dropbox.py", line 456, in request_json_string
raise BadInputError(request_id, r.text)
dropbox.exceptions.BadInputError: BadInputError('4044fd13903174e41502c49321b125de', 'Error in call to API function "users/get_current_account": The given OAuth 2 access token is malformed.')