Browse Source

Powermeter modify getHeader

pull/1638/head
Patrick Amrhein 8 months ago
parent
commit
13d59237c0
  1. 9
      src/plugins/zeroExport/powermeter.h
  2. 2
      src/plugins/zeroExport/zeroExport.h

9
src/plugins/zeroExport/powermeter.h

@ -46,7 +46,8 @@ class powermeter {
* @param *log * @param *log
* @returns void * @returns void
*/ */
bool setup(zeroExport_t *cfg, PubMqttType *mqtt, JsonObject *log) { bool setup(IApp *app, zeroExport_t *cfg, PubMqttType *mqtt, JsonObject *log) {
mApp = app;
mCfg = cfg; mCfg = cfg;
mMqtt = mqtt; mMqtt = mqtt;
mLog = log; mLog = log;
@ -277,6 +278,7 @@ class powermeter {
zeroExport_t *mCfg; zeroExport_t *mCfg;
PubMqttType *mMqtt = nullptr; PubMqttType *mMqtt = nullptr;
JsonObject *mLog; JsonObject *mLog;
IApp *mApp = nullptr;
unsigned long mPreviousTsp = millis(); unsigned long mPreviousTsp = millis();
@ -291,8 +293,9 @@ class powermeter {
*/ */
void setHeader(HTTPClient *h) { void setHeader(HTTPClient *h) {
h->setFollowRedirects(HTTPC_STRICT_FOLLOW_REDIRECTS); h->setFollowRedirects(HTTPC_STRICT_FOLLOW_REDIRECTS);
h->setUserAgent("Ahoy-Agent"); /// h->setUserAgent("Ahoy-Agent");
// TODO: Ahoy-0.8.850024-zero /// // TODO: Ahoy-0.8.850024-zero
h->setUserAgent(mApp->getVersion());
h->setConnectTimeout(500); h->setConnectTimeout(500);
h->setTimeout(1000); h->setTimeout(1000);
h->addHeader("Content-Type", "application/json"); h->addHeader("Content-Type", "application/json");

2
src/plugins/zeroExport/zeroExport.h

@ -47,7 +47,7 @@ class ZeroExport {
mApi = api; mApi = api;
mMqtt = mqtt; mMqtt = mqtt;
mIsInitialized = mPowermeter.setup(mCfg, mqtt, &mLog); mIsInitialized = mPowermeter.setup(mApp, mCfg, mqtt, &mLog);
} }
/** loop /** loop

Loading…
Cancel
Save