Need Help Have two modbus humidity sensors running same buzzer script on value range, have a button on press disbling the buzzer for 15 minutes running script but if sensor value changes it bypasses the mute how to compile code?

Need Help Have two Modbus surface humidity sensors running same buzzer script on value range, have a button on press disabling the buzzer for 15 minutes running on script but if sensor value changes it bypasses the mute and continues to go off, I want to be able to press the button and mute the buzzer and ignore sensore value changes but still be able to use the button because i have a double press to restart the esp32 . if anyone can help or point me in right direction?

 esphome:
  name: esp32 
  friendly_name: esp32
  on_boot:  
      priority: 500
      then:
        - delay: 500ms
        - lambda: |-
            id(modbus_value).publish_state(0.0);
            id(modbus_value2).publish_state(0.0);
                
    #################################################### 
 esp32:
  board: esp32-s3-devkitc-1
  cpu_frequency: 160MHZ
  framework:
    type: esp-idf

 globals:
  - id: buzzer_locked_out
    type: bool
    initial_value: "false"

  - id: last_sensor_1_value
    type: float
    restore_value: true
    initial_value: "0.0"
  - id: last_sensor_2_value
    type: float
    restore_value: true
    initial_value: "0.0"


    

# Enable logging
 logger: 
  
 #Enable Home Assistant API
 api:
  reboot_timeout: 0s 
  encryption:
   key: "rtliFhRg9XMooTHhaMqI9BQNx042QjbcAQ1Gvi9L5zU="

 ota:
  - platform: esphome
    password: "028d130b722b21e478343843e0b70972"

 #wifi:
  
 # ssid: SkyNet831
 # password: recon831
 # power_save_mode: none

 #time:
  #- platform: sntp
 #   id: sntp_time
  #  timezone: US/Pacific
  #  servers:
   #   - 0.pool.ntp.org
   #   - 1.pool.ntp.org
   #   - 2.pool.ntp.org
       
          
 ethernet:
  setup_priority: 250
  type: W5500
  clk_pin: GPIO13
  mosi_pin: GPIO11
  miso_pin: GPIO12
  cs_pin: GPIO14
  interrupt_pin: GPIO10
  reset_pin: GPIO9



 script:
  - id: buzzer
    mode: queued   
    then:
      - rtttl.play:              "two_short:d=4,o=5,b=100:16e6,16e6,16e6,16e6"                                   ##"Death March:d=6,o=5,b=100,b=100:4c,16p,c,8c,32p,2c,d#,8d,32p,d,8c,32p,c,8b4,32p,2c"                        #"SOS:d=8,o=5,b=100:8c,8c,8c,4p,4c,4c,4c,4p,8c,8c,8c"
      - delay: 500ms    
  - id: buzzersiren
    mode: queued
    then:
      - rtttl.play:  "two_short:d=9,o=1,b=70:16e6,16e6"  #     "siren:d=6,o=9,b=150:d,e,d,e,d,e,d,e"
      - delay: 2000ms
      - script.execute: buzzersiren

  - id: mute_buzzer
    mode: Restart # Restart the script (and the timer) if the button is pressed again
    then:
      # Step 1: Turn off the buzzer.
      
      - script.stop: buzzersiren
      - switch.turn_off: buzzer_output0  
      # Step 2: Log the mute event for confirmation.
      - logger.log: "Buzzer muted for 15 minutes"
      # Step 3: Wait for 15 minutes.
      - delay: 15min    
      # Step 4: After the delay, log that the buzzer is unmuted and turn it back on.
      - logger.log: "Buzzer unmuted"
      - switch.turn_on: buzzer_output0

  - id: lightleds
    mode: restart
    then:
      # dot-dot-dot
      - light.turn_on:  my_red_led_output
      - delay: 400ms
      - light.turn_off: my_red_led_output
      - delay: 400ms
      - light.turn_on:  my_red_led_output
      - delay: 400ms
      - light.turn_off: my_red_led_output
      - delay: 400ms
      - light.turn_on:  my_red_led_output
      - delay: 400ms
      - light.turn_off: my_red_led_output
      - delay: 400ms
      # dash-das-dash
      - light.turn_on:  my_red_led_output
      - delay: 800ms
      - light.turn_off: my_red_led_output
      - delay: 400ms
      - light.turn_on:  my_red_led_output
      - delay: 600ms
      - light.turn_off: my_red_led_output
      - delay: 400ms
      - light.turn_on:  my_red_led_output
      - delay: 600ms
      - light.turn_off: my_red_led_output
      - delay: 400ms
      # dot-dot-dot
      - light.turn_on:  my_red_led_output
      - delay: 400ms
      - light.turn_off: my_red_led_output
      - delay: 400ms
      - light.turn_on:  my_red_led_output
      - delay: 400ms
      - light.turn_off: my_red_led_output
      - delay: 400ms
      - light.turn_on:  my_red_led_output
      - delay: 400ms
      - light.turn_on: my_red_led_output
      - delay: 400ms
      - light.turn_off: my_red_led_output
      - delay: 400ms
      - script.execute: lightleds
