Preempting HA events

I have an esphome-based controller that interfaces with my garage door open/close circuit to control door state, as well as a reed sensor to report state. The garage door state is in Alarmo as a door. If I accidentally tell HA to open the garage door, Alarmo triggers the alarm. That’s not what I want, since I asked for HA to open the garage door; it’s not a burglar forcing the door open.

Is there a way to preempt HA events like ‘switch.turn_on’ so that I tell Alarmo to turn off the alarm before it’s opened? (This is also important because I also want to retract the garage lock solenoid before processing the garage door open command).

The closest forum topic I could find is Intercepting, Handling an Event but that remains unresolved.

If you’re opening the garage door from a dashboard, one option (though not what you asked for) might be to have an “are you sure” popup, which is a tap action option.

    tap_action:
      action: perform-action
      confirmation:
        text: The router will be offline for about two minutes.
      perform_action: script.restart_router
    entity: script.restart_router