Google Calendar - Automation - trigger.calendar_event.summary

Ey up
I’m trying to create an automation that triggers 2 hours before my Google calendar “Working From Home” or “Working from xxxx” event. Would anyone be able to provide any assistance? Here’s what I’ve got so far:

Triggers

Conditions

The concept you need to use here is a condition on trigger data, not a condition based on state.

Look at the light example here which has a template condition based on the name of the event:

The automation in your example is using entity state condition which is a different concept.

Thanks @allenporter for this example. I am still struggling with understanding the concepts (and configuration) of Templates and configuration.yaml. This example gets close to do what I am looking for, which is an action starting at Sunset before the calendar event. I read your posts with great attention.

Am I right in assuming that a calendar event starts at midnight ? In other words, if I set the automation at - 6:00:00, the action will start at 6 pm the day before ?

The calendar trigger is looking at the stream of events on the calendar, so not a fixed time. That is an offset relative to the start or end of the event. So if you have an event at Noon and an offset of -6:00:00 then it runs at 6am.

I realize now that your Google Calendar integration also works with events at specific times. I am used to the Holidays Google nodeserver (integration) of ISY/Polisy which only works with all day events. On the other hand however that nodeserver has 2 nodes for each calendar (Today and Tomorrow).
But using the Google Calendar integration and using the Calendar rather than a specific time-event, am I right about thinking that it starts at midnight ?

Yes, any all day event (in Google calendar or any calendar integration) would start at midnight.

1 Like

Thanks. I don’t want to be annoying, but is there any possibility for you to add a Tomorrow trigger/condition as part of the Google Calendar integration. I know that you have explained how to do this with either/or a Template or in configuration.yaml, but, as mentioned before, I am really struggling with understanding both.

Hi, no, that’s what the offset is for.

1 Like

So…

alias: Google Calendar Wake-up
description: ''
trigger:
  - platform: calendar
    event: start
    offset: '-2:0:0'
    entity_id: calendar.will
condition:
  - condition: template
    value_template: "{{ 'work' in trigger.calendar_event.summary }}"
action:
  - service: switch.turn_on
    data: {}
    target:
      entity_id: switch.virtual_wake_up
mode: single

???