Script state as a condition allowed?

I’m trying to create an automation task that does the following:

  1. When door open is detected, do something (call script in my case)
  2. For next time don’t call the script again until at least 2minutes have passed.

I was setting up this automation by using the condition that the script is in the “off” state for 2minutes. Something like the code below:

automation:
  - alias: 'mudroom garage open'
    trigger:
      platform: state
      entity_id: binary_sensor.everspring_unknown_type0002_id0002_sensor_6
      to: 'on'
    condition:
      platform: state
      entity_id: script.mudroom_garage_opened
      state: 'off'
      for:
        hours: 0
        minutes: 0
        seconds: 10
    action:
      service: script.turn_on
      entity_id: script.mudroom_garage_opened

I had set 10 seconds for debug purposes. When I tried it out, it didn’t look like the 10 seconds was being followed and the script was always being run. I also noticed that the script object in the front end didn’t show me the duration that it’s on or off like the sensors do.

Should I assume script states can’t be used in the condition? If so, anybody have suggestion on how I can implement the behaviour above?

Thanks,
James

You could try using an input_boolean as a flag. When you open the garage, set the boolean to on and set a 2nd script to turn it off after 2 minutes, then check it in the original automation rule and only fire if it is off. There is an example that shows you how to do the scripting for a light - you just need to adapt it to work with the input_boolean instead of a light.

Thanks for the suggestion. Yes I was following that example and was using the script as the flag instead. I will give it a try sometime. For now, I’ve handled it in an external script.