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

@ -669,6 +669,7 @@ static int dispSmState = APP_SM_NORMAL; /** Save LED SM */
static int tvocIndex = -1;
static int tvocRawIndex = -1;
static int noxIndex = -1;
static int noxRawIndex = -1;
static int co2Ppm = -1;
static int pm25 = -1;
static int pm01 = -1;
@ -736,7 +737,7 @@ void setup() {
u8g2.begin();
/** Show boot display */
Serial.println("Firmware Version: "+ag.getVersion());
Serial.println("Firmware Version: " + ag.getVersion());
displayShowText("One V9", "FW Ver: " + ag.getVersion(), "");
delay(DISPLAY_DELAY_SHOW_CONTENT_MS);
@ -1016,7 +1017,7 @@ void webServerMetricsGet(void) {
add_metric_point("", String(tvocIndex));
}
if (tvocRawIndex >= 0) {
add_metric("tvoc_raw_index",
add_metric("tvoc_raw",
"The raw input value to the Total Volatile Organic Compounds "
"(TVOC) index as measured by the AirGradient SGP sensor",
"gauge");
@ -1029,6 +1030,13 @@ void webServerMetricsGet(void) {
"gauge");
add_metric_point("", String(noxIndex));
}
if (noxRawIndex >= 0) {
add_metric("nox_raw",
"The raw input value to the Nitrous Oxide (NOx) index as "
"measured by the AirGradient SGP sensor",
"gauge");
add_metric_point("", String(noxRawIndex));
}
}
if (hasSensorSHT) {
@ -1118,6 +1126,9 @@ static String getServerSyncData(bool localServer) {
if (noxIndex >= 0) {
root["nox_index"] = noxIndex;
}
if(noxRawIndex >= 0) {
root["nox_raw"] = noxRawIndex;
}
}
if (hasSensorSHT) {
if (temp > -1001) {
@ -2179,11 +2190,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);
}
/**