|
|
|
@ -107,7 +107,7 @@ void setup() {
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
if (request->hasParam("relay")) {
|
|
|
|
|
boolean state = request->getParam("relay")->value() == "1";
|
|
|
|
|
boolean state = request->getParam("relay")->value() == "0";
|
|
|
|
|
digitalWrite(RELAY_PIN, state);
|
|
|
|
|
repply = "success";
|
|
|
|
|
}else{
|
|
|
|
@ -124,7 +124,7 @@ void setup() {
|
|
|
|
|
if(request->hasParam("temp")) {
|
|
|
|
|
repply = temperature;
|
|
|
|
|
}else if(request->hasParam("relay")){
|
|
|
|
|
repply = digitalRead(RELAY_PIN);
|
|
|
|
|
repply = !digitalRead(RELAY_PIN);
|
|
|
|
|
}else if(THERMOSTAT && request->hasParam("reqtemp")){
|
|
|
|
|
repply = reqTemp;
|
|
|
|
|
}else if(THERMOSTAT && request->hasParam("offset")) {
|
|
|
|
@ -158,9 +158,9 @@ void notFound(AsyncWebServerRequest *request) {
|
|
|
|
|
|
|
|
|
|
void thermostatCheck(){
|
|
|
|
|
if(temperature < (reqTemp - offset)){
|
|
|
|
|
digitalWrite(RELAY_PIN, true);
|
|
|
|
|
}else if(temperature > (reqTemp + offset)){
|
|
|
|
|
digitalWrite(RELAY_PIN, false);
|
|
|
|
|
}else if(temperature > (reqTemp + offset)){
|
|
|
|
|
digitalWrite(RELAY_PIN, true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|