mirror of
https://github.com/airgradienthq/arduino.git
synced 2025-07-28 16:07:16 +02:00
Merge branch 'develop' into feat/enable-at-debug
This commit is contained in:
@ -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();
|
||||||
|
@ -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");
|
||||||
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user