Add-on: Home Assistant Google Drive Backup

I have disable watchdog because my mariadb is running for months correct.

Ah they say explicitely:

The Supervisor will automatically restart the add-on if it stops, regardless of the reason (crash/manual stop). The watchdog does not know if you’re testing an add-on or playing around with different options, and so it might restart when you don’t need it

Its a bit ironic that I’d release this feature right after they release that one that breaks it. I don’t think there will be a way to me circumvent the watchdog if you have it enabled for an addon that you want stopped.

create a option to disable watchdog and then the add-on… backup enable watchdog, automatic add-on will start also again :smiley:

In theory, there should be a control to be able to disable the watchdog, else the ability to stop an add-on is pointless.

Ok,I’ve been using home assistant for a couple yrs now on Mac, Pi3/4, NUCs, with Raspbian, Debian, Ubuntu, etc, and can say unequivocally that this is the single most well written add-on I’ve EVER USED or installed. And I mean EVER.

I just bought you 5 coffees and I’ve never done that before.

After literarily battling for a year trying to get a Dropbox Sync solution working where I can manage my backups, space and number of saved backups on each side, using every tool, automations, and command line tool you can imagine, I finally gave up and am now using your tool and I’m just blown away.

My resistance stemmed from not wanting to use any products from Google. But, alas, there are times when even I throw in the towel for an elegant solution.

I can only hope Other cloud storage providers might be supported in the future.

Anyway, really we’ll done. I hope other home assistant devs take a long look at your work and try to emulate it. We will all benefit greatly, as will all newcomers to this platform.

Jeff

3 Likes

Implement it in the HA core… :smiley: I love this AddOn also !!!

can you help me to get this card working, used the same config but doesn’t work

besides this card, does the add-on do its job, and create backups? You should be able to check in the add-on itself. The backup sensors should be some indication too, uncustomized you should see something like this:

I ask since this could be a markdown issue in your config, or a more serious issue …

either way, what are your settings in the add-on,
mine are:

max_snapshots_in_hassio: 4
max_snapshots_in_google_drive: 2
days_between_snapshots: 1
use_ssl: true
snapshot_time_of_day: '02:00'
snapshot_name: >-
  {type}, HA Rpi4 {version_ha}  Hassos {version_hassos} at {hr24}:{min}:{sec}
  {day}-{month}-{year}
specify_snapshot_folder: true
send_error_reports: false
ignore_ipv6_addresses: true

yes, the addon works great, no issues there

can you enter the templates in the developer-tools/template ?what do they return?

I think it is a card issue

      - type: markdown
        style: |
          ha-card {
          background: 'var(--paper-card-background-color)';
          }
        content: |
          ## <ha-icon icon='mdi:home-assistant'></ha-icon> --> <ha-icon icon='mdi:google-drive'></ha-icon> Home-assistant backed-up
          **Snapshots:**
          {%- for sh in state_attr('sensor.snapshot_backup','snapshots') %}
            - Name: {{sh.name}}
              Date: {{as_timestamp(sh.date)|timestamp_custom('%d %b: %X')}}
              State: {{sh.state}} <br>
          <br/>
          {%- endfor %}
          ___
          **Details:**
            - Last snapshot: {{as_timestamp(state_attr('sensor.snapshot_backup','last_snapshot'))|timestamp_custom('%d %b: %X')}}
            - On Google Drive: {{state_attr('sensor.snapshot_backup','snapshots_in_google_drive')}}
            - In Hassio: {{state_attr('sensor.snapshot_backup','snapshots_in_hassio')}}
           

what happens if you try this code:

type: vertical-stack
cards:
  - type: markdown
    title: Home Assistant snapshots
    style: |
      ha-card {background: var(--card-background-color);}
      .card-header {color: var(--primary-color);font-weight: bold;}
    content: |
      from <font color='#03a9f4'><ha-icon icon=mdi:home-assistant></ha-icon></font> to <a href='https://drive.google.com/drive/my-drive'><font color='#4ca067'><ha-icon icon=mdi:google-drive></ha-icon></font></a>

      **Snapshots:**
      {%- for sh in state_attr('sensor.snapshot_backup','snapshots') %}
        - Name: {{sh.name}}
          Date: {{as_timestamp(sh.date)|timestamp_custom('%d %b: %X')}}
          State: {{sh.state}} <br>
      <br/>
      {%- endfor %}
      ___
      **Details:**
        - Last snapshot: {{as_timestamp(state_attr('sensor.snapshot_backup','last_snapshot'))|timestamp_custom('%d %b: %X')}}
        - On Google Drive: {{state_attr('sensor.snapshot_backup','snapshots_in_google_drive')}}
        - In Hassio: {{state_attr('sensor.snapshot_backup','snapshots_in_hassio')}}

  - type: conditional
    conditions:
      - entity: binary_sensor.snapshots_stale
        state_not: 'off'
    card:
      type: markdown
      title: Stale Snapshots!
      content: >-
        Snapshots are stale! Please visit the 'Hass.io Google Drive Backup' add-on
        status page for details.

