šŸ’¾ Create Automated Backups Every Day

Yep, didnā€™t realize that integration is recursive. You donā€™t need an input boolean, just use a trigger based on the modified event and created event.

trigger:
  - platform: event
    event_type: folder_watcher
    event_data:
      event_type: modified
  - platform: event
    event_type: folder_watcher
    event_data:
      event_type: created

I donā€™t want to create a snapshot every time I hit save, thatā€™s why I suggested to store that ā€œconfig changed todayā€ in an input_boolean.

1 Like

Nice idea! One gotcha though, if you are going to watch the full /config folder with folder watcher make sure events for modifications to the db file and log are excluded.

The DB is the biggest problem since it updates so much. For anyone that uses the MariaDB add-on this isnā€™t an issue but if using the out of the box configuration the entire DB is a file in /config. I made this mistake once and almost fried my CPU before I realized what had happened. Made me very glad I had set up alerts for the CPU temperature rising too high.

Sadly thatā€™ll make it a bit tricky to implement in practice since you can only provide inclusion patterns to folder watcher. Thereā€™s a lot of random subfolders created by integrations and things and it doesnā€™t help that many of the files (including all the ones in .storage) have no extension so its tough to make an inclusion filter for them.

Really need an ā€œexclude this file/patternā€ option.

1 Like

Sound good. For the schedule I will try to use the scheduler card to turn on and off the automation. For the partial backup that was more a nice to have.

Can a database stop be added so the database is stopped prior to the snapshot and restarted after it completes? I just found out that the add on snapshot to google drive allows the db to be stopped prior to the backup. This is needed to prevent a db corruption. I just did a snapshot and restore to a new device and this works. Also the add-on can be schedule so Iā€™m not sure the need of this blueprint.

Hi @vorion,

thank you so much for this really helpful blueprint! :fire:

Iā€™m kickstarting a small project which aims to create a curated collection of reliable, documented and high quality blueprints, which could eventually become a valuable resource both for Home Assistant newcomers and experienced users.

I published Awesome HA Blueprints as a website which can be easily browsed, but the codebase, including the list of blueprints, is available in this GitHub repository . The project is still in its early stages but I hope many blueprints will be added in the upcoming weeks and months.

Hereā€™s the original thread:

It would be amazing to have this blueprint in the collection.
If youā€™ve time and youā€™re interested in contributing and helping the project, it would be great if you could submit your blueprint by opening a Pull Request there. Also, I could take care of adding it to the list if youā€™d like to.
Just let me know. :+1:

Thank you for your time! :fire:

1 Like

Sorry for maybe a stupid question, but when I run this script (automation) i got this error:

Unable to find service hassio.snapshot_full

Any clue? I didnā€™t found a way how to add this service.
PS: Running HA via Balenaā€¦ maybe this service is missing in this distro?

Thanx a lot!
Maxim

Can this Blueprint be updated for next HA release?
snapshot_full is replaced by backup_full :wink:

Nevermindā€¦ it seems it has been reverted for now

Reverted because it needs a new supervisor. It wasnā€™t backing up for the last few days (reverted in 2021.8.0b5)
Itā€™s comingā€¦

Ok then back to my original request :smiley:

Agreed. Iā€™ve noticed the deprecated status in the logs tooā€¦

While it gets done, you can do it also in the config\blueprints\automation\vorion\create-automated-backups-every-day.yaml

Line 39

change

  • service: hassio.snapshot_full

to

  • service: hassio.backup_full

P.S. I did not want to copy that stuff and create a new blueprint as this would take away vorions credit :wink:

1 Like

Wondering if it could be possible to also delete previous snapshots if all went well.

I use this GitHub - tmonck/clean_up_snapshots: Service to clean up your home assistant snapshots, so you don't manually have to.

1 Like

Hi, i get an often the following Error. What could it be?

Logger: homeassistant.components.automation
Source: components/automation/init.py:646
Integration: Automatisierung (documentation, issues)
First occurred: 08:08:19 (1 occurrences)
Last logged: 08:08:19

Blueprint Automated Daily Snapshot generated invalid automation with inputs OrderedDict([(ā€˜trigger_timeā€™, ā€˜24:00:00ā€™), (ā€˜send_notificationā€™, True), (ā€˜notify_deviceā€™, ā€˜61840df3aa94bac80a6241014f744687ā€™)]): Expected HH:MM, HH:MM:SS or Entity ID with domain ā€˜input_datetimeā€™ or ā€˜sensorā€™ @ data[ā€˜atā€™][0]. Got None

Nearly 2 months after the change from ā€œhassio.snapshot_fullā€ to ā€œhassio.backup_fullā€ and this is still not fixed? What gives? I did it in config myself but itā€™s a 5 second fix.

2 Likes

I updated line 39 and now Iā€™m getting ā€œError while executing automation automation.automated_daily_snapshot: Unable to find service hassio.backup_fullā€ I thought that was suppose to fix this. Any thoughts?

posted a fixed version of this here: Updated Automated Backups

@rcursaru Thank you!