Service to remove backup

Today, the backup integration offers only one service: create
That would be great to have a service remove as well, taking a date or number of days to keep as parameter
I’ve a backup from every Monday since January 2023, I don’t need that many.

EDIT: Something like this

alias: Backup hebdomadaire
description: ""
trigger:
  - platform: time
    at: "01:00:00"
condition:
  - condition: time
    weekday:
      - mon
action:
  - service: backup.create
    data: {}
  - service: backup.remove
    data:
      days: 180
mode: single

Why?

I don’t want anything possibly deleting my last good backup. I prefer manual management of my backup files:

1 Like

The Samba Backup add-on allows you to specify how many backups you want to retain on the HA server.

1 Like

I’m using Core.

I’m talking about deleting everything that is older than 6 months for exemple.
And as my backup scheduling is in an automation, I don’t want to go in System > Backup and start clicking to keep a moving window of backups.
Every new weekly backup taken by the automation will remove the oldest weekly backup as well, that easy.
And I’m talking about a service. If you’re scared to remove a good backup, don’t call it :slight_smile:

I don’t know where you are but I definitly don’t have a checkbox in my setup

Home Assistant 2023.9.2
Supervisor 2023.09.2
Operating System 10.5
Frontend 20230911.0 - latest

Yes! I have the same issue. I have an external script to copy these backups offsite, and from time to time I have to go grab a coffee and start clicking away to remove the backups from the UI.

Removing them from the disk doesn’t help as the entry remains in HA.

Try restarting HA.

the core backup system is different than the supervisor backup system.

Anyways, you can simply create a cron job that does that. Not at home at the moment but I have one that deletes after 2 weeks.

Agree, I’m also the king of the workarrounds.
But would be nice, as a service exists to create a backup, to have additional service(s) to manage (even restore) one.

1 Like