Automating Snapshots on Configuration Changes

Hey everyone, I’ve been diving into automating my Home Assistant setup to make it more efficient. One thing I’m really aiming to streamline is how I handle backups. Currently, I have an automation set up to create a full snapshot every day, but as you can imagine, this eats up a lot of space on my SD card. I end up having to prune them manually every week or so to prevent disk full errors. It would be fantastic if Home Assistant could purge snapshots automatically, similar to how it handles the Recorder. Unfortunately, this feature isn’t available yet, so I’m trying to find a workaround.

I came across the idea of creating a snapshot only when I make changes to my configuration. This way, I’d save space and only back up when necessary. Following some tips from the documentation and the forum, I attempted to use the FileWatcher component to trigger an automation upon configuration changes. Here’s what I added to my /config/configuration.yaml:

yaml
homeassistant:
whitelist_external_dirs:
- /config

folder_watcher:

  • folder: /config
    patterns:
    • ‘*.yaml’
    • ‘*.sh’
    • ‘*.conf’
    • ‘lovelace’

And in my /config/automations.yaml:

yaml

  • id: ‘1518037286763’
    alias: Snapshot on change
    description: Create snapshot whenever the configuration changes
    trigger:
    • event_data:
      event_type: created,deleted,modified,moved
      event_type: file_watcher
      platform: event
      condition:
      action:
    • data:
      message: Creating a new snapshot because the configuration has changed
      notification_id: config
      title: Config change
      service: persistent_notification.create

However, despite setting this up, the automation never triggers. I’m a bit stuck and would love some fresh eyes on this. Any ideas on what I might be missing? I’m really hoping to get this working to keep my backups more manageable and efficient. Thanks in advance for any help!

Cheers,
[Your Name]