Google calendar repeatedly unavailable

Hi, I have an automation in which I use Google calendar events to trigger turning on a thermostat. All is working, except that the Google calendar repeatedly becomes unavailable because it says that it is unable to authenticate because it misses a valid API key. However, it turns out that it authenticates regardless later on anyway, so it is unclear why the authentication fails sometimes. The annoying thing is that whenever an event occurs while the calendar is unavailable, the trigger never occurs (not even when the calendar comes back after it authenticates successfully later on). I have no idea why this problem occurs, whether something is wrong at my end, or whether there is a bug of some sort. Below a screenshot of the intermittent unavailability, and a post of the log that shows the error. Can anybody help me out?

Screenshot of calendar OFF(available)/unavailable:

Log entry (replaced some calendar identifiers with xxxx):

Logger: homeassistant.components.google.calendar

Source: helpers/update_coordinator.py:290

Integration: Google Calendar (documentation, issues)

First occurred: 4 November 2022, 05:18:40 (8 occurrences)

Last logged: 8 November 2022, 22:52:17

Error requesting Vlothuys data: Error connecting to API: Server disconnected

Error requesting Vlothuys data: Error connecting to API: [Errno 32] Broken pipe

Error requesting Vlothuys data: Unable to authenticate with API: 401, message='Unauthorized', url=URL('[https://www.googleapis.com/calendar/v3/calendars/[email protected]/events?maxResults=100&singleEvents=true&orderBy=startTime&fields=kind,nextPageToken,nextSyncToken,items(id,summary,description,location,start,end,transparency,eventType,visibility,attendees,attendeesOmitted)&timeMin=2022-11-08T04:18:12%2B00:00&timeMax=2022-11-08T04:33:13%2B00:00')](https://www.googleapis.com/calendar/v3/calendars/[email protected]/events?maxResults=100&singleEvents=true&orderBy=startTime&fields=kind,nextPageToken,nextSyncToken,items(id,summary,description,location,start,end,transparency,eventType,visibility,attendees,attendeesOmitted)&timeMin=2022-11-08T04:18:12%2B00:00&timeMax=2022-11-08T04:33:13%2B00:00%27))

Error requesting Vlothuys data: Unable to authenticate with API: 401, message='Unauthorized', url=URL('[https://www.googleapis.com/calendar/v3/calendars/[email protected]/events?maxResults=100&singleEvents=true&orderBy=startTime&fields=kind,nextPageToken,nextSyncToken,items(id,summary,description,location,start,end,transparency,eventType,visibility,attendees,attendeesOmitted)&timeMin=2022-11-07T23:36:39%2B00:00&timeMax=2022-11-07T23:51:40%2B00:00')](https://www.googleapis.com/calendar/v3/[email protected]/events?maxResults=100&singleEvents=true&orderBy=startTime&fields=kind,nextPageToken,nextSyncToken,items(id,summary,description,location,start,end,transparency,eventType,visibility,attendees,attendeesOmitted)&timeMin=2022-11-07T23:36:39%2B00:00&timeMax=2022-11-07T23:51:40%2B00:00%27))

Error requesting Vlothuys data: Unable to authenticate with API: 401, message='Unauthorized', url=URL('[https://www.googleapis.com/calendar/v3/calendars/[email protected]/events?maxResults=100&singleEvents=true&orderBy=startTime&fields=kind,nextPageToken,nextSyncToken,items(id,summary,description,location,start,end,transparency,eventType,visibility,attendees,attendeesOmitted)&timeMin=2022-11-08T09:51:41%2B00:00&timeMax=2022-11-08T10:06:42%2B00:00')](https://www.googleapis.com/calendar/v3/calendars/[email protected]/events?maxResults=100&singleEvents=true&orderBy=startTime&fields=kind,nextPageToken,nextSyncToken,items(id,summary,description,location,start,end,transparency,eventType,visibility,attendees,attendeesOmitted)&timeMin=2022-11-08T09:51:41%2B00:00&timeMax=2022-11-08T10:06:42%2B00:00%27))

Hi, this is likely due to a configuration issue. Is it getting logged out every 7 days? Update the oauth consent screen to be Production instead of Testing

Thanks for the quick response! It is already on Production, so that’s not the issue. Also, it is not getting logged out every 7 days, rather it just cannot authenticate sometimes so that it becomes unavailable every once in a while. The frequency of becoming unavailable also increased over the past days, I don’t know why. See screenshots below.

Recent:

Before that this was not (or less) an issue:

OK, definitely not normal for the authentication credentials to not be accepted, and this should happen when the credentials are expired or revoked detail. Does it resolve itself on its own or does it require your intervention?

Hi, sorry, it’s been a few days because I was trying to debug the issue. The calendar unavailable issue seems to have been resolved. I looked around in Google authentication, and it seems that somehow the Google Calendar API had gotten disabled. I have no idea how because I am certain that I had enabled it before, but after I re-enabled it the problem seems to have been resolved. I still have a problem that my all-day events do not trigger an automation, and I thought it was because my calendar sometimes becomes unavailable, but this seems to have a different cause, so I have starte a different topic over that issue here: Start of all-day events in Google calendar do not cause start trigger to fire. Thanks for your help!