diff --git a/src/AgApiClient.cpp b/src/AgApiClient.cpp index 1f7c83b2..8ef0d6cf 100644 --- a/src/AgApiClient.cpp +++ b/src/AgApiClient.cpp @@ -2,6 +2,7 @@ #include "AgConfigure.h" #include "AirGradient.h" #include "Libraries/Arduino_JSON/src/Arduino_JSON.h" +#include #ifdef ESP8266 #include #include @@ -105,9 +106,9 @@ bool AgApiClient::postToServer(String data) { return true; } - if (WiFi.isConnected() == false) { - return false; - } + //if (WiFi.isConnected() == false) { + // return false; + //} String uri = "http://hw.airgradient.com/sensors/airgradient:" + ag->deviceId() + diff --git a/src/AgConfigure.cpp b/src/AgConfigure.cpp index 4518f244..3c5416a0 100644 --- a/src/AgConfigure.cpp +++ b/src/AgConfigure.cpp @@ -241,7 +241,7 @@ bool Configuration::parse(String data, bool isLocal) { bool changed = false; /** Get ConfigurationControl */ - String lastCtrl = jconfig[jprop_configurationControl]; + const String lastCtrl = jconfig[jprop_configurationControl]; const char *msg = "Monitor set to accept only configuration from the " "cloud. Use property configurationControl to change."; @@ -287,7 +287,8 @@ bool Configuration::parse(String data, bool isLocal) { } /** Ignore all configuration value if 'configurationControl' is 'cloud' */ - if (jconfig[jprop_configurationControl] == + const String ctrl = jconfig[jprop_configurationControl]; + if (ctrl == String(CONFIGURATION_CONTROL_NAME [ConfigurationControl::ConfigurationControlCloud])) { failedMessage = String(msg); @@ -295,7 +296,8 @@ bool Configuration::parse(String data, bool isLocal) { return false; } } else { - if (jconfig[jprop_configurationControl] == + const String ctrl = jconfig[jprop_configurationControl]; + if (ctrl == String(CONFIGURATION_CONTROL_NAME [ConfigurationControl::ConfigurationControlLocal])) { failedMessage = "Cloud configure ignored"; diff --git a/src/MqttClient.cpp b/src/MqttClient.cpp index 66c71e6e..69f34f51 100644 --- a/src/MqttClient.cpp +++ b/src/MqttClient.cpp @@ -32,9 +32,8 @@ bool MqttClient::begin(String uri) { #ifdef ESP32 /** config esp_mqtt client */ - esp_mqtt_client_config_t config = { - .uri = this->uri.c_str(), - }; + esp_mqtt_client_config_t config = {}; + config.broker.address.uri = this->uri.c_str(); /** init client */ client = esp_mqtt_client_init(&config);