Help with automation to send an alert based on Google calendar event?

I am trying to configure my Google calendar integration to send me an alert ( a push notification) on event start (or ideally, one hour before).

Anyone that have an working automation could kindly share the yaml?

Thank you.

google:
  client_id: !secret google_client_id_calendar
  client_secret: !secret google_client_secret_calendar
  track_new_calendar: true
  calendar_access: read_write

above needed to bring in any of your calendar



platform: template
sensors:
  my_event_offset:
    friendly_name: "My Event offset"
    value_template: >
      {% if as_timestamp(states.calendar.sling_shifts.attributes.start_time) - as_timestamp( strptime(states.sensor.date_time.state, "%Y-%m-%d, %H:%M" ) ) < 70000 %}on{% else %}off{% endif %}


This is what i followed for creating my sensors i needed 3 my job uses sling to schedule shifts amd you can import this calendar into sling. basically this compares current time with an offset in seconds once a minute so i needed 3 essentially go to bed, getup and clock in. e.g clock in is 5 minutes before the shift start time and is 300 seconds although it will be about 240 seconds when it fires (HA only checks once a minute)

So when my sensors become true , i use it in an automation to fire of a notification e.g the 10 hour one says " time for bed" the wake up one is similar but also plays some music. I also used a helper (“input_number.slingoffset”) this was used to create an offset in the UI that i could configure in the ui normally i like 2 hours before my shift to wake up (7200 secs) but maybe an hour (3600) will do. i might change the value to snooze the alarm and make it trigger again.

The 3 sensors i use remain true till the end of the event (my shift) and then it looks for the next shift and starts a fresh comparison. I have a rolling shift pattern and if i’m working a weekend i will have different days off in the week and 6 possible start times usually. So this doesn’t fire when I am off. it sometimes takes a while before the google calendar gets updated. E.g i did a shift swap and i don’t know when sling sent the new schedule.

I don’t have to do anything now, someone else sets the schedule for the entire team. in the sidebar i have my calendars so i can easily see my upcoming shifts and if someone wants a shift covering i can see if it’s feasible for me to cover it. So i don’t do something crazy like take an extra shift 4 hours after my scheduled shift.

of course this works for ne because every event is a notifiable event but as long as you are creating a calendar. e.g if you have a kid called jamie you could set up a calendar for say jamie after school sports.

The calendar automation will send you data with the contents of the event if you want to do further filtering or logic.