Compare commits

..

11 Commits
3.3.1 ... 3.3.2

Author SHA1 Message Date
9ed58d1853 Prepare release 3.3.2 2025-03-31 17:12:15 +07:00
6c52b038e9 Merge pull request #295 from airgradienthq/feat/enable-at-debug
Enable cellular AT command debug when in network registration
2025-03-31 17:09:43 +07:00
2f69932ef7 add depth submodule update 2025-03-31 17:04:37 +07:00
1d96a274a6 Merge branch 'develop' into feat/enable-at-debug 2025-03-31 16:55:12 +07:00
df9f6dfc95 Fix bugs from 3.3.1 release 2025-03-31 16:52:09 +07:00
3fc02b3f54 Check signal when initialize cellular client 2025-03-31 16:51:29 +07:00
958ed0bd80 Fix TVOC and NOx payload position 2025-03-31 15:26:34 +07:00
e9be9dcc83 Fix mqtt host still exist on local when on server is disabled 2025-03-31 14:51:53 +07:00
7fbab82088 Change log level when correction not found 2025-03-31 14:07:30 +07:00
decdecdf22 Don't start mqtt when network option is cellular
Even when mqtt host is set
2025-03-31 14:01:49 +07:00
145c612867 Enable cellular at debug when registering network
On boot, airgradient-client change cellular init timeout to 5 mins
2025-03-31 13:53:56 +07:00
8 changed files with 37 additions and 15 deletions

View File

@ -38,6 +38,7 @@ jobs:
steps: steps:
- uses: actions/checkout@v4.2.2 - uses: actions/checkout@v4.2.2
with: with:
fetch-depth: 0
submodules: 'true' submodules: 'true'
- uses: arduino/compile-sketches@v1.1.2 - uses: arduino/compile-sketches@v1.1.2
with: with:

2
.gitignore vendored
View File

@ -4,5 +4,7 @@ build
/.idea/ /.idea/
.pio .pio
.cache .cache
.clangd
logs logs
gen_compile_commands.py
compile_commands.json compile_commands.json

View File

