overkill32 / hassio-remote-backup

Automatically create Hass.io snapshots to remote server location.
MIT License
71 stars 26 forks source link

Function to only remove older versions of snapshot from hass.io server #2

Closed gerard33 closed 6 years ago

gerard33 commented 6 years ago

Is it possible to implement a function so you can keep the lasts x versions of the snapshot on the hass.io server? Now the backup is directly removed after the add-on has run.

See here for an example where a configurable number of backups will remain on the hass.io server.

NixBiks commented 6 years ago

The thing is that this will not only remove the snapshots created by the addon but remove all backups. I guess I'll just make it optional with an input keep_local_backup with possible values:

  1. 0: do not keep any backups created by the addon. This does not interfere with any other local backups.
  2. X with X > 0: keep last X snapshots. Note this will also delete snapshots not created by the addon.
  3. all: do not delete any local backups.
gerard33 commented 6 years ago

Thanks for adding this :+1:

When I enter "keep_local_backup": "all" all is working fine, but when entering "keep_local_backup": "14" I get the following error not a valid value for dictionary value @ data['options']..

NixBiks commented 6 years ago

Argh. I have a zero or one character allowance instead of zero or more. Try having “9” - does that work?

I am in the middle of moving so I am on smartphone only. It is a fix to my addon repo which I will fix today but it might not go into effect until you install the addon (either reinstall or wait for next upgrade).

gerard33 commented 6 years ago

Thanks, it's working now correctly!