Open awnings after closed do to wind

Hi :wave:
I have a pair of awnings that I control via esphome. I hoked a RF control to my ESP32 and I can trigger the buttons to open/close/stop. On the same ESP32 I have a wind sensor that when wind reaches 13.9km/h the awnings are closed.

I’d like to go a step further and:

  1. open the awnings again, only if they were closed due to the wind automation and if the wind if below a certain Km/h for 1 minute.
  2. Expose a boolean/toggle that I can turn off the automation of the awnings opening, so I can then control it via Home assistant. I’d rather do it this way rather than defining the boolean on HA so I do not rely on HA being on to control this automation. I can just go to the esphome web interface and toggle it.

I tried multiple approaches but none works :frowning: any help?

Here is the code:

sensor:
  - platform: pulse_counter
    name: Wind Sensor
    id: windsensor
    pin:
      number: 15
    update_interval: 1s
    filters:
      - lambda: if (x < 0.001) return x; else return 1.761 / (1 + ((x / 4) * 0.01666666667)) + 3.013 * ((x / 4) * 0.01666666667);
    unit_of_measurement: 'Km/h'
    on_value_range:
      - above: 13.9
      then:
        - switch.turn_on: relay_close

switch:
  - platform: gpio
    pin:
      number: 12
      inverted: false
    id: relay_close
    name: "Close Awning"
    interlock: [relay_stop, relay_open]
    on_turn_on:
    - delay: 5000ms
    - switch.turn_off: relay_close
  - platform: gpio
    pin:
      number: 14
      inverted: false
    id: relay_stop
    interlock: [relay_close, relay_open]
    name: "Stop Awning"
    on_turn_on:
    - delay: 3500ms
    - switch.turn_off: relay_stop
  - platform: gpio
    pin:
      number: 17
      inverted: false
    id: relay_open
    interlock: [relay_close, relay_stop]
    name: "Open Awning"
    on_turn_on:
    - delay: 3500ms
    - switch.turn_off: relay_open

Thank you!