add nox_index to payload

This commit is contained in:
Phat Nguyen
2024-03-03 22:24:58 +07:00
parent 3f1da6387b
commit 6cf5e31843
4 changed files with 31 additions and 2 deletions

View File

@ -666,6 +666,7 @@ WebServer webServer;
int tvocIndex = -1;
int tvocRawIndex = -1;
int noxIndex = -1;
int noxRawIndex = -1;
int co2Ppm = 0;
int pm25_1 = -1;
@ -1019,11 +1020,13 @@ static void tvocUpdate(void) {
tvocIndex = ag.sgp41.getTvocIndex();
tvocRawIndex = ag.sgp41.getTvocRaw();
noxIndex = ag.sgp41.getNoxIndex();
noxRawIndex = ag.sgp41.getNoxRaw();
Serial.println();
Serial.printf(" TVOC index: %d\r\n", tvocIndex);
Serial.printf("TVOC raw index: %d\r\n", tvocRawIndex);
Serial.printf(" NOx index: %d\r\n", noxIndex);
Serial.printf(" NOx raw index: %d\r\n", noxRawIndex);
}
/**
@ -1412,6 +1415,9 @@ static String getServerSyncData(bool localServer) {
if (noxIndex >= 0) {
root["nox_index"] = noxIndex;
}
if(noxRawIndex >= 0) {
root["nox_raw"] = noxRawIndex;
}
}
}