My sketch is not working as intended
if (digitalRead(exhaustpin) == LOW) {
    static unsigned long interval = millis();
    if ((millis() - interval) &gt;= 600000) {
      digitalWrite(coolerpin, LOW);
      digitalWrite(exhaustpin, HIGH);
      // after the starting of exhaust fan it wait for 10 minutes, then it turns on
      // the cooler and turns off the exhaust fan
    }
  }


interval is only ever set once. So 10 minutes after it is first set it will remain over 10 minutes.

The simplest fix is to set interval to millis() when you set exhaustpin to low:

if ((roomtemp&gt;=30)&amp;&amp;(digitalRead(coolerpin)==HIGH)) {
  digitalWrite(exhaustpin,LOW );
  // if temperature increses above 30 the exhaust starts to work
  interval = millis();
}