Updated Automated Backups: For Container/Core

Based on Updated Automated Backups

This Blueprint works exactly the asme as Updated Automated Backups, but supports the backup.create service that will be added in 2022.5 for Container and Core users.

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

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 }}"

Edit: Now uses new if statements from 2022.5
Edit: Added a minimum version.

1 Like

Since it is already 2022.5 depending, you could use an if statement instead of the choose :wink:

2 Likes

I hadnā€™t looked at the change logs yet! Nice addition.
Itā€™s a lot better suited for this.
Iā€™ll change it over :+1:

I also suggest this to make sure you donā€™t get complaints that it doesnā€™t workā€¦

Good call, all done.

1 Like

I am having issues with this script. When I have tried to run it I got message:

" The automation ā€œDaily Backupā€ (automation.daily_backup ) has an action that calls an unknown service: backup.create ."

I suppose that I have not enabled sth but I am not sure what to do.

EDIT
I have managed to get it running using HASSIO.BACKUP_FULL instead of backup.create. Now I am not sure if there are changes in the HA or I am running a different version.

Hi there,

The backup create command is slightly different between HA OS and users of Core/Container.

You donā€™t need to change anything else, the blueprint will work exactly the same.

The original blueprint linked at the top of the page as was written for HA OS users and is exactly the same other than the service it calls.

Thanks for the blueprint. Works well for me.

I have a question. Since it is a daily backup, how can you automatically remove old backups? Is there a way to integrate it into the blueprint?

Not built in to HA unfortunately.

You could either use a cron task on the host or this custom_component GitHub - jcwillox/hass-auto-backup: šŸ—ƒļø Improved Backup Service for Home Assistant that can Automatically Remove Backups and Supports Generational Backup Schemes.

Hope that helps