Browse Source

Update powermeter.h

pull/1581/head
DanielR92 10 months ago
committed by GitHub
parent
commit
c91f2018cb
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 37
      src/plugins/zeroExport/powermeter.h

37
src/plugins/zeroExport/powermeter.h

@ -117,6 +117,16 @@ class powermeter {
}
private:
HTTPClient http;
zeroExport_t *mCfg;
JsonObject *mLog;
unsigned long mPreviousTsp = 0;
PowermeterBuffer_t mPowermeterBuffer[ZEROEXPORT_MAX_GROUPS][5] = {0};
short mPowermeterBufferPos[ZEROEXPORT_MAX_GROUPS] = {0};
// set HTTPClient header
void setHeader(HTTPClient* h) {
@ -142,14 +152,7 @@ class powermeter {
logObj["mod"] = "getPowermeterWattsShelly";
HTTPClient http;
http.setFollowRedirects(HTTPC_STRICT_FOLLOW_REDIRECTS);
http.setUserAgent("Ahoy-Agent");
// TODO: Ahoy-0.8.850024-zero
http.setConnectTimeout(500);
http.setTimeout(1000);
http.addHeader("Content-Type", "application/json");
http.addHeader("Accept", "application/json");
setHeader(&http);
String url = String("http://") + String(mCfg->groups[group].pm_url) + String("/") + String(mCfg->groups[group].pm_jsonPath);
logObj["HTTP_URL"] = url;
@ -340,11 +343,9 @@ class powermeter {
logObj["mod"] = "getPowermeterWattsMqtt";
// Hier neuer Code - Anfang
// TODO: Noch nicht komplett
// Hier neuer Code - Ende
// topic for powermeter?
result.P = mCfg->groups[group].pm_P;
result.P1 = result.P2 = result.P3 = mCfg->groups[group].pm_P / 3;
return result;
}
@ -531,16 +532,6 @@ class powermeter {
mPowermeterBufferPos[group]++;
if (mPowermeterBufferPos[group] >= 5) mPowermeterBufferPos[group] = 0;
}
HTTPClient http;
zeroExport_t *mCfg;
JsonObject *mLog;
unsigned long mPreviousTsp = 0;
PowermeterBuffer_t mPowermeterBuffer[ZEROEXPORT_MAX_GROUPS][5] = {0};
short mPowermeterBufferPos[ZEROEXPORT_MAX_GROUPS] = {0};
};
#endif /*__POWERMETER_H__*/

Loading…
Cancel
Save