Google calendar: Get next event that hasn't been started yet

Hey there,

sometimes I’m missing important business meetings just because I’m focused on solving some issue.
Therefore I’d like to get informed by a speaker announcement about my next event.
Sounds simple. All the notification stuff is piece of cake.
However I’m unable to get the next event in a calendar that hasn’t been started yet.

My sensor definition that should count the time until the next event

sensor:  
  - platform: template
    sensors:
      calendar_next_event:
        friendly_name: Minutes until next event
        value_template: >-
          {% if states.calendar.mycalendar.attributes.start_time %}
            {{((as_timestamp(states.calendar.mycalendar.attributes.start_time) - as_timestamp(now())) / 60) | default(99) | int }}
          {%- else -%}
            0
          {%- endif %}

Is there any way to always access start_time of the next event?states.calendar.mycalendar.attributes.start_time contains the start time of the running event which fails my logic when two events happen back to back as it will never list 5 minutes until next event but always like -35 for an event that is 35 minutes in with 5 to go until next one.

Thanks, Jens

Any hint would be greatly appreciated.

This is something I would also like to know. A simple solution is by my knowledge at this moment in not possible with HA.

I use GitHub - tybritten/ical-sensor-homeassistant: an iCal Sensor for Home Assistant

And it gives me (the way mine is configured) this:
Event 0:
image

Event 1:
image

and so on…
So using eta as a trigger should be what you need.
As far as I recall, as soon as eta is 0 it’s removed.

Apparently I was wrong.
The event stays for the duration of it.

But you could just look at event0 and event1 eta if more than 0 and less than 10, send notification.

I think eta is in days, not minutes.

So the image above where eta is 27000 and 28000, that is in days?

I just installed it yesterday and it’s in days as far as I can tell.