Trigger if calender will be on between XX:XX and YY:YY the next day?

I know calendar entities (like calendar.my_calendar) is “on” when there is an event occurring and “off” when there is no event occurring.
Based on this there is easy to do something when the state changes.
but I nee something more advance this time.

I want a flow to check if a calendar will change state to “on” between 08:00 and 10:00 the day after.
If it is, I want it to do one thing, if not another thing.

How can I accomplish this?

Does your calendar give you this information?
Some integrations doesn’t give the information about what is ahead but only now in the entity.

Well, he entity has some attributes.

message: A vakt
all_day: false
start_time: 2021-12-21 15:00:00
end_time: 2021-12-21 22:15:00
location: workplace
offset_reached: false
friendly_name: turnus

however this is just next event, even if it isn’t next day.
but the home-assistant must store the rest, because calendars can see multiple events.

If you only get one event then you can only do that much. If you have one event at 7:55 tomorrow and also the 8 -10 event then the automation will fail with the integration you are using.
The integration I use gives me n entities of data, but that is for office 365.

You can obviously use this but it won’t work all the time.

I am using the Google Calendar integration.

Yes, and many have the same problem with that integration.

In Node red use the time node since it can handle entities states or attributes and trigger on an offset:

This will only work when it will be on at the time in the future.
There is nothing here that will trigger if there is nothing between 8 and 10

You could trigger the automation xx seconds before an event
I’m using it to start the car heater 15 minutes before my shift ends at work.

{{ ((as_timestamp(states.calendar.YOUR_CALENDAR.attributes.end_time) – as_timestamp(now())) < 900) }}

You can see the entire example here: Automate car functions – Our smart home

Or if you use “time” as the trigger, and check every day let’s say at 10:00 - then you could find out if there is a calendar event in the next X-seconds in the future…
Here is an example for this: