Compare commits

..

1 Commits

Author SHA1 Message Date
samuelbles07
844674d8ee Working feature ce using coap 2025-12-17 11:44:26 +07:00
3 changed files with 6 additions and 12 deletions

View File

@@ -998,7 +998,7 @@ void initializeNetwork() {
delay(2500);
}
if (!agClient->begin(ag->deviceId().c_str())) {
if (!agClient->begin(ag->deviceId().c_str(), AirgradientClient::ONE_OPENAIR)) {
oledDisplay.setText("Client", "initialization", "failed");
delay(5000);
oledDisplay.showRebooting();
@@ -1057,7 +1057,7 @@ void initializeNetwork() {
return;
}
std::string config = agClient->httpFetchConfig();
std::string config = agClient->coapFetchConfig();
configSchedule.update();
// Check if fetch configuration failed or fetch succes but parsing failed
if (agClient->isLastFetchConfigSucceed() == false ||
@@ -1086,7 +1086,7 @@ static void configurationUpdateSchedule(void) {
return;
}
std::string config = agClient->httpFetchConfig();
std::string config = agClient->coapFetchConfig();
if (agClient->isLastFetchConfigSucceed()) {
configuration.parse(config.c_str(), false);
}
@@ -1428,7 +1428,7 @@ void postUsingCellular(bool forcePost) {
xSemaphoreGive(mutexMeasurementCycleQueue);
// Attempt to send
if (agClient->httpPostMeasures(payload, extendPmMeasures) == false) {
if (agClient->coapPostMeasures(payload) == false) {
// Consider network has a problem, retry in next schedule
Serial.println("Post measures failed, retry in next schedule");
return;

View File

@@ -953,13 +953,7 @@ bool Configuration::parse(String data, bool isLocal) {
String(value ? "true" : "false"));
jconfig[jprop_extendedPmMeasures] = value;
}
}
else if (JSON.typeof_(root[jprop_extendedPmMeasures]) == "null" and !isLocal) {
// So if its not available on the json and json comes from aigradient server
// then set its value to default (false)
jconfig[jprop_extendedPmMeasures] = jprop_extendedPmMeasures_default;
}
else {
} else {
if (jsonTypeInvalid(root[jprop_extendedPmMeasures], "boolean")) {
failedMessage = jsonTypeInvalidMessage(
String(jprop_extendedPmMeasures), "boolean");