home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.65k stars 30.79k forks source link

Google Calendars Integration does not work anymore after upgrading to 2022.4.0 #69453

Closed mabotze closed 2 years ago

mabotze commented 2 years ago

The problem

Google Calendars integration doesn't work anymore. The calendar entitites aren't available after upgrading.

What version of Home Assistant Core has the issue?

core-2022.4.0

What was the last working version of Home Assistant Core?

core-2022.3.x

What type of installation are you running?

Home Assistant Supervised

Integration causing the issue

Google Calendars

Link to integration documentation on our website

https://www.home-assistant.io/integrations/google/

Diagnostics information

No response

Example YAML snippet

google:
  client_id: YOUR_CLIENT_ID
  client_secret: YOUR_CLIENT_SECRET

Anything in the logs that might be useful for us?

`Unable to prepare setup for platform google.calendar: Platform not found (cannot import name 'calculate_offset' from 'homeassistant.components.calendar' (/usr/src/homeassistant/homeassistant/components/calendar/__init__.py)).`

Additional information

No response

probot-home-assistant[bot] commented 2 years ago

google documentation google source (message by IssueLinks)

probot-home-assistant[bot] commented 2 years ago

Hey there @allenporter, mind taking a look at this issue as it has been labeled with an integration (google) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)

ahmadtawakol commented 2 years ago

I'm getting the same error with an ical calendar as well. So it's not specific to Google Calendar.

allenporter commented 2 years ago

Ical is a custom component right? There was a breaking change here and ical needs to be updated.

As for Google calendar: are you sure your home assistant was updated properly? Just checking as the code to call that was deleted, but I'll look closer.

allenporter commented 2 years ago

I just confirmed there is no code that references calculate_offset in the latest home assistant. Something is wrong with your update...

vingerha commented 2 years ago

My google calendar works fine with me, the error is probably not correct and possibly referring to google if that is your only calendar.....and yes, ical is custom component

martin131 commented 2 years ago

Same problem with this ical - http://jan.pejsa.info/data/blog/ical/namedays-czech-republic.ical

kaizersoje commented 2 years ago

Not working for me as well since upgrading to 2022.4.0. Getting this error.

2022-04-07 22:30:17 ERROR (MainThread) [homeassistant.components.calendar] Error while setting up google platform for calendar
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform
await asyncio.shield(task)
File "/usr/src/homeassistant/homeassistant/components/google/calendar.py", line 76, in async_setup_entry
await hass.services.async_call(DOMAIN, SERVICE_SCAN_CALENDARS, blocking=True)
File "/usr/src/homeassistant/homeassistant/core.py", line 1634, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1671, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File "/usr/src/homeassistant/homeassistant/components/google/__init__.py", line 246, in _scan_for_calendars
calendars = await calendar_service.async_list_calendars()
File "/usr/src/homeassistant/homeassistant/components/google/api.py", line 204, in async_list_calendars
return await self._hass.async_add_executor_job(_list_calendars)
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/google/api.py", line 202, in _list_calendars
return cal_list.list().execute()["items"]
File "/usr/local/lib/python3.9/site-packages/googleapiclient/_helpers.py", line 131, in positional_wrapper
return wrapped(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/googleapiclient/http.py", line 922, in execute
resp, content = _retry_request(
File "/usr/local/lib/python3.9/site-packages/googleapiclient/http.py", line 190, in _retry_request
resp, content = http.request(uri, method, *args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/oauth2client/transport.py", line 186, in new_request
credentials._refresh(orig_request_method)
File "/usr/local/lib/python3.9/site-packages/oauth2client/client.py", line 749, in _refresh
self._do_refresh_request(http)
File "/usr/local/lib/python3.9/site-packages/oauth2client/client.py", line 819, in _do_refresh_request
raise HttpAccessTokenRefreshError(error_msg, status=resp.status)
oauth2client.client.HttpAccessTokenRefreshError: unauthorized_client: Unauthorized
allenporter commented 2 years ago

Can you please file a separate issue since the symptoms are different?

martin131 commented 2 years ago

iCal integration fixed in latest release - https://github.com/tybritten/ical-sensor-homeassistant/releases/tag/1.5.0

mabotze commented 2 years ago

I just confirmed there is no code that references calculate_offset in the latest home assistant. Something is wrong with your update...

Sorry, my bad. I've had the google calendars integration in my custom components and after deleting it everything works fine. Thank you!