Automating hassio.snapshot_full

I have an automation which calls ‘hassio.snapshot_full’ on a certain day each week which is then backed up to google drive.

If I create a snapshot manually through configuration-snapshot then the snapshot is given a date title, however when the automation creates the snapshot it gives it a random string of letters and numbers i.e. ‘7153351be’ which when it is uploaded to google drives makes it difficult to identify when it was made.

I cant figure out what im doing wrong??

Hi @RJDavison,

Hassio creates the file with an random ID name, but when you copy into backup folder, you can see it with the name that you save the file.
If you want to know which is the last backup file, you can order files by date in your OS filesystem or Google Drive.

If you want to put the date into your Backup name (not the file), you can create an automation:

  - alias: 'Create Weekly Backup' // Sunday at 02 AM
    initial_state: 'on'
    trigger:
      platform: time
      at: '02:00:00'
    condition:  
      condition: time
      weekday:
        - sun
    action:
      service: hassio.snapshot_full
      data_template:
        name: Hassio ({{now().strftime('%d.%m.%y')}})
2 Likes

Have you had look at this


Works great
3 Likes

Great, thanks. Works perfectly.

tried to get this automation working for me but gets me this error, what am I doing wrong?

- id: '1557832981761'
  alias: Weekly Backup - Sonntag 02.00 Uhr
  trigger:
  - platform: time
    at: '02:00:00'
    condition:
      condition: time
      weekday:
        - sun
  action:
    service: hassio.snapshot_full
    data_template:
      name: {{now().strftime('%d.%m.%y')}} - {{states('sensor.current_version')}}

Error loading /config/configuration.yaml: sequence entries are not allowed here
in “/config/automations.yaml”, line 610, column 44

Could it be that your condition was indented too far? Should be in line with trigger and action. Your trigger was also wrong. You didn’t need the “-”:

- id: '1557832981761'
  alias: Weekly Backup - Sonntag 02.00 Uhr
  trigger:
    platform: time
    at: '02:00:00'
  condition:
    condition: time
    weekday:
      - sun
  action:
    service: hassio.snapshot_full
    data_template:
      name: {{now().strftime('%d.%m.%y')}} - {{states('sensor.current_version')}}

thanks for your suggestion but will also leads into the same error :frowning:

What HA are you using? If you are on Hass.io, install this. Works brilliantly.

1 Like

yes I am on hass.io

is it possible to create local snapshots or just on a google drive?

It makes a local snapshot, and then syncs it with Google Drive so you always have 2 copies available.

Try this. Moving the two parts of the name section within the brackets.

      name: {{now().strftime('%d.%m.%y'), - states('sensor.current_version')}}

thanks for the proposal but I am receiving this

Error loading /config/configuration.yaml: while parsing a flow node
expected the node content, but found ‘-’
in “/config/automations.yaml”, line 610, column 43

addon looks great so far, but I want to keep my backups locally not in the cloud and also have no google drive.

1 Like

I looked again and compared to my code. I think the brackets are wrong. Try this:

name: {{ now().strftime('%Y-%m-%d', - states('sensor.current_version')) }}

Very strange, configuration check is fine, but when starting automation it throw out an error in the logs.

Got it working with the below

- id: '1557839561761'
  alias: Wöchtentliches Backup
  trigger:
    - platform: time
      at: '20:00:00'
  condition:
    - condition: time
      weekday:
        - sat
  action:
    - service: notify.ios_iphone
      data:
        message: Das wöchentliche Backup 💾 wird jetzt erstellt!
        title: Wöchentliches Backup
    - service: hassio.snapshot_full
      data_template:
        name: >
          Backup_{{ now().strftime('%d-%m-%Y') }}

Thanks for your help guys!!!

2 Likes

Kein problem :slight_smile:

1 Like

You could setup a from job.to copy last backup to a shared folder and also delete obsolete backups

Works perfectly now I don’t have to worry about a crash without a current snapshot, does it all automatically! Thanks so much!

Any idea how to only keep the last x backups? Say I want to want to make a backup and I then create a backup task in my Synology NAS so it copies it to another drive in case everything goes wrong. Now my backup would increase every time because hassio creates new .tar files, why I only want to keep the last 7 or something, and let my Synology keep track of versions. Might be easier to just sync the whole hassio drive and folders…

In case this question is still relevant, please have a look here:

1 Like