mirror of
https://github.com/lumapu/ahoy.git
synced 2025-06-02 18:51:38 +02:00
Update powermeter.h
This commit is contained in:
parent
e18309a528
commit
c91f2018cb
1 changed files with 14 additions and 23 deletions
|
@ -117,6 +117,16 @@ class powermeter {
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
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
|
// set HTTPClient header
|
||||||
void setHeader(HTTPClient* h) {
|
void setHeader(HTTPClient* h) {
|
||||||
|
@ -142,14 +152,7 @@ class powermeter {
|
||||||
|
|
||||||
logObj["mod"] = "getPowermeterWattsShelly";
|
logObj["mod"] = "getPowermeterWattsShelly";
|
||||||
|
|
||||||
HTTPClient http;
|
setHeader(&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");
|
|
||||||
|
|
||||||
String url = String("http://") + String(mCfg->groups[group].pm_url) + String("/") + String(mCfg->groups[group].pm_jsonPath);
|
String url = String("http://") + String(mCfg->groups[group].pm_url) + String("/") + String(mCfg->groups[group].pm_jsonPath);
|
||||||
logObj["HTTP_URL"] = url;
|
logObj["HTTP_URL"] = url;
|
||||||
|
@ -340,11 +343,9 @@ class powermeter {
|
||||||
|
|
||||||
logObj["mod"] = "getPowermeterWattsMqtt";
|
logObj["mod"] = "getPowermeterWattsMqtt";
|
||||||
|
|
||||||
// Hier neuer Code - Anfang
|
// topic for powermeter?
|
||||||
|
result.P = mCfg->groups[group].pm_P;
|
||||||
// TODO: Noch nicht komplett
|
result.P1 = result.P2 = result.P3 = mCfg->groups[group].pm_P / 3;
|
||||||
|
|
||||||
// Hier neuer Code - Ende
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -531,16 +532,6 @@ class powermeter {
|
||||||
mPowermeterBufferPos[group]++;
|
mPowermeterBufferPos[group]++;
|
||||||
if (mPowermeterBufferPos[group] >= 5) mPowermeterBufferPos[group] = 0;
|
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__*/
|
#endif /*__POWERMETER_H__*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue