Google Calendar platform results in a Python exception

For quite some time now my HA failed to connect to my Google calendars, this is the exception I run into, any help would be appreciated here

2018-09-14 17:13:06 ERROR (MainThread) [homeassistant.components.calendar] Error while setting up platform google

Traceback (most recent call last):
File “/usr/src/app/homeassistant/helpers/entity_platform.py”, line 128, in _async_setup_platform
SLOW_SETUP_MAX_WAIT, loop=hass.loop)
File “/usr/local/lib/python3.6/asyncio/tasks.py”, line 358, in wait_for
return fut.result()
File “/usr/local/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/src/app/homeassistant/components/calendar/google.py”, line 39, in setup_platform
for data in disc_info[CONF_ENTITIES] if data[CONF_TRACK]])
File “/usr/src/app/homeassistant/components/calendar/google.py”, line 39, in
for data in disc_info[CONF_ENTITIES] if data[CONF_TRACK]])
File “/usr/src/app/homeassistant/components/calendar/google.py”, line 51, in init
super().init(hass, data)
File “/usr/src/app/homeassistant/components/calendar/init.py”, line 89, in init
self.update()
File “/usr/src/app/homeassistant/components/calendar/init.py”, line 155, in update
if not self.data or not self.data.update():
File “/usr/src/app/homeassistant/util/init.py”, line 325, in wrapper
result = method(*args, **kwargs)
File “/usr/src/app/homeassistant/components/calendar/google.py”, line 108, in update
service, params = self._prepare_query()
File “/usr/src/app/homeassistant/components/calendar/google.py”, line 74, in _prepare_query
service = self.calendar_service.get()
File “/usr/src/app/homeassistant/components/google.py”, line 247, in get
http = credentials.authorize(httplib2.Http())
AttributeError: ‘NoneType’ object has no attribute 'authorize’strong text

Check here:

1 Like

Thanks a lot for this, I can’t believe I spent so much time having this dumb issue :man_facepalming:

I had this happen to me randomly recently after the calendar had been working fine for a good few months after a hass restart. My solution was to move the .google.token file (which was not empty and appeared to be just fine) to a different file name, then restarted hass and did the process to reauthorize the app using https://www.google.com/device again, and everything went back to normal and a new .google.token was created… Not sure why it crapped out all of a sudden, but that was the fix.

1 Like

Deleting my (hidden) .google.token file and reauthorising via the notification that pops up fixed a similar issue for me.

2 Likes