Dropbox integration

I’m trying Dropbox backup of snapshots.
Found https://www.home-assistant.io/docs/ecosystem/backup/backup_dropbox/
I’ve created folder /home/dropbox_backup/ and copy two files here.
Modified two linse inside dropbox.py
syncdir="/backup/"
uploader = “/home/dropbox_backup/dropbox_uploader.sh”

Success steps up to run python dropbox.py. It shows an error
-bash: python: command not found

If you run home assistant or home assistant supervised, there is an add-on for dropbox backups.

I have Pi 4

Where can we find the Addon? I only know the google drive backup :slight_smile:

Pi 4 is the hardware you’re running it on, not the installation method. If you see a “Supervisor” icon towards the bottom of your sidebar then you are running Supervised, and you will be able to install add-ons.

Installing the Dropbox add-on (link below) will be far easier than the manual method you’re attempting.

Here you go.

1 Like

I’m trying this 2nd addon, but I don’t understand, how to make periodic backups and how to run this add-on after backup has been created.

First you need to follow the instructions on that page under “Configuration” in order to prepare your Dropbox account. After you follow those instructions you will have an access token, which you put inside of the add-on configuration.

And then you need to create the automation in Home Assistant. Here is the automation I use. It will perform a complete backup of Home Assistant every night at 3am. And then 30 minutes later at 3:30am it will upload that backup to Dropbox using this addon.

automation:

  - alias: System - Daily Dropbox Backup
    initial_state: 'on'
    trigger:
      platform: time
      at: '3: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"}

It’s a bit difficult to set up at first, but once you do this, it’s fully automated backups to Dropbox.

Thank you, this is help I needed to understand better HA.
But is not working for me.
I’m writing mostly everything in GUI and this is result I’ve got from automation.yaml file.

  • id: ‘1588485779086’
    alias: Dropbox
    description: ‘’
    trigger:
    • at: ‘3:00:00’
      platform: time
      condition: []
      action:
    • data:
      name: Automated Backup {{ now().strftime(’%Y-%m-%d’) }}
      service: hassio.snapshot_full
    • delay: 0:05:00
    • data:
      addon: 7be23ff5_dropbox_sync
      input:
      command: upload
      service: hassio.addon_stdin

Created backup file has name Automated Backup {{ now().strftime(’%Y-%m-%d’) }}
And no file has been added into Dropbox. Log doesn’t show anything about Dropbox.

First of all, read this, specially point 11 :

https://community.home-assistant.io/t/how-to-help-us-help-you-or-how-to-ask-a-good-question/114371/4

Second :
don’t use delay: 0:05:00, the backup needs time to finish

Third : install the file-editor add-on, and just past Sean’s code in automation.yaml. You can’t use (yet) data_template in the automation editor.

Thanks

  1. Ok I will try it. Not sure how or which type of block I must select.
  2. My backup takes 20 seconds now. I will change it to longer times when it will be needed.
  3. I have it installed. I’ve tried add it to configuration.yaml but edit shows an error now
duplicated mapping key at line 74, column -448:
    automation:
    ^

I’ve tried make an block in this forum - francisp, it is right now?
4. BTW How to divide configuration.yaml to more files? I’m at beginning and is not easy to find correct part in it. I prepare to configure BroadLink remotes and it will be such 1000 buttons, so ie. 2000 scripts, each script is about 7 lines. It is hard work on 6" display of mobile phone.
5. I have result from log file. No file in Dropbox still.

20-05-03 09:37:20 INFO (MainThread) [supervisor.api.security] /snapshots access from 7be23ff5_dropbox_sync

Sorry not understand.

  1. When I add code into configuration.yaml it shown an error on second automation. But it looks that it works without restart.
  2. When I add code into standalone file and add !include file.yaml on next line after first automation it shows an error.
  3. When I add code into standalone file together with line automation: in it, and !include file.yaml on end of configuration.yaml, it shows an error.

I don’t understand what you try to explain. Show your configuration.yaml and your automations.yaml.

Don’t know how to attach files. So paste content of files here?

configuration.yaml


# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:

# Uncomment this if you are using SSL/TLS, running in Docker container, etc.
# http:
#   base_url: example.duckdns.org:8123

# Text to speech
tts:
  - platform: google_translate

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml


android_ip_webcam:
  - host: 192.168.15.107
    port: 80
    sensors:
      - audio_connections
      - battery_level
      - battery_temp
      - battery_voltage
      - light
      - motion
      - pressure
      - proximity
      - sound
      - video_connections
    switches:
      - exposure_lock
      - ffc
      - focus
      - gps_active
      - night_vision
      - overlay
      - torch
      - whitebalance_lock
      - video_recording
  - host: 192.168.15.107
    port: 8080
    sensors:
      - light
    switches:
      - torch
      
!include automations_dropbox_backup.yaml

automations.yaml has 0 bytes. But link above talks about automation.yaml. ai don’t have that file, maybe information for older version not refreshed.

newly created automations_dropbox_backup.yaml

# Dropbox backup automation
automation:

  - alias: System - Dropbox
    initial_state: 'on'
    trigger:
      platform: time
      at: '3:00:00'
    action:
      - service: hassio.snapshot_full
        data_template:
          name: Automated Backup {{ now().strftime('%Y-%m-%d') }}
      - delay: '00:05:00'
      - service: hassio.addon_stdin
        data_template:
          addon: "7be23ff5_dropbox_sync"
          input: {"command":"upload"}
          

And tried this part too

automation: !include automations.yaml
  !include automations_dropbox_backup.yaml

Ok,

  • remove from configuration.yaml
!include automations_dropbox_backup.yaml
  • delete automations.yaml
  • delete from automations_dropbox_backup.yaml
automation:
  • rename automations_dropbox_backup.yaml to automations.yaml

restart HA

I don’t understand.
We are talking about standalone files for different parts of configurations.
Include of automations.yaml is standard, I think, and this is part of GUI Automations. When I add something to this GUI, it has been added into automations.yaml automatically. Why I have to rename my new file to this standard file when I would like to divide it different files because file will be huge?

You don’t understand HA. automations.yaml can be edited with an editor and by the gui.

Learn the basics first. Once you know HA better, you can put it in a package.

Yes, I’m novice.
I’ve been add code above to Automations. It has been bad and not working, so I put code into configuration.yaml. Backup has correct name, Dropbox still not working.
I’ve had question to have configuration.yaml not huge. I’ve been followed link divide into standalone file, so it is not working. Now I have to put code again to automations.yaml. Really I don’t understand. Cycle.

So, I need to understand. It is not possible divide configuration.yaml to different files, only make an packages?

Could I leave automations.yaml and have own file file Dropbox backup integration?

Yes, you can separate your Dropbox backup from the rest of you automations. Read the documentation on packages. Everything you need to know is there.