@ -423,6 +423,11 @@ static void initMqtt(void) {
return; return;
} }
if (networkOption == UseCellular) {
Serial.println("MQTT not available for cellular options");
return;
}
if (mqttClient.begin(mqttUri)) { if (mqttClient.begin(mqttUri)) {
Serial.println("Successfully connected to MQTT broker"); Serial.println("Successfully connected to MQTT broker");
createMqttTask(); createMqttTask();
@ -934,6 +939,11 @@ void initializeNetwork() {
networkOption = UseWifi; networkOption = UseWifi;
} }
if (networkOption == UseCellular) {
// Enable serial stream debugging to check the AT command when doing registration
agSerial->setDebug(true);
}
if (!agClient->begin(ag->deviceId().c_str())) { if (!agClient->begin(ag->deviceId().c_str())) {
oledDisplay.setText("Client", "initialization", "failed"); oledDisplay.setText("Client", "initialization", "failed");
delay(5000); delay(5000);
@ -943,6 +953,11 @@ void initializeNetwork() {
ESP.restart(); ESP.restart();
} }
if (networkOption == UseCellular) {
// Disabling it again
agSerial->setDebug(false);
}
if (networkOption == UseWifi) { if (networkOption == UseWifi) {
if (!wifiConnector.connect()) { if (!wifiConnector.connect()) {
Serial.println("Cannot initiate wifi connection"); Serial.println("Cannot initiate wifi connection");
@ -1495,11 +1510,13 @@ void networkingTask(void *args) {
else if (networkOption == UseCellular) { else if (networkOption == UseCellular) {
if (agClient->isClientReady() == false) { if (agClient->isClientReady() == false) {
Serial.println("Cellular client not ready, ensuring connection..."); Serial.println("Cellular client not ready, ensuring connection...");
agSerial->setDebug(true);
if (agClient->ensureClientConnection() == false) { if (agClient->ensureClientConnection() == false) {
Serial.println("Cellular client connection not ready, retry in 5s..."); Serial.println("Cellular client connection not ready, retry in 5s...");
delay(5000); delay(5000);
continue; continue;
} }
agSerial->setDebug(false);
} }
} }

View File

@ -1,5 +1,5 @@
name=AirGradient Air Quality Sensor name=AirGradient Air Quality Sensor
version=3.3.1 version=3.3.2
author=AirGradient <support@airgradient.com> author=AirGradient <support@airgradient.com>
maintainer=AirGradient <support@airgradient.com> maintainer=AirGradient <support@airgradient.com>
sentence=ESP32-C3 / ESP8266 library for air quality monitor measuring PM, CO2, Temperature, TVOC and Humidity with OLED display. sentence=ESP32-C3 / ESP8266 library for air quality monitor measuring PM, CO2, Temperature, TVOC and Humidity with OLED display.

View File

@ -240,7 +240,7 @@ bool Configuration::updateTempHumCorrection(JSONVar &json, TempHumCorrection &ta
JSONVar corrections = json[jprop_corrections]; JSONVar corrections = json[jprop_corrections];
if (!corrections.hasOwnProperty(correctionName)) { if (!corrections.hasOwnProperty(correctionName)) {
logWarning(String(correctionName) + " correction field not found on configuration"); logInfo(String(correctionName) + " correction field not found on configuration");
return false; return false;
} }
@ -739,7 +739,13 @@ bool Configuration::parse(String data, bool isLocal) {
jsonInvalid(); jsonInvalid();
return false; return false;
} }
} else { }
else if (JSON.typeof_(root[jprop_mqttBrokerUrl]) == "null" and !isLocal) {
// So if its not available on the json and json comes from aigradient server
// then set its value to default (empty)
jconfig[jprop_mqttBrokerUrl] = jprop_mqttBrokerUrl_default;
}
else {
if (jsonTypeInvalid(root[jprop_mqttBrokerUrl], "string")) { if (jsonTypeInvalid(root[jprop_mqttBrokerUrl], "string")) {
failedMessage = failedMessage =
jsonTypeInvalidMessage(String(jprop_mqttBrokerUrl), "string"); jsonTypeInvalidMessage(String(jprop_mqttBrokerUrl), "string");

View File

@ -804,16 +804,16 @@ std::string Measurements::buildMeasuresPayload(Measures &mc) {
oss << ","; oss << ",";
// NOx // TVOC
if (utils::isValidNOx(mc.nox)) { if (utils::isValidVOC(mc.tvoc)) {
oss << std::round(mc.nox); oss << std::round(mc.tvoc);
} }
oss << ","; oss << ",";
// TVOC // NOx
if (utils::isValidVOC(mc.tvoc)) { if (utils::isValidNOx(mc.nox)) {
oss << std::round(mc.tvoc); oss << std::round(mc.nox);
} }
oss << ","; oss << ",";
@ -827,10 +827,6 @@ std::string Measurements::buildMeasuresPayload(Measures &mc) {
oss << std::round(mc.pm_03_pc[1]); oss << std::round(mc.pm_03_pc[1]);
} }
// char datapoint[128] = {0};
// snprintf(datapoint, 128, "%d,%.0f,%.0f,%.0f,%.0f,%.0f,%d,%d,%d", co2, temp * 10,
// hum * 10, pm01 * 10, pm25 * 10, pm10 * 10, tvoc, nox, pm003Count);
return oss.str(); return oss.str();
} }

View File

@ -15,7 +15,7 @@
#include "Main/utils.h" #include "Main/utils.h"
#ifndef GIT_VERSION #ifndef GIT_VERSION
#define GIT_VERSION "3.3.1-snap" #define GIT_VERSION "3.3.2-snap"
#endif #endif