Automation using HA calendar if no event as criteria

I am using the local HA calendar integration to trigger multiple automations but I am trying to include this criteria along with other criteria to run an automation if no event is currently scheduled. I don’t want to use the end of the event as there may be an event that follows. I looked at the schedule but this will not work as the HA calendar is dynamic and getting updated frequently throughout the day as appointments are scheduled.

Am I missing a simple solution?

trigger on the end of events then immeidately call calendar.get_events with the current time to see if there’s anything scheduled.

Makes sense. I am new to HA, and not sure exactly how to I do that in the automation visual editor? Still learning the YAML, here is my current config without the get_event:

alias: Bay 1 - Lights On
description: Turn on lights upon entry - no sim
trigger:
  - platform: calendar
    event: end
    offset: "0:0:0"
    entity_id: calendar.bay_1_schedule
  - type: occupied
    platform: device
    device_id: 6b8430f55d942e45f18b80fe
    entity_id: 79e3e526af6d7e5b5e0ab2dd
    domain: binary_sensor
condition: []
action:

avoid device id’s:

this has an example on how to use get_events… you can do it via the ui. you don’t need to write yaml to call the get_event.

then to see how many events are returned you’d have someting like
`{{ agenda[‘name_of_your_calendar’.events | count() }}

but build your automation as far as you can then post it here and we’ll help.

Thanks for the info, I will work on converting to Entity IDs and repost.

whoops. i’m sorry i forgot to add the link to the page thath as the calendar.get_events sample: