Přidání více metrik pro export

master
David Zálešák 2 years ago
parent 9f92104be4
commit 33e0c1e26a

@ -24,6 +24,7 @@ DallasTemperature sensor(&oneWire);
float temperature; float temperature;
String metrics; String metrics;
bool heating;
float reqTemp = 21.5; float reqTemp = 21.5;
float offset = 0.25; float offset = 0.25;
@ -165,9 +166,11 @@ void notFound(AsyncWebServerRequest *request) {
void thermostatCheck(){ void thermostatCheck(){
if(temperature < (reqTemp - offset)){ if(temperature < (reqTemp - offset)){
digitalWrite(RELAY_PIN, false); heating = 1;
digitalWrite(RELAY_PIN, !heating);
}else if(temperature > (reqTemp + offset)){ }else if(temperature > (reqTemp + offset)){
digitalWrite(RELAY_PIN, true); heating = 0;
digitalWrite(RELAY_PIN, !heating);
} }
} }
@ -181,6 +184,15 @@ void readSensor() {
} }
metrics = "temp "; metrics = "temp ";
metrics += temperature; metrics += temperature;
metrics += "\nraw_temp ";
metrics += tempC;
metrics += "\nheating ";
metrics += heating;
metrics += "\nreqTemp ";
metrics += reqTemp;
metrics += "\noffset ";
metrics += offset;
} }
void startConversion() { void startConversion() {