Browse Source

http order fix, time var fix

pull/1155/head
DanielR92 2 years ago
parent
commit
db93518506
  1. 4
      src/app.cpp
  2. 13
      src/plugins/zeroExport/zeroExport.h

4
src/app.cpp

@ -622,8 +622,8 @@ void app::zeroexport() {
serializeJsonPretty(object, data);
DPRINTLN(DBG_INFO, data);
mApi.ctrlRequest(object);
}
mConfig->plugin.zexport.lastTime = millis(); // set last timestamp
mConfig->plugin.zexport.lastTime = millis(); // set last timestamp
}
}
#endif

13
src/plugins/zeroExport/zeroExport.h

@ -50,12 +50,6 @@ class ZeroExport {
// TODO: Need to improve here. 2048 for a JSON Obj is to big!?
bool zero()
{
if (!httpClient.begin(mCfg->monitor_url)) {
DPRINTLN(DBG_INFO, "httpClient.begin failed");
httpClient.end();
return false;
}
httpClient.setFollowRedirects(HTTPC_STRICT_FOLLOW_REDIRECTS);
httpClient.setUserAgent("Ahoy-Agent");
httpClient.setConnectTimeout(1000);
@ -63,6 +57,12 @@ class ZeroExport {
httpClient.addHeader("Content-Type", "application/json");
httpClient.addHeader("Accept", "application/json");
if (!httpClient.begin(mCfg->monitor_url)) {
DPRINTLN(DBG_INFO, "httpClient.begin failed");
httpClient.end();
return false;
}
int httpCode = httpClient.GET();
if (httpCode == HTTP_CODE_OK)
{
@ -95,6 +95,7 @@ class ZeroExport {
DPRINTLN(DBG_INFO, F("ZeroExport(): Error ") + String(httpCode));
return false;
}
httpClient.end();
return true;
}

Loading…
Cancel
Save