Google Calendar Events Triggering at End And not Beginning

Hello! I’m really stuck here after trying for several days and combing through the forums. I’m trying to turn the lights off (the scene in the yaml does this and works fine when triggered manually) at the beginning of a Google Event but for some reason it triggers at the end instead of the beginning. I’m having trouble understanding why this is the case. Here’s the yaml for the automation:

alias: Calendar - 💤 Sleep
description: ""
trigger:
  - platform: calendar
    event: start
    offset: "-0:0:0"
    entity_id: calendar.xxx_gmail_com
condition:
  - condition: state
    entity_id: calendar.xxx_gmail_com
    attribute: message
    state: 💤 Sleep
    for:
      hours: 0
      minutes: 0
      seconds: 0
action:
  - service: scene.turn_on
    target:
      entity_id: scene.all_off
    metadata: {}
mode: parallel
max: 10

In case it’s important my version of HA is 2023.2.5

I really appreciate any help or suggestions anyone might have. Thank you!

Edit: I forgot to mention that my calendar is back to back events almost all the time (though not all of them are meant to be triggers). I think I read somewhere that that might pose a problem, but I’m having trouble finding the post that said that again so I can try to understand why and maybe come up with a solution.

Perhaps the trigger is firing before the state is updated since these are different mechanisms (e.g. state does not work with offset). Then the state is on for the previous event when the trigger fires for the start of the next event.

Perhaps you can move the state message check to be a condition on the trigger data? See the automation examples in the calendar platform docs that have examples of trigger data. (I’m on mobile)