Commit 13e998e8 authored by Nelso Jost's avatar Nelso Jost

FIX uncommented server upload

parent cd36d4bb
......@@ -47,12 +47,12 @@ void Meteorologger::update(void)
if (this->interval_minutes == 0) return;
//String json=this->generate_json();
//this->repl->log("\n[DEBUG] --- JSON created ---\n" + json);
//if (!this->server_upload(json))
//{
//this->status_level = STATUS_ERROR_SERVER;
//}
String json=this->generate_json();
this->repl->log("\n[DEBUG] --- JSON created ---\n" + json);
if (!this->server_upload(json))
{
this->status_level = STATUS_ERROR_SERVER;
}
String datalog_line=this->arduino_response + "," + String(
(this->status_level == STATUS_ERROR_SERVER)? 0:1);
......@@ -305,31 +305,34 @@ String Meteorologger::generate_json(void)
for (int i=0; i < array_values.size(); i++)
{
String sensor_name = array_sensors[i].as<String>();
String value = array_values[i];
value.trim();
if (value[0] == '<') value = "NaN";
if (sensor_name == "dt")
{
root_datetime["value"] = array_values[i];
root_datetime["value"] = value;
root_datetime["format"] = String(this->datetime_format);
root_datetime["source"] = "RTC";
}
else if (sensor_name == "T")
{
root_sensors["DHT22_TEMP"] = array_values[i];
root_sensors["DHT22_TEMP"] = value;
}
else if (sensor_name == "t")
{
root_sensors["BMP085_TEMP"] = array_values[i];
root_sensors["BMP085_TEMP"] = value;
}
else if (sensor_name == "p")
{
root_sensors["BMP085_PRESSURE"] = array_values[i];
root_sensors["BMP085_PRESSURE"] = value;
}
else if (sensor_name == "l")
{
root_sensors["LDR"] = array_values[i];
root_sensors["LDR"] = value;
}
else
{
root_sensors[sensor_name] = array_values[i];
root_sensors[sensor_name] = value;
}
}
root_data["datetime"] = root_datetime;
......
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