Hassio 0.61 Snapshot Service

I tried to do a partial backup that only include the home assistant config but it dose not seem to work.

- alias: Daily Backup of home assistant config
  trigger:
    platform: time
    at: '3:00:00'
  action:
  - service: hassio.snapshot_partial
    data_template:
      name: "config {{ now().strftime('%Y-%m-%d') }}"
      folders:
        - homeassistant

Hi there,

I have been using your automation for quite a while and it works flawlessly, many thanks for this!

Now the problem I run into is that my sd card runs full from time to time (obviously). At the moment I have an automation telling me when it is almost full and I manuall delete the snapshots > 4 weeks. Can you point me towards how to automate this? That would be great!

Thanks in advance and best regards!

Gunnar

I use a shell command to delete all of my snapshots over 30 days old:

shell_command:
  delete_old_snapshots: find /backup/* -mtime +30 -exec rm {} \;

Then my backup automation runs nightly:

- alias: Daily Backup at 11 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') }}
    - service: notify.slack
      data_template:
        message: Creating backup named "Automated Backup {{ now().strftime('%Y-%m-%d') }}"
    - service: shell_command.delete_old_snapshots

Hope that helps. I would be curious how others handle this as well.

8 Likes

Nice. This is how I did something similar in python for the keep_last option in my Dropbox addon. Aside from not being bash, the main difference is that I delete via a service call to the hassio snapshot delete service. Works really nicely.

3 Likes

Would it be possible for you to add Google Drive support?

Feel free to check my progress so far, test it out, or even better, help! :slight_smile: Iā€™ve mentioned before that Iā€™ve run into difficulties with handling the authorization solely through the UI for google drive. I actually got the current implementation working once, but when I went back to test it on my raspberry pi, nothing was uploading. I havenā€™t gone back to the project since then.

I have switched over to use your Dropbox add-on and it works great. Thanks for the work!

@danielwelch

Is there an option in your Dropbox Sync add-on to turn on timestamps in logging?

Thanks again!

Dan

There isnā€™t, and there should be. Iā€™ll add timestamps to the logging.

Has anyone figure out how to call service with password protection?

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

automation:

  - alias: Daily Dropbox backup
    trigger:
      platform: time
      at: '2:00:00'
    action:
      - service: hassio.snapshot_full
        data_template:
          name: Automated Backup {{ now().strftime('%Y-%m-%d') }}
          password: YOUR PASSWORD
      - delay: '02:00:00'
      - service: hassio.addon_stdin
        data_template:
          addon: "7be23ff5_dropbox_sync"
          input: {"command":"upload"}

The Remote Backup addon stopped working for me and Iā€™m now getting the following error on the supervisor:

18-10-07 15:51:08 INFO (SyncWorker_13) [hassio.docker.interface] Pull image fixated/remote-backup-armhf tag 0.3.0.                                                                                   
18-10-07 15:51:45 INFO (SyncWorker_13) [hassio.docker.interface] Tag image fixated/remote-backup-armhf with version 0.3.0 as latest                                                                  
18-10-07 15:52:26 INFO (SyncWorker_17) [hassio.docker.addon] Start Docker add-on fixated/remote-backup-armhf with version 0.3.0                                                                      
18-10-07 15:52:26 WARNING (MainThread) [hassio.api.security] /snapshots/new/full no role for ce20243c_remote_backup                                                                                  
18-10-07 15:52:26 ERROR (MainThread) [hassio.api.security] Invalid token for access /snapshots/new/full 

Any idea why Iā€™m missing the API token now? This was working fine until a few days ago FYI. Thanks

Is there a way to specify the actual file name that is used, rather than just the name that Snapshot uses, and if so will/can it overwrite a previous file name (for example I want to name the actual backup file Backup_mon.tar and overwrite it every Monday ?

1 Like

I second that question - would be cool to have an opportunity to name ā€œautomaticā€ snapshots as for example: ā€œauto_XXXXā€, so other operations [like dropbox sync or/and deleting the oldones or something] could be done ONLY on those automatic ones. that way we could keep some ā€œpreciousā€ snapshots untouched :slight_smile:

No way to do this that I know of during the snapshot creation process or through the Hassio API itself.

Anyone succeed to automate a partial snapshot of only the config files?

How add in GUI in configuring automation to do schedule snapshot and add to name date created snapshot ?

@mr_bjerre

I canā€™t quite get Remote Backup Add-On to authenticate. I get an authentication error in the log file.

Backup created: f25b58f4
Copying password-protected f25b58f4.zip to ~/hassio-backups on 10.0.1.76 using SCP
  adding: f25b58f4.tar (deflated 1%)
Warning: Permanently added '10.0.1.76' (ECDSA) to the list of known hosts.
Permission denied, please try again.
Permission denied, please try again.
Received disconnect from 10.0.1.76 port 22:2: Too many authentication failures
Disconnected from 10.0.1.76 port 22
lost connection

To debug this, I confirmed that I can ssh into my host remote machine. However, that uses a password instead of a KEY. I confirmed my PRIVATE KEY by re-entering it a second time. Am I using a supported encryption? Any other suggestions?

Any help is appreciated.

Also for reference, my Configuration is typical:

{
  "ssh_host": "10.0.1.76",
  "ssh_port": 22,
  "ssh_user": "USERNAME",
  "ssh_key": [
    "-----BEGIN RSA PRIVATE KEY-----",
    "Proc-Type: 4,ENCRYPTED",
    "DEK-Info: AES-128-C.........",
    "",
    "FIRST_LINE_HERE_WITH_KEY_INFO",
    "....",
    "LAST_LINE_HERE_WITH_KEY_INFO",
    "-----END RSA PRIVATE KEY-----"
  ],
  "remote_directory": "~/hassio-backups",
  "zip_password": "password_protect_it",
  "keep_local_backup": "3"
}

The private key is in the wrong format. If you use puttygen, load the key and copy and paste from here:

image

I made the change to the key as recommended, but it still fails to authenticate.

To attempt to debug this further, I made my own stand alone run.sh script based on the run.sh in the Remote Backup. When I execute my run.sh test script, to my surprise I was prompted for a password. In other words, it isnā€™t using the key alone. It is still requiring user interaction, which I think is not intended. When I enter the password, it completes the script and copies a test dummy file correctly.

I am trying to remote into a iMac. I wonder if there is some minor changes for the Mac OSX that make it not work with the current configuration.

Any other ideas or recommendations for further debug?