mirror of
https://github.com/lumapu/ahoy.git
synced 2025-06-09 06:01:37 +02:00
changes tibber things
This commit is contained in:
parent
05978a01f8
commit
d1535ea188
3 changed files with 12 additions and 14 deletions
|
@ -14,7 +14,6 @@
|
||||||
#include "config/settings.h"
|
#include "config/settings.h"
|
||||||
|
|
||||||
#if defined(ZEROEXPORT_POWERMETER_TIBBER)
|
#if defined(ZEROEXPORT_POWERMETER_TIBBER)
|
||||||
#include <base64.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
|
@ -493,16 +492,7 @@ class powermeter {
|
||||||
|
|
||||||
logObj["mod"] = "getPowermeterWattsTibber";
|
logObj["mod"] = "getPowermeterWattsTibber";
|
||||||
|
|
||||||
String auth;
|
String auth = mCfg->groups[group].pm_pass;
|
||||||
if (strlen(mCfg->groups[group].pm_user) > 0 && strlen(mCfg->groups[group].pm_pass) > 0) {
|
|
||||||
auth = base64::encode(String(mCfg->groups[group].pm_user) + String(":") + String(mCfg->groups[group].pm_pass));
|
|
||||||
snprintf(mCfg->groups[group].pm_user, ZEROEXPORT_GROUP_MAX_LEN_PM_USER, "%s", DEF_ZEXPORT);
|
|
||||||
snprintf(mCfg->groups[group].pm_pass, ZEROEXPORT_GROUP_MAX_LEN_PM_PASS, "%s", auth.c_str());
|
|
||||||
//@TODO:mApp->saveSettings(false);
|
|
||||||
} else {
|
|
||||||
auth = mCfg->groups[group].pm_pass;
|
|
||||||
}
|
|
||||||
|
|
||||||
String url = String("http://") + mCfg->groups[group].pm_url + String("/") + String(mCfg->groups[group].pm_jsonPath);
|
String url = String("http://") + mCfg->groups[group].pm_url + String("/") + String(mCfg->groups[group].pm_jsonPath);
|
||||||
|
|
||||||
setHeader(&http);
|
setHeader(&http);
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "ESPAsyncWebServer.h"
|
#include "ESPAsyncWebServer.h"
|
||||||
|
|
||||||
#include "plugins/history.h"
|
#include "plugins/history.h"
|
||||||
|
#include <base64.h>
|
||||||
|
|
||||||
#if defined(F) && defined(ESP32)
|
#if defined(F) && defined(ESP32)
|
||||||
#undef F
|
#undef F
|
||||||
|
@ -1161,8 +1162,15 @@ class RestApi {
|
||||||
mConfig->plugin.zeroExport.groups[group].pm_type = jsonIn[F("pm_type")];
|
mConfig->plugin.zeroExport.groups[group].pm_type = jsonIn[F("pm_type")];
|
||||||
snprintf(mConfig->plugin.zeroExport.groups[group].pm_url, ZEROEXPORT_GROUP_MAX_LEN_PM_URL, "%s", jsonIn[F("pm_url")].as<const char*>());
|
snprintf(mConfig->plugin.zeroExport.groups[group].pm_url, ZEROEXPORT_GROUP_MAX_LEN_PM_URL, "%s", jsonIn[F("pm_url")].as<const char*>());
|
||||||
snprintf(mConfig->plugin.zeroExport.groups[group].pm_jsonPath, ZEROEXPORT_GROUP_MAX_LEN_PM_JSONPATH, "%s", jsonIn[F("pm_jsonPath")].as<const char*>());
|
snprintf(mConfig->plugin.zeroExport.groups[group].pm_jsonPath, ZEROEXPORT_GROUP_MAX_LEN_PM_JSONPATH, "%s", jsonIn[F("pm_jsonPath")].as<const char*>());
|
||||||
snprintf(mConfig->plugin.zeroExport.groups[group].pm_user, ZEROEXPORT_GROUP_MAX_LEN_PM_USER, "%s", jsonIn[F("pm_user")].as<const char*>());
|
|
||||||
snprintf(mConfig->plugin.zeroExport.groups[group].pm_pass, ZEROEXPORT_GROUP_MAX_LEN_PM_PASS, "%s", jsonIn[F("pm_pass")].as<const char*>());
|
|
||||||
|
if (jsonIn[F("pm_pass")] != F("****"))
|
||||||
|
{
|
||||||
|
String auth = base64::encode(String(jsonIn[F("pm_user")]) + String(":") + String(jsonIn[F("pm_pass")]));
|
||||||
|
snprintf(mConfig->plugin.zeroExport.groups[group].pm_user, ZEROEXPORT_GROUP_MAX_LEN_PM_USER, "%s", String(jsonIn[F("pm_user")]).c_str());
|
||||||
|
snprintf(mConfig->plugin.zeroExport.groups[group].pm_pass, ZEROEXPORT_GROUP_MAX_LEN_PM_PASS, "%s", auth.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
mConfig->plugin.zeroExport.groups[group].pm_target = jsonIn[F("pm_target")];
|
mConfig->plugin.zeroExport.groups[group].pm_target = jsonIn[F("pm_target")];
|
||||||
// Inverters
|
// Inverters
|
||||||
for(uint8_t inv = 0; inv < ZEROEXPORT_GROUP_MAX_INVERTERS; inv++) {
|
for(uint8_t inv = 0; inv < ZEROEXPORT_GROUP_MAX_INVERTERS; inv++) {
|
||||||
|
|
|
@ -1400,7 +1400,7 @@
|
||||||
ml("input", {name: "pm_jsonPath", class: "text", type: "text", value: obj.pm_jsonPath}, null),
|
ml("input", {name: "pm_jsonPath", class: "text", type: "text", value: obj.pm_jsonPath}, null),
|
||||||
]),
|
]),
|
||||||
divRow("{#ZE_GROUP_TAB_POWERMETER_USER}",
|
divRow("{#ZE_GROUP_TAB_POWERMETER_USER}",
|
||||||
ml("input", {name: "pm_user", class: "text", type: "text", value: "" }, null),
|
ml("input", {name: "pm_user", class: "text", type: "text", value: obj.pm_user }, null),
|
||||||
),
|
),
|
||||||
divRow("{#ZE_GROUP_TAB_POWERMETER_PASS}",
|
divRow("{#ZE_GROUP_TAB_POWERMETER_PASS}",
|
||||||
ml("input", {name: "pm_pass", class: "text", type: "password", value: "****"}, null),
|
ml("input", {name: "pm_pass", class: "text", type: "password", value: "****"}, null),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue