Add Google Calendar to Home Assistant

by Danny
8 comments

READING TIME: 5 MINUTES

In this guide, I will show you how to integrate your Google Calendar into Home Assistant in 2021. Once this integration is all setup, you will be able to create some really cool automations and Lovelace cards. A few example automations might be “Turn on light 5 minutes before a meeting starts”, or, you could import your favorites sports team calendar and display it in a Lovelace card.

For this guide, we are referencing the official Home Assistant documentation. I’m just expanding on it to my this more of a step by step guide.

Let’s get started!

Here’s a guide to create automations based on your Google calendar events.


Generate Client ID and Client Secret

Go to the Google Developers Console.

Choose “Create a Project” in the dropdown and check the 3 boxes for accepting the terms of service. Then click Agree and Continue.

Next, click Go to Credentials.

Step 1: Credential Type

choose Google Calendar API and select the User data radial.

Click Next.

Step 2: OAuth Consent Screen

Give your app a name like HA_CALENDAR. Add your email address to the user support email and developer contact information fields.

Then click Save and Continue.

Step 3: Scopes

Leave everything here with default values. Then click Save and Continue.

Step 4: OAuth Client ID

Choose TV and Limited Input devices. Name it the same as Step 2 (HA_CALENDAR).

Then click Create.

You will now see your Client ID. Your Client Secret can be found by clicking the Download button.

Store both of these in a secure location.


OAuth Consent Screen

Next, click the tab for “OAuth consent screen”

Under Test Users, click Add Users

Enter your email address again and click Save.


Add Google section to Configuration.yaml

To integrate Google Calendar with Home Assistant, the next step is to add this block of text to your Home Assistant configuration.yaml file.

Open your Home Assistant URL. Go to File Editor and click the folder at the top. Browse to configuration.yaml.

Paste in this code:

# Example configuration.yaml entry
google:
  client_id: YOUR_CLIENT_ID
  client_secret: YOUR_CLIENT_SECRET

Replace YOUR_CLIENT_ID and YOUR_CLIENT_SECRET with the client ID and Client Secret you just created. Both can be found in the the downloaded file.

The save the file in the top right corner.


Check Configuration and Restart Home Assistant

Go to Configuration > Server Controls.

Click Check Configuration. If it shows that your configuration is valid, you can now restart Home Assistant.

After HA restarts, click your notification icon.

Copy the code and then click the URL.

Paste the code in the “Enter Code” screen and click Next.

After clicking next, choose the Google account you set this up under:

You may see a screen that says “Google hasn’t verified this app”. Just click Continue here.

It will ask if you want HA_CALENDAR to access your Google Account. Click Allow.

If everything was successful, you will see a Success! Device connected screen that looks like this:

Navigate back to Home Assistant

You can now dismiss the Google Calendar setup under notifications.

At this step, you will now see a “Calendar” option on your sidebar. This means your Google Calendar has successfully been added to Home Assistant!

Click Calendar and see if all of your calendar events show up correctly.

To verify your calendar events are syncing up correctly, go to https://google.com/calendar and create a new “test event”. Then, come back to Home Assistant to confirm it shows up.

Wrapping Up

Congratulations! You have now successfully configured your personal calendar into Home Assistant. Like I said earlier, having your calendar with HA will allow you to create some really cool automations. I won’t be going over those in this guide, but I will add links to the bottom of this post over the next couple weeks with some automations I plan on adding.

I would like to point out that you aren’t able to create events from HA and add them to your Google Calendar quite yet, but I will show you how to do that in a future post.

Hope you found this tutorial useful! It should be very up to date, as I created this guide in May 2021.


Smart Home Product Finder

What hub do you currently use?


SmartThings

Home Assistant

Hubitat

Step 1 of 3

What product are you looking to add?


Lights

Locks

Thermostats

Cameras

Garage Door Opener

Switches

Sensors

Motion, Door & Window, Leak

Smart Plugs

Buttons

Step 2 of 3

What protocol?


Z-Wave

Zigbee

Wifi

Step 3 of 3

Retake quiz? Click here!

My Favorite Home Assistant Devices

Below are some of the Home Assistant-compatible devices I personally use in my home. I highly recommend each of them.

The full list of all Home Assistant compatible & recommended devices I use can be found on my Equipment List page.

8 comments

You may also like

8 comments

Alec October 11, 2021 - 5:02 pm

Hi – I was wondering how you interact with these calendar events? I have my google calendar pulled in, but I’m not sure how I can incorporate them into automations.

Reply
Danny October 11, 2021 - 5:12 pm

Hey Alec, yes you can! Here’s a guide I wrote that will send an alert 1 hour before a football game event on my Google Calendar starts: https://smarthomepursuits.com/how-to-setup-google-calendar-event-notifications/

Reply
Christoph October 15, 2021 - 4:29 am

Hi,
Do you know, if it is possible to integrate different calendars based on the userlogin?
For example: I am having my own User in HomeAssistant – and my Wife has another one.

I would like to integrate her google Calendar only for her HA User – as well as my own Google Calendar only for my own user.
I don’t want to have all calendars with private appointments and so on visible for all users…

Is there a way how this can be done?

Thanks and with best regards,
Chris

Reply
Danny October 16, 2021 - 1:38 pm

Unfortunately I don’t know of a way to add multiple Google Calendars into HA and make the events viewable by specific users. I’m not even sure if that’s possible to do.

Reply
atv October 18, 2021 - 3:33 pm

I followed your guide and all is well. Then i added a new calendar to my calendar.google.com specifically for home assistant events, so as not to clutter things.

But that one doesn’t seem to show up..i even set it to public like my main calendar.

Any suggestions? Maybe redo from the beginning.

Anyway, thanks!

Reply
Danny October 18, 2021 - 4:10 pm

Adding new calendars usually requires a HA reboot.

Reply
atv October 19, 2021 - 3:51 am

Thanks Danny, would that just a home assistant server reboot, or shutdown the whole VM and restart ?
Also, are the calendars supposed to be public or can they be private?

Reply
atv October 19, 2021 - 3:53 am

Nm, a home assistant server (service) reboot did the trick. Thanks!

Reply

Leave a Comment