Schedule Backup in HA OS?

hi,

I recently migrated from a Debian VM with HA running to HAOS. Backup/ restore went smoothless!

Now I am looking for a way to configure my backup in HA OS (before I used /etc/crontab on Debian).

I already was able to configure an external backup target to store my backups on a NAS share and configure HAOS to use this as primary target.

Now I am looking for a way to configure the starting time for the backup as well as the number of “to-keep”.

Currently I only have a single backup with start around 19:00 daily. No good. I prefer as starting time somewhere in the night (ie 3:00) and please keep 7 old backups.

I have not found a place where to configure. And no, the current backup is not based on an automation. It must be configured somewhere else… where?

Any idea?

Thanks a lot!
/KNEBB

Check out option 5 here: https://www.home-assistant.io/common-tasks/os#copying-your-backups-to-another-location

Lot’s of ways to do what you want.

I prefer the SAMBA bacckup add-on. It has configurable numbers of backups to keep locally and on the remote share (I keep 7 local, 30 on my NAS).

Hi,

thanks for advice. However, this does not apply to me. I already haven my backups on a remote location.

But the schedule does not fit nor does the number of backups to be hold.

I expected this to be at least partially configurable without the need to install another add-on.

Why using a 3rd party tool when HAOS can do it -more or less- by itself?

So where’s the entry why the backup starts atound 19:00? Is this the default setting?

/KNEBB

This is the gold standard for HA OS backup. Rock solid and has the start time and retention features you are looking for.

Hi,
I simply created an automation that triggers at a specified time and calls the service hassio.backup_full
Works perfectly for me and you can also specify the location and other settings.
My NAS will download the backup files fom HA and runs a clean-up job to delete old Backups from HA directly.
You can propanly also create a shell command and execute it with an automation to do the clean-up.
Br

Again, I am NOT looking for an AddOn which has perfect features!
I do not have GoogleDrive nor am I planning to get access!

Same here. Sorry, but not helpful.

I am having a backup which is running. Just not perfectly. I am looking for a way to (re-)configure the existing one.

Creating an automation add another backup which results in having two backups. Which I do not want.

/KNEBB

Sorry, I missunderstood your first post.

Could it be that it is an automation which does not show in the GUI?
Have you had a look into the automations.yaml file if there shows something up which could be your current backup?
Propably something in the configuration.yaml?

I have never heard about a default backup job in HA so far.

Hi,

THAT was a good hint! Although I did not find any occurences there. But I did not see a backup from today. So looks like it miracally disapeared…

However, I created now a backup Job which creates a full backup to my NAS folder from where my “real” backup tasks is running.

Thanks for the input, guys!

/KNEBB

I have been using the Samba backup add-on as well. It is great. However, my NAS does fill up sometimes, not from Samba backups. Unfortunately, in this case, the add-on does not report an alert when the backup fails. It may be possible to report it through an automation.

Also, now that HAOS supports SMB natively, there is less reason to use this add-on. It is mainly for scheduling purposes, and automatic cleanup.

Those are two excellent reasons to continue to use it. And yes you can automate getting alerted if the backup fails.

Mine haven’t ever failed so all I have to show is the success message:

Can share the automation if you need it.

To mitigate this I created a cron job on my NAS which removes old backups.

For your case this is not helpful, indeed. However- I suggest to create a seperate disk space for your HA backups so this is not getting filled up by other NAS users.

/KNEBB

Yes, please do. I didn’t know it was possible to do that. I only want to be notified of failures, though.

You should be able to adjust this:

- id: da632942-cd32-4699-8648-3a48256df2f6
  alias: Backup Notifications
  triggers:
    - trigger: state
      entity_id: sensor.samba_backup
      not_to:
      - unknown
      - unavailable
      - IDLE
  actions:
    - action: >
        {% if states('sensor.samba_backup') == 'FAILED' %}
          notify.telegram_alert
        {% else %}
          notify.telegram_system_log
        {% endif %}
      data:
        title: >
          {% if states('sensor.samba_backup') == 'RUNNING' %}
            📅 <b>Samba backup</b>
          {% elif states('sensor.samba_backup') == 'SUCCEEDED' %}
            ✅ <b>Samba backup</b>
          {% elif states('sensor.samba_backup') == 'FAILED' %}
            ❌ <b>Samba backup</b>
          {% else %}
            ❓ <b>Samba backup</b>
          {% endif %}
        message: "{{ states('sensor.samba_backup')|title }}."
    - action: logbook.log
      data:
        name: Samba Backup
        message: "{{ states('sensor.samba_backup')|title }}"

You also need to restore the SAMBA backup sensor when HA starts:

- id: 46ba1b3e-14bc-4237-abb6-e9146eacc575
  alias: 'Startup'
  triggers:
    - trigger: homeassistant
      event: start
  actions:
    - action: hassio.addon_stdin
      data:
        addon: 15d21743_samba_backup
        input: restore-sensor
1 Like

Thank you very much !