###############################################################
 output:
 - platform: ledc
   id: GPIO_36
   pin: GPIO36
   max_power: 1.0
   #frequency: 35Hz

 - platform: ledc  # Or esp8266_pwm for ESP8266
   pin: GPIO37  # Replace with your ESP32's GPIO pin
   id: rtttl_out
   frequency: 1500Hz # Set a base frequency
   

 - platform: ledc
   id: GPIO_35
   pin: GPIO35
   max_power: 1.0
   #frequency: 30Hz
################################################################
 rtttl:
   output: rtttl_out
   id: rtttl_out1
   on_finished_playback:
     - logger.log: "Song ended!"
   gain: 80.0%
 ################################################################  
 switch:
  - platform: template        
    name: buzzer_output
    #restore_mode: DISABLED
    setup_priority: 500
    id: buzzer_output0
    #output: buzzer_output
    turn_on_action:
      - rtttl.play: "two_short:d=9,o=1,b=70:16e6,16e6"
    turn_off_action:
      - rtttl.stop:

  - platform: restart 
    name: "My Device Restart"
    id: my_device_restart
    # This switch will be exposed to Home Assistant
    # To restart, you can simply toggle the switch in HA

  - platform: gpio
    name: cooling fan
    pin: GPIO15
    id: fan  
    on_turn_on:
      - delay: 2000ms
    on_turn_off: 
      - delay: 1000ms

  - platform: template
    name: "OLED Display"
    setup_priority: 400
    id: oledswitch
    #restore_mode: ALWAYS_ON
    # Use lambda to call the turn_on() and turn_off() methods on your display ID
    turn_on_action:
      - lambda: |-
          id(mydisplay).turn_on();
    turn_off_action:
      - delay: 15s
      - lambda: |-
          id(mydisplay).turn_off();
#######################################################################  
 light:
 - platform: monochromatic
   output: GPIO_36
   name: blue_led
   id: blue_led
   #restore_mode: ALWAYS_ON

 - platform: monochromatic
   id: my_red_led_output
   name: red_led
   output: GPIO_35
   effects: 
    - flicker: 
        name: redflick
        alpha: 100%
        intensity: 50%
        
        
  # restore_mode: ALWAYS_ON
###########################################################
#rs485-ttl
 uart:
   id: uart_sensor
   tx_pin: GPIO43
   rx_pin: GPIO44
   baud_rate: 9600
   stop_bits: 1
   data_bits: 8
   parity: NONE
     
 modbus:
 - uart_id : uart_sensor
   id: modbus1
   #flow_control_pin: GPIO3
   send_wait_time: 2000ms
   
 modbus_controller:
 - id: modbus_uartsensor1
   address: 0x01
   modbus_id: modbus1
   setup_priority: 600
   update_interval: 1s
   allow_duplicate_commands: True
   offline_skip_updates: 5 
   command_throttle: 100ms

 - id: modbus_uartsensor2
   address: 0x02
   modbus_id: modbus1   
   setup_priority: 600
   update_interval: 2s
   allow_duplicate_commands: True
   offline_skip_updates: 1
   
   command_throttle: 2000ms  
########################################
 i2c:
  sda: GPIO47 
  scl: GPIO48 
  frequency: 800kHz
#########################################
 font:
  - file: "gfonts://Roboto"
    id: my_font1
    size: 10

  - file: "gfonts://Roboto"
    id: my_font3
    size: 10 
  - file: "gfonts://Roboto"
    id: my_font2
    size: 18

  - file: "gfonts://Roboto" # Use your font filename
    id: my_font4
    size: 10
    glyphs:
      - "0123456789.:"
      - "°F"
  
##########################################
 display:
  - platform: ssd1306_i2c
    setup_priority: 800
    model: "SSD1306 128x64"
    id: mydisplay
    contrast: 40%
    address: 0x3C
    lambda: |-
      it.printf(0, 5, id(my_font1), TextAlign::TOP_LEFT, " ___________________________________");
      it.printf(51, 0, id(my_font1), TextAlign::TOP_LEFT, "MIRA");
      it.printf(100, 45, id(my_font2), TextAlign::TOP_LEFT, "");
      it.printf(13, 45, id(my_font2), TextAlign::TOP_LEFT, "");
      it.printf(125, 27, id(my_font2), TextAlign::TOP_RIGHT , "%.1f%", id(modbus_value).state);
      it.printf(45, 27, id(my_font2), TextAlign::TOP_RIGHT , "%.1f%", id(modbus_value2).state);
      it.printf(53, 60, id(my_font3), TextAlign::BASELINE_LEFT, "%.1f%%", id(sht4xRH).state);
      it.printf(53, 51, id(my_font3), TextAlign::BASELINE_LEFT, "%.1f°F", id(sht4xtemperature).state);
      it.printf(95, 15, id(my_font3), TextAlign::TOP_LEFT, "FORK");
      it.printf(8, 15, id(my_font3), TextAlign::TOP_LEFT, "FLOOR");   
      it.printf(3, 59, id(my_font4), TextAlign::BASELINE_LEFT ,"%.1f°F", id(my_internal_temp).state);  

