In this article, I will teach you how to make a Google Calendar integration in Home Assistant. The integration got a lot of benefits. As an example, you can use the scheduled events inside your calendar to perform automations by integrating with Home Assistant. You could also show the calendar in a Lovelace by using a Calendar Card (an official part of Home Assistant).
I have seen multiple guides on the internet about this topic, so why make a new guide? Well, all the guides I typically find or have read are without screenshots making it harder to understand how to accomplish this task. Most of them contain only technical descriptions on how to configure the Google Cloud Platform and how the configuration for Home Assitant should be made, but not all the necessary steps for someone (like me) who likes a nice and detailed step-by-step guidance now written by tech-people for tech-people.
If you are ready, then let’s get started.
- Part #1 – Configure the Google Cloud Platform
- Generate Client ID and Secret
- Part #2 – Google Calendar Integration configuration in Home Assistant
Part #1 – Configure the Google Cloud Platform
In order for this integration to work, we need to create a new GCP (Google Cloud Platform) Project. In the rest of this article, I will refer to the Google Cloud Platform as GCP. Unfortunately, it is not as easy as signing into Google Calendar from Home Assistant and then everything works out of the box.
Don’t be scared of GCP. I know it looks complex and you got thousands of menus to click around in. I will guide you through the platform and the integration will work, once you have completed all the steps.
Create a new GCP project and enable API access
If you already got a project inside GCP for your Home Assistant instance, you can continue with that project. Else we will create a new project. Click this link: Create a new project in GCP.
When you click the CREATE button, your GCP project will be created and you will be forwarded to a page, where you are asked to “Enable access to API“. This will make a change in your project, that allows access to the API connected between Home Assistant and Google.
Click Next and then Enable.
Generate Client ID and Secret
Now head to the Credentials page. You can follow this link: APIs & Services > Credentials. The first thing we have to do is configure a new consent screen for the project. Click the button “Configure Consent Screen“.
Now we have to edit the app registration. At tab one we will configure the OAuth Consent Screen. I have configured mine as below:
- Application home page: https://your-domain.com/
- Application terms of service link: https://your-domain.com/terms
In the authorized domain, I selected the one I have configured in Google Search Console.
On the next page, we have to select what Scopes we would like to use. Here we will select the Google Calendar API scopes that are non-sensitive like I have done below by clicking on the button “Add or remove scopes” and then search for Google Calendar API in the filter section.
Click Save and Continue and add some test users’ emails. It is important to notice that while the publishing status is set to “Testing”, only test users are able to access the app. Add the email you are planning to retrieve notifications from.
Click Save and Continue and verify that the summary matches what you have entered. When done click on Continue to Dashboard.
Head back to the Credentials section. At the top of the page, you got a button named “Create Credentials“, click that and select “OAuth client ID” from the drop-down menu.
The application type is of type “TVs and Limited Input devices“. You can enter a name you find suitable, for this demo I have chosen “Home Assistant“.
Click Create. You will now get a popup showing you the client id and client secret. Click the button “Download JSON“.
Alright – now we have configured Google Cloud Platform with our project and the API. Let’s move on to configuring Home Assistant.
Part #2 – Google Calendar Integration configuration in Home Assistant
We are almost there! Good job so far our Google Calendar Integration is almost in place. Now we have to configure Home Assistant with our client id and client secret in order for Home Assistant to communicate with Google’s API.
Add Google to configuration.yaml in Home Assistant
For this integration to work, we have to update the configuration.yaml file using either the File Editor plugin from the Official Add-on Store. I will cover in another article how to install and use the File Editor. For demo purposes I will show the full configuration, but please place your client-id and secret in a secrets file and refer to them from the configuration.yaml file.
The only thing you have to add to your configuration.yaml file is:
google: client_id: your-client-id client_secret: your-client-secret
Save your file and restart Home Assistant for the new configuration to be loaded.
Setup Google Calendar Integration
Go to Settings -> Devices & Services, click on + Add Integration and search for Google Calendars.
When you click on it, Home Assistant will generate a new device code.
Link Google Account
In the new popup, you have to copy the device code and click the link to link your Home Assistant to the project we have created in the Google Cloud Platform.
At the page that opens, you have to enter the code you just copied:
Click the Next button to select the account you added earlier in the test users section of the consent screen.
Because our project application at GCP has not been published, we have to confirm that we would like to continue using the application and allow it to access our account details.
At the next page you will be asked to allow Home Assistant (name of my GCP application) to allow access to Google Calendar.
And there we go – Home Assitant has now been paired with Google Calendar.
Close the tab with Google and go back to Home Assistant. You should see a success popup. If it’s not there, just wait a moment for Home Assistant to pick up the authorisation grant from Google.
In the overview of our devices and integrations, we now also have a card showing the Google Calendar integration.
Open the Google Calendar Integration in Home Assistant
So far we have created a new app at the Google Cloud Platform with API access to Google Calendar. We have added a test user (the mail for the calendar we would like to use) and integrated it into Home Assistant.
If you take a look in the left pane of Home Assistant you now got a new menu named Calendar. Click it to see the calendars you got from your Google Calendar Integration.
There we have it. Full Google Calendar Integration in Home Assistant that we are able to make automation upon. Awesome!
In this article you learned how to create a new project at the Google Cloud Platform and enable API access for Google Calendar. We also configured a consent screen for the account that would grant access to a calendar for Home Assistant to read.
In Home Assistant we updated our configuration with our client-id and secret from GCP and added our Google Calendar as a new integration in the device section of Home Assistant making it available in the left pane menu of Home Assistant and automation.
I hope you learned something new from this article. If you got any issues, questions or suggestions, please let me know in the comments below. Happy home tinkering!