Google Calendar Template trigger with all-day events

I am trying to make an automation that triggers 1hr before any google calendar events that happen. My current code is here:

alias: Early morning - calendar
description: ''
trigger:
  - platform: template
    value_template: >-
      {{ as_timestamp(states.calendar.my_calendar.attributes.start_time) -
      as_timestamp( now() ) < 3600  }}
condition:
  - condition: time
    after: '04:00:00'
    before: input_datetime.normal_morning_wakeup_time
action:
  - service: script.do_morning_things
    data: {}
mode: single

This never triggers if there’s also an all-day event on that day- because the calendar is “on” and there’s not that transition from “off” to “on”. How can I make my template trigger work for this case?

did you fix this `? and how

You can use calendar triggers to do this: Calendar - Home Assistant which fixes all the caveats and issues of trying to use a binary sensor (overlapping events, two events with the same start time, etc all work)

1 Like

thanks i’ll try it–

Oh yeah? Tell me more

1 Like

sorry to fast

seems to work