Menu Widget auto control

HI Blynkers hope all is well,
This idee for the code below are to turn on a relay when the Dallastemp prob reaches a specific temperature but are only allow when the DHT11 temp are at a set point and also humidity, my code are still not complete but the issue that I am having are that I am using menu widget to select if the realy should be ON,OFF or AUTO now for auto I need the relay to turn on or off using if statements for the above mentioned

[...]
#define BLYNK_TEMPLATE_ID ""
#define BLYNK_DEVICE_NAME ""
#define BLYNK_AUTH_TOKEN ""

#include <OneWire.h>
#include <DallasTemperature.h>
#define BLYNK_PRINT Serial
#include <SimpleTimer.h>
#include <Ethernet.h>
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#include <DHT.h>


char auth[] = BLYNK_AUTH_TOKEN;
char ssid[] = "";
char pass[] = "";

int button_pin = 21;
int ext_led = 18;
#define DHTPIN 32          
#define DHTTYPE DHT11     

#define ONE_WIRE_BUS 13

int Relay_pin = 4;

WidgetLED led1(V6);
#define BLYNK_GREEN     "#23C48E"
#define BLYNK_RED       "#D3435C"


OneWire oneWire(ONE_WIRE_BUS);


DallasTemperature sensors(&oneWire);
float temp;
DHT dht(DHTPIN, DHTTYPE);
BlynkTimer timer;


 BLYNK_CONNECTED()
 {Blynk.syncVirtual(V1);
 }
  BLYNK_WRITE(V1) {
  switch (param.asInt())
  {
    case 0: 
            
              digitalWrite(Relay_pin, LOW); // turn on relay 1
              
              Serial.println("ON");
              
            
             delay(100);
      break;
      case 1: 
             
              digitalWrite(Relay_pin, HIGH); // turn off relay 1
              
              Serial.println("OFF");
             
            
             delay(100);
      break;
      case 2:
      // relay auto
Serial.println("AUTO"); 

if(sensors.getTempCByIndex(0)>= 30 )
    {
    digitalWrite(Relay_pin, LOW); 

if(sensors.getTempCByIndex(0)<= 25 )
{
  digitalWrite(Relay_pin,HIGH);
}
  else
  {
    digitalWrite(Relay_pin, HIGH);
   delay(100);
  }
      break;
      default : break;
    }
  }
  }
  
  
  void sendSensor()
{

  float h = dht.readHumidity();
  float t = dht.readTemperature(); // or dht.readTemperature(true) for Fahrenheit

  if (isnan(h) || isnan(t)) {
    Serial.println("Failed to read from DHT sensor!");
    return;
  }

  Blynk.virtualWrite(V4, h);
  Blynk.virtualWrite(V5, t);

  // Request temperature to all devices on the data line
  sensors.requestTemperatures(); 
  
  Serial.print("Celsius temperature: ");
 
  Serial.print(sensors.getTempCByIndex(0)); 
  Serial.print(" - Fahrenheit temperature: ");
  Serial.println(sensors.getTempFByIndex(0));
  int tempC=sensors.getTempCByIndex(0);
  int tempF=sensors.getTempFByIndex(0);
  delay(1000);

    Blynk.virtualWrite(V0, tempC);
   
    delay(500);
}

void setup() {
 Serial.begin(115200);
    while (!Serial);
Blynk.begin(auth, ssid,pass);
sensors.begin();
 timer.setInterval(2000L, sendSensor);
  dht.begin();
   pinMode(button_pin, INPUT_PULLUP);
  
    pinMode(ext_led, OUTPUT);
pinMode(Relay_pin, OUTPUT); // set arduino pin to output mode
  // Setup a function to be called every second
  timer.setInterval(2000L, sendSensor);

}
void loop() 
{
  Blynk.run();
  timer.run();

if (digitalRead(button_pin) == LOW)
{
   led1.setColor(BLYNK_GREEN);
  digitalWrite(ext_led, HIGH);
  Serial.println("pressed");  
}
else
{
  led1.setColor(BLYNK_RED);
  digitalWrite(ext_led, LOW);
  Serial.println("not pressed");
}
}

void sendTemps()
{
  
  Serial.print("Requesting temperatures...");
  sensors.requestTemperatures(); // Send the command to get temperatures
  Serial.println("DONE");
 
  float tempC = sensors.getTempCByIndex(0);

  // Check if reading was successful
  if(tempC != DEVICE_DISCONNECTED_C) 
  {
    Serial.print("Temperature for the device 1 (index 0) is: ");
    Serial.println(tempC);
  } 
  else
  {
    Serial.println("Error: Could not read temperature data");`Preformatted text`
  }
}
  
[...]Preformatted text

I assume that your menu widget is attached to pin V1 ?

If so, then I’d remove most of the code from your BLYNK_WRITE(V1) function and assign the incoming value from the widget to a global variable and have a timed function which reads your sensors and applies the appropriate appropriate logic based on the value of that global variable.

You should also remove everything from your void loo except Blynk.run() and timer.run(), and used a timer to call the other code.
You should also remove all delays from your code.

In addition, when you post code to the forum please copy and paste it directly from your IDE and place triple backticks at the beginning and end.
Triple backticks look like this:
```

Pete.