This Home Assistant extension exposes a service to automate the clean up of old backups.
To be able to use this extension you must have the following integrations enabled and configured within your Home Assistant installation.
To manage the installation and upgrades easier it's recommended to use HACS.
You can either use the easy button or you can install manually with the steps below.
- Navigate to HACS Store
- Search for "Clean up snapshots service"
- Click on the service, and then on DOWNLOAD
- Restart Home Assistant
Adding the Clean up snaphots service can be done via the user interface by using this My button:
If the above My button doesn't work, you can also perform the following steps manually:
- Browse to your Home Assistant instance.
- In the sidebar, select Settings.
- From the configuration menu, select Devices & Services
- In the bottom right, select the Add Integration button.
- From the list, search and select "Clean up snapshots service".
- Follow the instructions on screen to complete the setup.
Warning The setup via the configuration.yaml file is being deprecated and will be removed in a future release. Add the following to your configuration.yaml file. Adjust the value number snapshots you want to keep.
clean_up_snapshots_service:
number_of_snapshots_to_keep: 3 # optional, default value is 0
- Restart Home Assistant (Settings > System > Restart)
- Look for the new
clean_up_snapshots_service.clean_up
service (Developer Tools > Services).
You can trigger this service in an automation similarly to the one below.
alias: Daily snapshot clean up
initial_state: 'on'
trigger:
platform: time
at: '03:00:00'
condition:
action:
- service: clean_up_snapshots_service.clean_up
# Data is optional if you have defined the number of snapshots to keep in the configuration.yaml.
# data:
# If this property is passed to the service it will be used regardless of what you have in the configuration.yaml
# number_of_snapshots_to_keep: 7