Commit afa49c20 authored by Eric Duminil's avatar Eric Duminil
Browse files

Checking if MQTT is active

parent 985e9560
Pipeline #5771 passed with stage
in 2 minutes and 15 seconds
...@@ -42,6 +42,8 @@ namespace mqtt { ...@@ -42,6 +42,8 @@ namespace mqtt {
char last_successful_publish[23] = ""; char last_successful_publish[23] = "";
void initialize(const char *sensorId) { void initialize(const char *sensorId) {
Serial.print("MQTT ? ");
Serial.println(config::mqtt_active());
json_sensor_format = PSTR("{\"time\":\"%s\", \"co2\":%d, \"temp\":%.1f, \"rh\":%.1f}"); json_sensor_format = PSTR("{\"time\":\"%s\", \"co2\":%d, \"temp\":%.1f, \"rh\":%.1f}");
snprintf(publish_topic, sizeof(publish_topic), "CO2sensors/%s", sensorId); snprintf(publish_topic, sizeof(publish_topic), "CO2sensors/%s", sensorId);
#if MQTT_ENCRYPTED #if MQTT_ENCRYPTED
......
...@@ -295,6 +295,9 @@ namespace config { ...@@ -295,6 +295,9 @@ namespace config {
uint16_t &csv_interval = web_config::csvTimestepParam.value(); uint16_t &csv_interval = web_config::csvTimestepParam.value();
// MQTT // MQTT
bool mqtt_active() {
return web_config::mqttParams.isActive();
}
char *mqtt_server = web_config::mqttServerParam.value(); char *mqtt_server = web_config::mqttServerParam.value();
char *mqtt_user = web_config::mqttUserParam.value(); char *mqtt_user = web_config::mqttUserParam.value();
char *mqtt_password = web_config::mqttPasswordParam.value(); char *mqtt_password = web_config::mqttPasswordParam.value();
......
...@@ -32,7 +32,7 @@ namespace config { ...@@ -32,7 +32,7 @@ namespace config {
extern uint16_t &csv_interval; // [s] extern uint16_t &csv_interval; // [s]
// MQTT // MQTT
//TODO: Add use_mqtt bool mqtt_active();
extern char *mqtt_server; extern char *mqtt_server;
extern char *mqtt_user; extern char *mqtt_user;
extern char *mqtt_password; extern char *mqtt_password;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment