Home Assistant Backup Notification

I have used Samba Backup ever since I setup Home Assistant. It utilises Samba share. I also use the built in Home Assistant backup. I didn’t want to have to keep checking that they had run successfully. As with any good backup it is only good if it is working and the last thing you want if to find out it has not worked for month if you need it.

I want Home Assistant to send me a notification when the backups had been successful. I asked some LLMs how to do this and none of them got it right. In the end these are the two automations that will send a notification on a successful backup.

As you can see they use the M365-Mail Integration. I wrote about that here. I will get an email and a Home Assistant notification to all my devices.

This is the Samba Backup automation

alias: Notify When SAMBA Backup Completed
description: Sends a notification when a SAMBA Home Assistant backup has been completed
triggers:
  - entity_id:
      - sensor.samba_backup
    trigger: state
    attribute: total_backups_succeeded
conditions: []
actions:
  - data:
      message: >-
        " ✅ Samba Backup completed successfully run at {{
        now().strftime('%Y-%m-%d %H:%M:%S') }}"
      title: Home Assistant Backup Complete
    action: notify.notify
  - data:
      message: >-
        A SAMBA backup of your Home Assistant instance was successfully created
        at {{ now().strftime('%Y-%m-%d %H:%M:%S') }}
      title: "[HA] ✅  SAMBA Backup Complete"
      target: email@domain.com
    action: notify.ms365_mail_baz_m365
mode: single

This is the built is Home Assistant automation

alias: Notify When Backup Completed
description: Sends a notification when a Home Assistant backup has been completed
triggers:
  - trigger: state
    entity_id:
      - sensor.backup_last_successful_automatic_backup
conditions: []
actions:
  - data:
      message: >-
        " ✅ A backup of your Home Assistant instance was successfully created at
        {{ now().strftime('%Y-%m-%d %H:%M:%S') }}"
      title: Home Assistant Backup Complete
    action: notify.notify
  - data:
      message: >-
        A backup of your Home Assistant instance was successfully created at {{
        now().strftime('%Y-%m-%d %H:%M:%S') }}
      title: "[HA] ✅  Native Backup Complete"
      target: email@domain.com
    action: notify.ms365_mail_baz_m365
mode: single
 
Michael Curtis

My introduction to computers started at my middle school in 1981 when our maths teacher brought in a ZX80. That led the computer club being founded and using a Research Machine 380Z

My first computer was a 48K ZX Spectrum which I loved to programme. Once I left school I worked as a photocopier engineer, then a fax engineer and finally moving on the Apple computers.

For the next 30 years I worked as a system administrator. I now work in the cyber security industry as a Sophos Professional Services consultant

https://www.bazmac.me
Next
Next

June Solar Generation and Export Numbers