Christian Schou
  • Home
  • Blog
    • Programming
      • C#
      • PowerShell
      • Python
      • SQL
    • WordPress
      • Tutorials
    • Cloud
    • Home Automation
      • Home Assistant
        • Node-Red
    • Career
  • Services
  • Glossary
  • About
No Result
View All Result
Christian Schou
  • Home
  • Blog
    • Programming
      • C#
      • PowerShell
      • Python
      • SQL
    • WordPress
      • Tutorials
    • Cloud
    • Home Automation
      • Home Assistant
        • Node-Red
    • Career
  • Services
  • Glossary
  • About
No Result
View All Result
Christian Schou
No Result
View All Result
Home Home Automation Home Assistant
google calendar integration, home assistant

How to add Google Calendar integration in Home Assistant – step-by-step guide

by Christian
17. Juni 2022
in Home Assistant
0

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.

Inhaltsverzeichnis
  1. Part #1 – Configure the Google Cloud Platform
    • Create a new GCP project and enable API access
  2. Generate Client ID and Secret
  3. Part #2 – Google Calendar Integration configuration in Home Assistant
    • Add Google to configuration.yaml in Home Assistant
    • Setup Google Calendar Integration
    • Link Google Account
    • Open the Google Calendar Integration in Home Assistant
  4. Summary

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.

new google cloud platform project, gcp
Create a new GCP project

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.

Enable access to API in the Google Cloud Platform

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“.

gcp api credentials
GCP APIs & Services – Credentials

On the next page, you have to select between Internal and External in terms of user type. Here you have to select “External“.

gcp oauth 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:

app information, google cloud p

You can put a trailing slash in the app domain URLs and “invent” some paths for your privacy policy + terms and conditions. They don’t have to be real. Mine are as follows:

  • Application home page: https://your-domain.com/
  • Application privacy policy link: https://your-domain.com/privacy_policy
  • 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.

google calendar integration, gcp scopes
GCP Scopes for Google Calendar

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.

test users' google cloud platform. google calendar integration

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“.

oauth client ID, google cloud platform, google calendar integration
Create OAuth Client ID – Google Cloud Platform

Click Create. You will now get a popup showing you the client id and client secret. Click the button “Download JSON“.

oauth client, google calendar integration
OAuth Client Created – Google Cloud Platform

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.

Add Google Calendars Integration

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:

attach a device, google calendar integration
Attach a device using the code

Click the Next button to select the account you added earlier in the test users section of the consent screen.

select google account

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.

google calendar integration

At the next page you will be asked to allow Home Assistant (name of my GCP application) to allow access to Google Calendar.

allow home assistant access to google calendar, google calendar integration

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.

google calendar integration, calendar overview

There we have it. Full Google Calendar Integration in Home Assistant that we are able to make automation upon. Awesome!

Summary

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!

Tags: GCPGoogle CalendarSmart Home
Previous Post

What is Home Assistant? All-Inclusive Home Automation for FREE!

Next Post

How to implement CQRS using MediatR in an ASP.NET Core Web API (.NET 6)

Christian

Christian

Hello 👋 My name is Christian and I am 26 years old. I'm an educated Software Developer with a primary focus on C#, .NET Core, Python, and PowerShell. Currently, I'm expanding my skills in Software Robots and Cloud Architecture. In some of my spare time, I share my knowledge about tech stuff on my blog.

Related Posts

home assistant
Home Assistant

What is Home Assistant? All-Inclusive Home Automation for FREE!

by Christian
6. Juni 2022
0

Google with Home- and Assistant services, Apple which made HomeKit, and Amazon which created Alexa are all free cloud platforms...

Read more
Next Post
cqrs, mediatr, cqrs design pattern, design pattern

How to implement CQRS using MediatR in an ASP.NET Core Web API (.NET 6)

Schreibe einen Kommentar Antworten abbrechen

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

Christian Schou

Christian Schou

Software Developer

Hello - my name is Christian and I am 26 years old. I'm an educated Software Developer with a primary focus on C#, .NET Core, Python, and PowerShell. Currently, I'm expanding my skills in Software Robots and Cloud Architecture. In some of my spare time, I share my knowledge about tech stuff on my blog.