###########################################
 sensor:
  - platform: modbus_controller
    modbus_controller_id: modbus_uartsensor1
    address: 0x20
    id: modbus_value
    name: forkSensor
    register_type: holding
    register_count: 1
    icon: "mdi:water-percent"                                                                                                                                
    device_class: "moisture"
    unit_of_measurement: "%"
    skip_updates: 1
    #value_type: FP32
    value_type: U_WORD
    accuracy_decimals: 0    
    filters:
      - lambda: return x * 0.3;
    on_value_range:
      - below: 5
        then:
           - switch.turn_off: oledswitch
           - rtttl.stop:
           - script.stop: lightleds
           #- switch.turn_off: buzzer_output0
           - light.turn_off: my_red_led_output
           - light.turn_off: blue_led    
      - above: 60         
        then:
           - rtttl.play: "two_short:d=4,o=5,b=100:16e6,16e6,16e6,16e6" 
           - light.turn_on: blue_led    
      - below: 60  
        then: 
          # - switch.turn_on: oledswitch
           #- script.execute: buzzersiren
           - light.turn_off: blue_led
          # - script.stop: buzzersiren       
      - above: 5
        below: 100
        then:
           - script.execute: lightleds
           #- switch.turn_on: buzzer_output0
           - rtttl.play:  "two_short:d=4,o=5,b=100:16e6,16e6,16e6,16e6" 
           #- switch.turn_on: oledswitch
      - above: 5
        below: 300
        then: 
           - switch.turn_on: oledswitch


  - platform: modbus_controller
    modbus_controller_id: modbus_uartsensor2
    address: 0x20
    id: modbus_value2
    name: FloorRH_sensor    
    skip_updates: 1
    register_count: 1
    register_type: holding
    icon: "mdi:water-percent"
    device_class: "moisture"
    unit_of_measurement: "%"
    value_type:  U_WORD
    
    accuracy_decimals: 0
    filters:
      - lambda: return x * 0.3;
    on_value_range:
      - below: 5
        then:
           - switch.turn_off: oledswitch
           - rtttl.stop:
           - script.stop: lightleds
           #- switch.turn_off: buzzer_output0
           - light.turn_off: my_red_led_output
           - light.turn_off: blue_led    
      - above: 60         
        then:
           - rtttl.play: "two_short:d=4,o=5,b=100:16e6,16e6,16e6,16e6" 
           - light.turn_on: blue_led    
      - below: 60  
        then: 
          # - switch.turn_on: oledswitch
           #- script.execute: buzzersiren
           - light.turn_off: blue_led
          # - script.stop: buzzersiren       
      - above: 5
        below: 100
        then:
           - script.execute: lightleds
           #- switch.turn_on: buzzer_output0
           - rtttl.play:  "two_short:d=4,o=5,b=100:16e6,16e6,16e6,16e6" 
           #- switch.turn_on: oledswitch
      - above: 5
        below: 300
        then: 
           - switch.turn_on: oledswitch




  - platform: sht4x
    setup_priority: 600
    update_interval: 1s
    temperature:
     name: "Temperature"
     id: sht4xtemperature
     filters:
      - lambda: return x * (9.0/5.0) + 32.0;
     unit_of_measurement: "°F"    
     on_value_range:
      - above: 89.0
        then:        
          - switch.turn_on: fan 
      - below: 84.90
        then:
          - switch.turn_off: fan
    humidity:
     name: "Humidity" 
     id: sht4xRH    
     on_value_range:
      - above: 95
        then:
           - switch.turn_on: fan
      - below: 85
        then:
          - switch.turn_off: fan

  - platform: internal_temperature
    id: my_internal_temp
    name: "Internal Temperature"
    unit_of_measurement: "°F" 
    update_interval: 1s   
    internal: False # Prevents the sensor from being published to Home Assistant
    filters:
     - lambda: return x * (9.0/5.0) + 32.0;
    on_value_range:
      - above: 150
        then:        
          - switch.turn_on: fan 
      - below: 130
        then:
          - switch.turn_off: fan

 ##########################################################         
 binary_sensor:
  - platform: gpio
    setup_priority: 800
    pin:
      number: GPIO3
      mode: INPUT_PULLUP
      inverted: true    
    name: Disable Button
    on_press:
      then:       
      - script.execute: mute_buzzer
    on_double_click:
     min_length: 50ms
     max_length: 350ms
     then:
       - script.execute: buzzer
       - delay: 3s
       - switch.turn_on: my_device_restart
    on_multi_click:
    - timing:
        - ON for 1s to 2s
        - OFF for at least 0.5s
      then:
        - switch.turn_on: oledswitch
        - delay: 1min
        - switch.turn_off: oledswitch

        

       


      
     
         

Never tried conditions?

You can also record when it is turned off manually in a helper, and any logic you have that turns it back on, add an if statement to check that helper value such that it will not turn back on unless the time you have saved in the helper is more than 15 minutes ago. I do this kind of logic a large number of places for a variety of reasons. You can even have that 15 minutes stored in a helper and then shown as a sllider in your dashboard so the 15 minutes is not hard coded, but adjustable on the fly.