💾 Create Automated Backups Every Day

Did it work?

Nope I’m still getting the error and the automaton does not work with
2022.9.1

Did you get to the bottom of this? I’m hesitant to update HA. I do notice, though, that the screenshot above mentions hassio.snapshot_full, which has been renamed to hassio.backup_full. Could it be that you are running an old version of the Blueprint?

I disabled the automation and was going to check back this week. Was hoping for some activity on here.

Can you check your blueprint code for the above?

Hello,
i have also problems with Backup. The Service backup.create cant be found.

I use the default Blueprint:

blueprint:
  name: Automated Daily Snapshot for Container/Core
  description: Create a snapshot backup at a given time every day.
  domain: automation
  input:
    trigger_time:
      name: Snapshot creation time
      description: The snapshot will be created at this time, every day
      selector:
        time:
    send_notification:
      name: Send notification
      description: Sends a notification to a device if enabled
      selector:
        boolean:
      default: false
    notify_device:
      name: Device to notify
      description: Device needs to run the official Home Assistant app to receive notifications
      selector:
        device:
          integration: mobile_app
      default: ""
  homeassistant:
    min_version: "2022.5.0"

mode: single
max_exceeded: silent

variables:
  send_notification: !input send_notification
  notify_device: !input notify_device
  notification_title: Automated Daily Backup
  notification_message: "Home Assistant full backup created. {{ now().strftime('%F') }}"

trigger:
  - platform: time
    at: !input trigger_time

action:
  - service: backup.create
  - if: "{{ send_notification }}"
    then:
      - device_id: !input notify_device 
        domain: mobile_app
        type: notify
        title: "{{ notification_title }}"
        message: "{{ notification_message }}"

I get the error Message in home-assistant.log

ERROR (MainThread) [homeassistant.components.automation.automated_daily_snapshot_for_container_core] Automated Daily Snapshot for Container/Core: Error executing script. Service not found for call_service at pos 1: Unable to find service backup.create

Available Backup services are hassio.backup_partial and hassio.backup_full.
But the service should be available Backup - Home Assistant

My System is
Home Assistant 2022.9.6 Supervisor 2022.09.1 Operating System 9.0 Frontend 20220907.2 - latest x64

Unfortunately, the docs often aren’t up to date. Available services can be checked in Developer Tools —> Services. You have to edit your automation action by replacing the outdated service with service: hassio.backup_full

1 Like

Hi all,

Can the Blueprint be updated? Snapshot is updated to Backup
Services needs to be updated from hassio.snapshot_full to hassio.backup_full

See this update

Thanks!

On my system, the blueprint is at config/blueprints/automation/vorion/

So should just update the YAML for the blueprint to

service: hassio.backup_full?

I believe that should do it, yes.

1 Like

Just to confirm that works!

Hello Vorion,

Can you change hassio.snapshot_full into hassio.backup_full ?
I’ve got an error: Unable to find service hassio.snapshot_full

It was change long time ago.

Thanks

Good to hear.

There is another blueprint that doesn’t require it to be edited to perform a backup.

https://community.home-assistant.io/t/updated-automated-backups/413009

@troy
can you share the backup automation
I have switched to truenas scale and now home-assistant is running in a container, but the backups directory is a symbolic link to a mounted dataset (I could have mounted the entire config directory, but decided to limit the tweaking)
I would like to have an automatic weekly backup, and save the last 10 backups

1 Like

@hanan

Here’s a link to the wiki page I made awhile back. I had planned to do more work there but it never developed any further. Unfortunately, it is not so straightforward to setup.

I’m not sure if using a symbolic link will work. You may need to point the blueprint to your configuration inside the ix-applications dataset

thanks @troy ,

  1. If I understand correctly taking snapshots is relevant only when the home assistant config directory is on a zfs dataset
  2. what are the benefits of having zfs snapshots over home assistant backup files
  3. If I adapt your snapshot automation to truenas scale, I need to change the rest api used. Looking at the zfs.snapshot.xxx apis I see the following: .delete, .clone, .create, .query, .remove, .rollback, .update. I assume you are referring to zfs.snapshot.create, right?

BTW, the symbolic link works. I have my home assistant data set mounted, and I added a backup directory which the config/backups points to, and home assistant can create, delete and restore backups

  1. Correct, we are just using the TrueNAS API to trigger the built in TN snapshot functionality

  2. I don’t necessarily know one is an advantage over the other. Home assistant back up is just a zip file and maybe easier to copy off your NAS creating a true backup. ZFS snapshot could still allow you to restore previous configuration if you deleted a file or something, but typically it is not considered a true backup since you will lose your snapshots if the data set is deleted. When I created the my adapted blueprint, the backup function had not yet been added to Home Assisted Core

  3. Yes, I believe snapshot create is correct

Modified this for pushover notification instead of mobile.app (pushover.net)

blueprint:
  name: Automated Daily Snapshot
  description: Create a full snapshot backup at a given time every day.
  domain: automation
  input:
    trigger_time:
      name: Snapshot creation time
      description: The snapshot will be created at this time, every day
      selector:
        time: {}
    send_notification:
      name: Send notification
      description: Sends a notification via Pushover if enabled
      selector:
        boolean: {}
      default: false
    pushover_key:
      name: Pushover User Key
      description: "Your Pushover User Key"
      selector:
        text:
    pushover_api:
      name: Pushover API Token
      description: "Your Pushover API Token"
      selector:
        text:
    pushover_device:
      name: Pushover Device
      description: "Select which Pushover device to send the notification to"
      selector:
        select:
          options:
            - Device1                # Modify to match the device name from your pushover account
            - Device2                # Modify to match the device name from your pushover account  
    pushover_priority:
      name: Pushover Message Priority
      description: "Select message priority"
      selector:
        select:
          options:
            - "-2"
            - "-1"
            - "0"
            - "1"
            - "2"
  source_url: https://community.home-assistant.io/t/create-automated-backups-every-day/254039
mode: single
max_exceeded: silent
variables:
  backup_filename: Automated backup {{ now().strftime('%F') }}
  send_notification: !input send_notification
  pushover_key: !input pushover_key
  pushover_api: !input pushover_api
  pushover_device: !input pushover_device
  pushover_priority: !input pushover_priority
  notification_title: Automated Daily Backup
  notification_message: >
    Home Assistant full backup created. {{ now().strftime('%F') }}
trigger:
  - platform: time
    at: !input trigger_time
action:
  - service: hassio.backup_full
    data:
      name: "{{ backup_filename }}"
  - choose:
      - conditions: "{{ send_notification }}"
        sequence:
          - service: notify.pushover
            data:
              target: "{{ pushover_device }}"
              title: "{{ notification_title }}"
              message: "{{ notification_message }}"
              data:
                user: "{{ pushover_key }}"
                token: "{{ pushover_api }}"
                priority: "{{ pushover_priority }}"