Recent articles

personal website
Career

Top 6 things to add on your personal website to get hired for a tech job

by Christian
7. August 2022
0

Back in the days before the internet was a thing like it is today, we used to have business cards...

Read more
watchdog

The #1 guide to show real-time .NET 6 logs for Web Apps and APIs in a modern way using WatchDog for Free

13. August 2022
get hired for a tech job

5 tips to help you get hired for a tech job

31. Juli 2022
restful web api

How to build a RESTful Web API using ASP.NET Core and Entity Framework Core (.NET 6)

25. Juli 2022
dynamically register entities

How to Dynamically Register Entities in DbContext by Extending ModelBuilder?

23. Juli 2022

Christian Schou

Software Developer

Hello - my name is Christian and I am 26 years old. I'm an educated Software Developer with a primary focus on C#, .NET Core, Python, and PowerShell. Currently, I'm expanding my skills in Software Robots and Cloud Architecture. In some of my spare time, I share my knowledge about tech stuff on my blog.

Recent articles

personal website

Top 6 things to add on your personal website to get hired for a tech job

7. August 2022
watchdog

The #1 guide to show real-time .NET 6 logs for Web Apps and APIs in a modern way using WatchDog for Free

13. August 2022
get hired for a tech job

5 tips to help you get hired for a tech job

31. Juli 2022
  • de_DEDeutsch
    • da_DKDansk
    • en_USEnglish
    • hi_INहिन्दी
    • pt_BRPortuguês do Brasil
  • Contact
  • Datenschutzrichtlinie
  • Nutzungsbedingungen

© 2022 Christian Schou - All rights reserved.

No Result
View All Result
  • Home
  • Blog
    • Programming
      • C#
      • PowerShell
      • Python
      • SQL
    • WordPress
      • Tutorials
    • Cloud
    • Home Automation
      • Home Assistant
    • Career
  • Services
  • Glossary
  • About

© 2022 Christian Schou - All rights reserved.

I use cookies on my website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
Do not sell my personal information.
Cookie settingsACCEPT
Privacy & Cookies Policy

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these cookies, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may have an effect on your browsing experience.
Necessary
immer aktiv
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
CookieDauerBeschreibung
__gads1 year 24 daysThe __gads cookie, set by Google, is stored under DoubleClick domain and tracks the number of times users see an advert, measures the success of the campaign and calculates its revenue. This cookie can only be read from the domain they are set on and will not track any data while browsing through other sites.
_ga2 yearsThe _ga cookie, installed by Google Analytics, calculates visitor, session and campaign data and also keeps track of site usage for the site's analytics report. The cookie stores information anonymously and assigns a randomly generated number to recognize unique visitors.
_ga_0J2F6JVWSD2 yearsThis cookie is installed by Google Analytics.
_gat_gtag_UA_84232734_11 minuteSet by Google to distinguish users.
_gid1 dayInstalled by Google Analytics, _gid cookie stores information on how visitors use a website, while also creating an analytics report of the website's performance. Some of the data that are collected include the number of visitors, their source, and the pages they visit anonymously.
YouTube2 yearsYouTube sets this cookie via embedded youtube-videos and registers anonymous statistical data. I embed YouTube videos in my articles/tutorials - you won't get the full experience of the articles if this is deactivated.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
CookieDauerBeschreibung
IDE1 year 24 daysGoogle DoubleClick IDE cookies are used to store information about how the user uses the website to present them with relevant ads and according to the user profile.
test_cookie15 minutesThe test_cookie is set by doubleclick.net and is used to determine if the user's browser supports cookies.
VISITOR_INFO1_LIVE5 months 27 daysA cookie set by YouTube to measure bandwidth that determines whether the user gets the new or old player interface.
YSCsessionYSC cookie is set by Youtube and is used to track the views of embedded videos on Youtube pages.
yt-remote-connected-devicesneverYouTube sets this cookie to store the video preferences of the user using embedded YouTube video.
yt-remote-device-idneverYouTube sets this cookie to store the video preferences of the user using embedded YouTube video.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SPEICHERN & AKZEPTIEREN
Unterstützt von CookieYes Logo