Using Google Calendar Events to Trigger Home Assistant Automations
- Andrea Leandri
- 4 days ago
- 6 min read
Updated: 2 days ago
Skill level: Beginner to Intermediate | Time to complete: 30-45 minutes
What you'll build: A Google Calendar integration in Home Assistant, plus an automation that reacts to a calendar event starting - turning on bedroom plugs and lights only when an event with a specific title begins. The same pattern works for any do something at the start or end of an appointment automation.
The Idea
If you already track your life in Google Calendar, that calendar data can directly drive your smart home. Rather than manually triggering scenes, you can let an event title or time range do it for you.
Common real-world uses: a calendar event titled Movie Night triggers cinema mode, a recurring Work From Home event each morning adjusts heating and lighting, an event ending triggers turning things back off, or a specific event title turns on a particular set of plugs and lights only for that occasion while other calendar events do nothing.
The key building block is the calendar trigger, which fires when an event starts or ends - and gives your automation access to the event's title, so you can filter for specific events rather than reacting to everything on the calendar.
What You'll Need
Home Assistant - any recent version (2024.x or later)
A Google account with Google Calendar - the calendar you want to connect
Google Cloud Console access - to create OAuth credentials, free, takes about 10 minutes
Devices to control - lights, plugs, or anything else HA can already control
Part 1: Set Up the Google Calendar Integration
1.1 Create a Google Cloud project
Go to console.cloud.google.com and sign in with the same Google account as your calendar. Click the project dropdown → New Project. Give it any name, e.g. Home Assistant Calendar. Click Create.
1.2 Enable the Google Calendar API
With your project selected: APIs & Services → Library → search Google Calendar API → Enable.
1.3 Configure the OAuth consent screen
APIs & Services → OAuth consent screen. Choose External (unless you have Google Workspace). Fill in app name, your email as support and developer contact. Under Scopes you do not need to add anything manually. Under Test users, add your own Google account email - required while the app is in testing mode, fine for personal use.
1.4 Create OAuth credentials
APIs & Services → Credentials → Create Credentials → OAuth client ID. Application type: TVs and Limited Input devices (the correct type for HA's device-code flow). Name it, e.g. HA Calendar. Click Create. You'll get a Client ID and Client Secret - copy both.
1.5 Add the integration in Home Assistant
Settings → Devices & Services → Add Integration → search Google Calendar. Paste the Client ID and Client Secret. HA shows you a code and a URL (similar to the GitHub device flow used elsewhere). Go to the URL (usually google.com/device) → enter the code → sign in and approve access. Return to HA - the integration completes automatically.
1.6 Confirm the calendar entity exists
Developer Tools → States → search calendar. You should see an entity like calendar.your_email_gmail_com. If you have multiple calendars under the same account, each one typically gets its own entity.
Part 2: Enable the Purpose-Specific Calendar Triggers
Home Assistant has two ways to trigger on calendar events: the original generic calendar trigger platform, and newer purpose-specific triggers (calendar.event_started, calendar.event_ended) that are clearer to configure and currently in Labs preview.
To use the newer triggers: Settings → System → Labs → enable Purpose-specific triggers and conditions. This unlocks calendar.event_started and calendar.event_ended as selectable trigger types in the automation editor.
Using the older generic syntax instead? It still works fine and does not require Labs. See the Alternative Generic Calendar Trigger Syntax section near the end of this guide.
Part 3: Create the Automation
This example turns on a set of bedroom lights and plugs only when a calendar event with a specific title (e.g. containing XXXXXX) begins.
alias: "Bedroom lights on - specific calendar event"
description: >
Turns on bedroom plugs and lights when a calendar event whose title
contains "XXXXXX" starts.
triggers:
- trigger: calendar.event_started
target:
entity_id:
- calendar.your_email_gmail_com # your Google Calendar entity
options:
offset:
days: 0
hours: 0
minutes: 0
seconds: 0
offset_type: before
conditions:
# Only proceed if the event title matches what we're looking for
- condition: template
value_template: "{{ 'XXXXXX' in trigger.calendar_event.summary }}"
actions:
# Turn on the relevant lights
- action: light.turn_on
target:
entity_id:
- light.YOUR_LIGHT_1 # replace with your light entities
- light.YOUR_LIGHT_2
- light.YOUR_LIGHT_3
- light.YOUR_LIGHT_4
# Turn off any lights that shouldn't be on for this occasion
- action: light.turn_off
target:
entity_id:
- light.YOUR_OTHER_LIGHT_1
- light.YOUR_OTHER_LIGHT_2
mode: queuedmode: queued instead of mode: single - official HA documentation explicitly recommends against single for calendar-triggered automations. If two calendar events happen to start at the same moment, single mode would silently skip the second trigger. queued or parallel ensures every triggered event gets processed properly.
trigger.calendar_event.summary - this is the correct variable name for accessing the event's title text inside a condition or action template. The event title in Google Calendar terminology is called the summary.
Customise It
Match exactly instead of containing:
value_template: "{{ trigger.calendar_event.summary == 'XXXXXX' }}"Case-insensitive match:
value_template: "{{ 'xxxxxx' in trigger.calendar_event.summary | lower }}"Match any of several possible titles:
value_template: >
{{ trigger.calendar_event.summary in ['XXXXXX', 'Movie Night', 'Date Night'] }}To trigger before the event starts rather than exactly at the start, useful for getting lights ready ahead of time:
options:
offset:
minutes: 10
offset_type: beforeIf you want to control smart plugs rather than lights, use the switch domain instead of light.
Add a matching event ended automation
To turn things back off automatically when the event ends, use the same title-matching condition with calendar.event_ended as the trigger and light.turn_off as the action.
Test It
Important: calendars are read every 15 minutes. Home Assistant polls Google Calendar roughly every 15 minutes, not in real time. When testing, create a calendar event starting at least 15-20 minutes in the future - an event starting in 2 minutes may not be picked up before it has already begun, and the trigger will not fire.
Create an event in Google Calendar titled with your exact match text (e.g. XXXXXX Test) starting about 20 minutes from now → wait for the start time → confirm your lights/plugs turn on as expected. Then check Settings → Automations → your automation → Traces to see the actual trigger.calendar_event.summary value received - useful for spotting typos in your title match.
Alternative: Generic Calendar Trigger Syntax
If you would rather not enable the Labs preview feature, the original calendar trigger platform works identically in capability with slightly different YAML:
alias: "Bedroom lights on - specific calendar event (classic syntax)"
triggers:
- trigger: calendar
event: start
entity_id: calendar.your_email_gmail_com
offset: "-00:00:00"
conditions:
- condition: template
value_template: "{{ 'XXXXXX' in trigger.calendar_event.summary }}"
actions:
- action: light.turn_on
target:
entity_id:
- light.YOUR_LIGHT_1
- light.YOUR_LIGHT_2
mode: queuedThe event: field accepts start or end. The offset: field uses HH:MM:SS format with a leading - for before and no sign for after. This syntax has been stable in HA for years and does not require any Labs feature.
Troubleshooting
Trigger never fires: Remember the 15-minute polling interval - test with events starting at least 15-20 minutes ahead.
Trigger fires but condition always fails: Check the Trace for the actual trigger.calendar_event.summary value → confirm capitalisation and spacing match exactly, or switch to a lower comparison.
Calendar entity doesn't appear after setup: Confirm you completed the device authorization flow at google.com/device - if you closed the tab too early, the integration will not finish setting up.
calendar.event_started not available as a trigger type: Confirm Purpose-specific triggers and conditions is enabled under Settings → System → Labs.
Automation only fires for the first of two simultaneous events: Check mode: is set to queued or parallel, not single.
OAuth consent screen shows app not verified warning: Expected for personal projects in testing mode → click Advanced → Go to [app name] (unsafe) to proceed. This is your own app, safe for your own use.
Guide written by a Home Assistant enthusiast in Utrecht. The calendar trigger pattern is one of the most underused tricks in Home Assistant - your existing schedule already knows what's about to happen, you just need to let it talk to the house.



Comments