btw, you are still using var(--paper-card-background-color) which is replaced by var(--card-background-color) Also, empty lines are necessary to get the correct spacing and format in markdown, you can’t just delete these. (though they won’t influence the templates…)

2 Likes

still don’t understand why the script part does not work

found the culprit, had an old markdown-mod in my resource file.
Thank you @Mariusthvdb for your support and assistance.

1 Like

Glad you found it ! Always welcome.

Got it up and running smoothly and perfectly. Thank you and well done! First add-on that I’ve installed by adding custom URL. Not sure why this isn’t included by default, while some others should probably be removed!

I have a stale snapshot showing on my HA install, google drive backup has been working for ages but now noticed this:

image

this is the status of my snapshot sensor:

friendly_name: Snapshot State
last_snapshot: '2020-10-13T00:55:39.595983+00:00'
snapshots_in_google_drive: 9
snapshots_in_hassio: 3
snapshots_in_home_assistant: 3
size_in_google_drive: 956.8 MB
size_in_home_assistant: 307.6 MB
snapshots:
  - name: 'Full Snapshot 2020-09-19 01:24:46'
    date: '2020-09-19T00:24:47.744121+00:00'
    state: Drive Only
    size: 107.9 MB
  - name: 'Full Snapshot 2020-09-22 01:30:43'
    date: '2020-09-22T00:30:45.208012+00:00'
    state: Drive Only
    size: 107.8 MB
  - name: 'Full Snapshot 2020-09-25 01:36:38'
    date: '2020-09-25T00:36:39.747018+00:00'
    state: Drive Only
    size: 108.1 MB
  - name: 'Full Snapshot 2020-09-28 01:42:28'
    date: '2020-09-28T00:42:29.488150+00:00'
    state: Drive Only
    size: 108.0 MB
  - name: 'Full Snapshot 2020-10-01 01:48:21'
    date: '2020-10-01T00:48:22.416715+00:00'
    state: Drive Only
    size: 108.3 MB
  - name: 'Full Snapshot 2020-10-04 01:54:32'
    date: '2020-10-04T00:54:33.945102+00:00'
    state: Drive Only
    size: 109.2 MB
  - name: 'Full Snapshot 2020-10-07 01:00:36'
    date: '2020-10-07T00:00:37.396701+00:00'
    state: Backed Up
    size: 108.2 MB
  - name: 'Full Snapshot 2020-10-10 01:26:59'
    date: '2020-10-10T00:27:00.188589+00:00'
    state: Backed Up
    size: 106.0 MB
  - name: 'Full Snapshot 2020-10-13 01:55:38'
    date: '2020-10-13T00:55:39.595983+00:00'
    state: Backed Up
    size: 93.4 MB

this is my config:

max_snapshots_in_hassio: 3
max_snapshots_in_google_drive: 9
days_between_snapshots: 3
use_ssl: false
snapshot_time_of_day: '01:00'
send_error_reports: true

Not really sure what the stale warning is being driven by?

May I ask, what’s the difference between the two attributes?

snapshots_in_hassio
snapshots_in_home_assistant

Thank you!

@Matt_Barnes
Your misunderstanding is a common one, and comes from an unfortunately named type of sensor. I’m going to try to be clear in my language because (I may sound pedantic) because otherwise this wouldn’t be the first time I’ve failed to explain it well.

The device_class: problem means it is a sensor that indicates if there is a problem, this is a naming convention that Home Assistant uses. In this case its if the problem “Snapshots Stale” is present. When this sensor is off (as yours is) then that means there is no problem, the snapshots are not stale. When its on, then there is a problem and you should go to the Web UI.

When the addon was younger, I tried representing this sensor in different ways. Unfortunately, this way is the least confusing. Or rather, it is the one that makes the fewest people file bugs with me confused about what it is :slight_smile:

If you want to get rid of the sensor you can turn it off in the addon’s settings. It will be gone next time you restart Home Assistant.

@moto2000 They’re always the same. Home Assistant used to be called “Hass.io”, so thats what I put in the sensor back then. Then they changed the name and I wanted to be consistent with their naming, so I put in both in case someone has already written scripts that depend on “snapshots_in_hassio” being present but aren’t scrutinizing every single line of my addon’s changelog.

I know not the cleanest, bu I try to avoid breaking backwards compatibility in updates unless I have no choice.

1 Like