I have the following script I run manually prior to updating HASS OS:
alias: System_SAMBA Backup manuell
sequence:
- service: hassio.addon_stdin
data:
addon: 15d21743_samba_backup
input: trigger
- wait_for_trigger:
- platform: state
entity_id: sensor.samba_backup
from: RUNNING
to: IDLE
- service: notify.all_devices
data:
title: ✅ SAMBA-Backup fertig
message: >-
Das manuell gestartete SAMBA-Backup ist nun abgeschlossen (gestartet um
{{ state_attr('script.system_manual_sambabackup', 'last_triggered') }})
data:
subtitle: ''
push:
thread-id: backup-notification-group
mode: single
icon: mdi:backup-restore
Initially I only had the run addon and the notification section, which lead to the notification “Backup finished!” being sent immediately after starting the script.
So I added the wait_for_trigger section. What I want it to do, is to wait until the backup has finished and send a notification.
Unfortunately, it doesn’t work with above code. Script still is running, probably because it is still waiting. That sensor has already changed from RUNNING to IDLE but the script is not aware of it.
Gonna change the settings and give it a try at next chance.
For now I simply removed the „from“ value as it‘s optional. This way the script should now safely ignore the end of the backup, no matter if it succeeded or failed or has been canceled or…
Just never monitored the finishing closely and because it probably only shows up for a second or so it is not visible e. g. on the history card.
I want to add a second script which only creates a HA backup (e. g. before updating HA).
For this, using Samba Backup addons seams too complicated because you can only set excludes, but not includes like “only backup this and that, nothing else”.
Maybe you can help me on this too @tom_l : 1) Is it possible to manually trigger Samba Backup addon so it creates only a HA backup?
Otherwise I´d go with the hassio.backup_partial service. But then another issue comes up: 2) How to check within a script if the backup (using this service) finished?
That’s not bulletproof, unfortunately. Maybe tomorrow I add another addon, in 1 year there might be 7 additional addons - I don’t want to constantly think about “Wait a moment… don’t I need to update a script?”. So that SAMBA Backup limitation (not providing a whitelist, only a blacklist) is pretty ugly.