Problem with input boolean for garagedoor

Hey!
I’ve automated my garage door with an input boolean to see if it is open or locked.
When it is “on”, the door is locked, and open when “off”. In HA, the garagedoor is operated by a switch, where i can’t tell if it is open or not, therefore i must use the input boolean.

The problem is when the input boolean is toggled when the garage door is still opening. I suspect my SO press the button twice sometimes, making the input boolean value “flip”, so that HA thinks it is locked, while it’s open. That causes the door to open when both leave the house for example.

Can i disable changes to the input boolean while the script runs or something to solve this problem?

This is my configuration for the garage door:

input_boolean:
     garageport:
          name: Garageport
          icon: mdi:garage


automation:
    - id: Garageport
      alias: 'Garageport'
      trigger:
        platform: state
        entity_id: input_boolean.garageport
      action:
       - service: homeassistant.turn_on
         entity_id: script.garagescript

script:
      garagescript:
        alias: garagescript
        sequence:
          - service: switch.turn_on
            entity_id: switch.Garage
          - delay:
              seconds: 18
          - service: switch.turn_off
            entity_id: switch.Garage

Thanks!

Maybe attach a door sensor? I’ve got “up and over” garage doors, and I’ve attached a (Z-Wave) tilt sensor to them.

yeah, i’m thinking about a magnetic sensor, but one would think i can solve the problem with some software too.

Something like while script.garagescript is running, disable input_boolean.garageport.

Can you not just switch the boolean on at the end of the script as a failsafe?

Going through my old thread’s i forgot about to answer people who may wonder about the same thing as me:
I ended up buying a door sensor, and used the cover component, which works great, except when the temperature drops to under -15C. Also, i can use the orginal remote, as the door sensor validates the state of the door.