Add-on: Home Assistant Google Drive Backup

@Mariusthvdb
I’m not aware of a way to merge a snapshot into an SD card without actually starting the instance. It would need to be something supported in the supervisor, since it would depend so heavily on all the places the supervisor stores information. It would be really handy though.

Indeed! Of course I can see the option Roelof describes above, bit I see that still as a second best option, and hardly an immediate swap backup recovery. Imagine your production system crashes, and you have to restart all the way by installing the main image first, etc etc.

compare that to having a full snapshot flash option available…It would be 2 minutes up and running, no hassle and a full system restore as we were…

Isnt there some linux trickery to be done on the snapshots? I imagine the internal commands HA follows do the same when restoring from a snapshot? Or isn’t that a flash, and merely a docker install (or whatever it is called these days)…

Maybe we should always have a brand-new image burn available, eg on the new releases x.2 (never use the .0 !) with your add-on installed, ready to go.

Would we need only that or also the ssh, samba and duckdns (if used) to get going?

Not everyone runs HA on a RPi and SD card. I use this fantastic add-on for my NUC based HA system running on top of Ubuntu. Having the snapshot feature you talk about would only be possible for a certain HA user group

of course, I understand that. I wasn’t really talking about a new feature for the add-on. Merely seeking a way to use the snapshots in the process of flashing a new Sd card. Id fully appreciate it if that would be outside any HA interface. Then again, it would be cool if it were in it :wink: Why not have the snapshot restore use a file browser… though I think I read it that is not allowed.

I think it’s a great idea. For me, it’s not as simple as sticking in a newly formatted SD card. I have to get into a tight utility closet, disconnect the RPi from the hardwired sensor connectors, remove the 3A power supply, drag it to a desk, dig out an old USB keyboard and mouse, find and connect an HDMI cable that will reach a TV, or drag in an old monitor.

It would be SO much easier if I could stick an SD card in my laptop and restore the whole system to that.

And since the main web site for HA strongly recommends a RPi installation for new users, I don’t think it’s too unreasonable to support that environment first.

I have an open feature request that, from the registration screen on a fresh install, there is the option to upload a backup.

@sabeechen @CaptTom

voted my +1 :wink:

1 Like

Just added my vote :slight_smile:

1 Like

I had this up and running via an automation, but it seems to have stopped working on the 7th June. My config hasn’t changed - has there been an update?

My logs now show:

{“errorMessage”: “Redirected but the response is missing a Location: header.”}

When I try to call the service via REST. Any ideas?

EDIT: Sorry - I’m an idiot! I was using a different plugin - have switched to this one and it is much better! Thanks!

apologies if this is the wring place to post this…
I have an automation set to notify me via the mobile app (Android)
the last month or so it hasnt been triggering.
the action part works OK, as i can fire it manually and get the mobile notification OK
Am i missing something with the trigger?

- alias: Snapshot made notification
  initial_state: 'on'
  trigger:
    - platform: state
      entity_id: sensor.snapshot_backup
  condition:
    - condition: template
      value_template: "{{ trigger.from_state.state != trigger.to_state.state }}"
  action:
    - service: notify.mobile_app_oneplus7pro
      data_template:
        title: Snapshot Update
        message: |
          {{ states.sensor.snapshot_backup.attributes.snapshots[1].name }}
          Snapshots on Drive: {{ states.sensor.snapshot_backup.attributes.snapshots_in_google_drive }}
          Snapshots stored locally: {{ states.sensor.snapshot_backup.attributes.snapshots_in_hassio }}

The state of sensor.snapshot_backup will only ever be

  • backed_up (when things are working),
  • error (when there is a problem)
  • waiting (when it first starts up)

so I don’t think this trigger will work as you expect. If you want to get a notification when a new upload happens, I think you’ll need to trigger based on changes to sensor.snapshot_backup.attributes.last_snapshot, which is the date (in text, ISO format) of the most recent snapshot.

That is how I do it :

sensor:

  - platform: template
    sensors:
      last_backup:
        friendly_name: "Last Backup"
        value_template: "{{state_attr('sensor.snapshot_backup', 'last_snapshot')}}"

automation :

- id: '1593338157847'
  alias: Last backup
  description: ''
  trigger:
  - entity_id: sensor.last_backup
    platform: state
  condition:
    - condition: numeric_state
      entity_id: sensor.time_online
      above: 3  
  action:
  - data:
      message: Backed up
    service: notify.notifier_doorbell

Notice the use of the condition sensor.time_online ( the uptime integration) to not get a notification when HA restarts.

Thanks both, this makes more sense.
ive updated my config, will wait for the next update to run

This morning I discovered that my system was trying to create a full backup (~85Gb due to CCTV footage that would normally be excluded) rather than the usual partial one. It seems that the last update of this add-on erased my backup settings and set them to default. Has anyone else had the same?

So the automation ran, but it gave me 2 notifications from the android app?

- alias: Snapshot made notification
  initial_state: 'on'
  trigger:
    - platform: state
      entity_id: sensor.last_backup
  condition:
    - condition: numeric_state
      entity_id: sensor.ha_time_online
      above: 3
  action:
    - service: persistent_notification.create
      data_template:
        title: Snapshot made
        message: >-
          {{ states.sensor.snapshot_backup.attributes.snapshots[3].name }}
          Snapshots on Drive: {{ states.sensor.snapshot_backup.attributes.snapshots_in_google_drive }}
          Snapshots stored locally: {{ states.sensor.snapshot_backup.attributes.snapshots_in_hassio }}
    - service: notify.mobile_app_oneplus7pro
      data_template:
        title: Snapshot Update
        message: |
          {{ states.sensor.snapshot_backup.attributes.snapshots[3].name }}
          Snapshots on Drive: {{ states.sensor.snapshot_backup.attributes.snapshots_in_google_drive }}
          Snapshots stored locally: {{ states.sensor.snapshot_backup.attributes.snapshots_in_hassio }}- alias: Snapshot made notification
  initial_state: 'on'
  trigger:
    - platform: state
      entity_id: sensor.last_backup
  condition:
    - condition: numeric_state
      entity_id: sensor.ha_time_online
      above: 3
  action:
    - service: persistent_notification.create
      data_template:
        title: Snapshot made
        message: >-
          {{ states.sensor.snapshot_backup.attributes.snapshots[3].name }}
          Snapshots on Drive: {{ states.sensor.snapshot_backup.attributes.snapshots_in_google_drive }}
          Snapshots stored locally: {{ states.sensor.snapshot_backup.attributes.snapshots_in_hassio }}
    - service: notify.mobile_app_oneplus7pro
      data_template:
        title: Snapshot Update
        message: |
          {{ states.sensor.snapshot_backup.attributes.snapshots[3].name }}
          Snapshots on Drive: {{ states.sensor.snapshot_backup.attributes.snapshots_in_google_drive }}
          Snapshots stored locally: {{ states.sensor.snapshot_backup.attributes.snapshots_in_hassio }}

Yes. It seems the sensor changes twice within about 2 minutes. I don’t know if it is a bug or intentional.

Just noticed that my backups since 4 days ago went from 280 mb in size to 17 gb. Anyone else seen this?

Mine are looking fine. But I moved my database off my pi, so that could have something to do with it.

You could open the .tar and see what is eating up the space.

Have latest AddOn and no problems at all on latest HA (moment of written)