Created new add-on to backup snapshots to Google Drive

Tags: #<Tag:0x00007f2058533840>


After ignesting code I get only

Server Error (500)

I use duckdns plugin for ssl


I was getting a similar error. I have an ASUS router and I had to forward port 8055 to 8055 to the IP address of my HASSIO device. After doing that it works for me.

Hope this helps


Tried the same, no success


I’m getting the following error when trying to execute it in browser

{"errorMessage": "&lt;HttpError 404 when requesting;spaces=drive&amp;fields=files%28id%2C+name%29&amp;alt=json returned \"File not found: .\"&gt;"}

Is that File not found referring to missing backup file? I could not verify whether the snapshots are actually ending to such a folder on Pi (newbie with Raspberry … still trying to get understanding where such a folder should be)


It looks like you didn’t set the backupDirID in your configuration per these instructions.


Did you find any solution? I’m getting the same error


Works perfect!
It would be great if another endpoint saved the latest response from the backup get request, so that we could make rest sensors to quickly see things like backupTimestamp, backedUpCount and the other interesting stuff in the response!


In the end I did not find any typos in the backupDirID nor elsewhere. Ended up redoing all the steps again from the beginning (not reinstalling the addon) and then it started to work. Cannot even guess whether human error or some delay in the authorization etc. was the issue


Ahh! Based on what you just said, and based on the content of error that you shared earlier (I remember seeing my dummy value for the backupDirID in that error message), I’m guessing that your original edits to the configuration were not picked up by my add-on. It’s likely that restarting the add-on caused it to finally pick up your edits. Sort of a guess. And that shouldn’t happen. But I’m glad it’s working for you now.


@samccauley thanks and respect for the addon! worked perfect for me. imho it should be part of the official repo.


Hi @samccauley

I’m getting this error when is launched by automation:

2019-02-15 03:30:05 ERROR (MainThread) [homeassistant.components.automation] Error while executing automation automation.backups_en_google_drive. Unknown error for call_service at pos 1: 
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/aiohttp/", line 955, in _create_direct_connection
    traces=traces), loop=self._loop)
  File "/usr/local/lib/python3.6/site-packages/aiohttp/", line 825, in _resolve_host
    self._resolver.resolve(host, port, family=self._family)
  File "/usr/local/lib/python3.6/site-packages/aiohttp/", line 30, in resolve
    host, port, type=socket.SOCK_STREAM, family=family)
  File "uvloop/loop.pyx", line 1459, in getaddrinfo
socket.gaierror: [Errno -3] Try again 

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/", line 105, in async_service_handler
  File "/usr/local/lib/python3.6/site-packages/aiohttp/", line 476, in _request
  File "/usr/local/lib/python3.6/site-packages/aiohttp/", line 522, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "/usr/local/lib/python3.6/site-packages/aiohttp/", line 854, in _create_connection
    req, traces, timeout)
  File "/usr/local/lib/python3.6/site-packages/aiohttp/", line 959, in _create_direct_connection
    raise ClientConnectorError(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host myDomain:8055 ssl:None [Try again]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/automation/", line 380, in action
    await script_obj.async_run(variables, context)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/", line 131, in async_run
    await self._handle_action(action, variables, context)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/", line 210, in _handle_action
    action, variables, context)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/", line 299, in _async_call_service
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/", line 85, in async_call_from_config
    domain, service_name, service_data, blocking=blocking, context=context)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/", line 1130, in async_call
    self._execute_service(handler, service_call))
  File "/usr/local/lib/python3.6/site-packages/homeassistant/", line 1152, in _execute_service
    await handler.func(service_call)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/", line 118, in async_service_handler
    _LOGGER.error("Client error %s.", request.url)
UnboundLocalError: local variable 'request' referenced before assignment

It has happened three consecutive nights. The next day I launch the automation manually and everything works correctly. Do you have any idea what may be happening?



It sounds like a problem with how your automation is setup. Here’s my setup…

I have my automation setup like this:
- id: '1541263656718'
  alias: Run Google Backup
  - at: 02:00:00
    platform: time
  - condition: time
    - mon
    - wed
    - fri
  - service: rest_command.google_backup

The automation uses a REST command that I setup like this:
    url: 'http://localhost:8055/gb/doBackup'
    timeout: '300'

The timeout value is important. It doesn’t work with shorter/default timeout.


I have a timeout of 300 set, but as an Integer, not String.

Maybe that’s the problem. Here is my automation:

- id: '1550049006025'
  alias: Backups en Google Drive
  - at: 06:30:00
    platform: time
  condition: []
  - service: rest_command.google_backup

In the configuration.yaml I have this:

    url: !secret url_google_backup (
    timeout: 300


According to the manual, the doBackup service would send a JSON response. How can I get this data?
I would like to send a notification with the content of it.


it has stop working and for some reason im getting this in logs

Segmentation fault (core dumped)

what that means


im using 0.88.0b2 version so im wondering if there was any changes cause this addon use to work in other versions


The JSON is returned in the HTTP response. If you use a tool like Postman, for example, you’ll see the response. I don’t know that Home Assistant does with the response, though.


Update to version 1.5.0. I’m now publishing an MQTT event with the JSON in it.


Try version 1.5.0. I’m not publishing an MQTT event with the JSON response in it.