mirror of
https://github.com/lumapu/ahoy.git
synced 2025-06-07 21:21:38 +02:00
commit
def77f1af8
5 changed files with 86 additions and 98 deletions
|
@ -40,7 +40,6 @@ build_flags =
|
||||||
build_unflags =
|
build_unflags =
|
||||||
-std=gnu++11
|
-std=gnu++11
|
||||||
|
|
||||||
|
|
||||||
[env:esp8266-minimal]
|
[env:esp8266-minimal]
|
||||||
platform = espressif8266
|
platform = espressif8266
|
||||||
board = esp12e
|
board = esp12e
|
||||||
|
@ -148,7 +147,7 @@ monitor_filters =
|
||||||
esp8266_exception_decoder
|
esp8266_exception_decoder
|
||||||
|
|
||||||
[env:esp32-wroom32-minimal]
|
[env:esp32-wroom32-minimal]
|
||||||
platform = espressif32@6.5.0
|
platform = espressif32@6.6.0
|
||||||
board = lolin_d32
|
board = lolin_d32
|
||||||
build_flags = ${env.build_flags}
|
build_flags = ${env.build_flags}
|
||||||
-DUSE_HSPI_FOR_EPD
|
-DUSE_HSPI_FOR_EPD
|
||||||
|
@ -156,7 +155,7 @@ monitor_filters =
|
||||||
esp32_exception_decoder
|
esp32_exception_decoder
|
||||||
|
|
||||||
[env:esp32-wroom32]
|
[env:esp32-wroom32]
|
||||||
platform = espressif32@6.5.0
|
platform = espressif32@6.6.0
|
||||||
board = lolin_d32
|
board = lolin_d32
|
||||||
build_flags = ${env:esp32-wroom32-minimal.build_flags}
|
build_flags = ${env:esp32-wroom32-minimal.build_flags}
|
||||||
-DENABLE_MQTT
|
-DENABLE_MQTT
|
||||||
|
@ -167,7 +166,7 @@ monitor_filters =
|
||||||
esp32_exception_decoder
|
esp32_exception_decoder
|
||||||
|
|
||||||
[env:esp32-wroom32-de]
|
[env:esp32-wroom32-de]
|
||||||
platform = espressif32@6.5.0
|
platform = espressif32@6.6.0
|
||||||
board = lolin_d32
|
board = lolin_d32
|
||||||
build_flags = ${env:esp32-wroom32.build_flags}
|
build_flags = ${env:esp32-wroom32.build_flags}
|
||||||
-DLANG_DE
|
-DLANG_DE
|
||||||
|
@ -175,7 +174,7 @@ monitor_filters =
|
||||||
esp32_exception_decoder
|
esp32_exception_decoder
|
||||||
|
|
||||||
[env:esp32-wroom32-prometheus]
|
[env:esp32-wroom32-prometheus]
|
||||||
platform = espressif32@6.5.0
|
platform = espressif32@6.6.0
|
||||||
board = lolin_d32
|
board = lolin_d32
|
||||||
build_flags = ${env:esp32-wroom32.build_flags}
|
build_flags = ${env:esp32-wroom32.build_flags}
|
||||||
-DENABLE_PROMETHEUS_EP
|
-DENABLE_PROMETHEUS_EP
|
||||||
|
@ -183,7 +182,7 @@ monitor_filters =
|
||||||
esp32_exception_decoder
|
esp32_exception_decoder
|
||||||
|
|
||||||
[env:esp32-wroom32-prometheus-de]
|
[env:esp32-wroom32-prometheus-de]
|
||||||
platform = espressif32@6.5.0
|
platform = espressif32@6.6.0
|
||||||
board = lolin_d32
|
board = lolin_d32
|
||||||
build_flags = ${env:esp32-wroom32-prometheus.build_flags}
|
build_flags = ${env:esp32-wroom32-prometheus.build_flags}
|
||||||
-DLANG_DE
|
-DLANG_DE
|
||||||
|
@ -219,7 +218,7 @@ monitor_filters =
|
||||||
esp32_exception_decoder
|
esp32_exception_decoder
|
||||||
|
|
||||||
[env:esp32-s2-mini]
|
[env:esp32-s2-mini]
|
||||||
platform = espressif32@6.5.0
|
platform = espressif32@6.6.0
|
||||||
board = lolin_s2_mini
|
board = lolin_s2_mini
|
||||||
build_flags = ${env.build_flags}
|
build_flags = ${env.build_flags}
|
||||||
-DUSE_HSPI_FOR_EPD
|
-DUSE_HSPI_FOR_EPD
|
||||||
|
@ -242,7 +241,7 @@ monitor_filters =
|
||||||
esp32_exception_decoder
|
esp32_exception_decoder
|
||||||
|
|
||||||
[env:esp32-s2-mini-de]
|
[env:esp32-s2-mini-de]
|
||||||
platform = espressif32@6.5.0
|
platform = espressif32@6.6.0
|
||||||
board = lolin_s2_mini
|
board = lolin_s2_mini
|
||||||
build_flags = ${env:esp32-s2-mini.build_flags}
|
build_flags = ${env:esp32-s2-mini.build_flags}
|
||||||
-DLANG_DE
|
-DLANG_DE
|
||||||
|
@ -250,7 +249,7 @@ monitor_filters =
|
||||||
esp32_exception_decoder
|
esp32_exception_decoder
|
||||||
|
|
||||||
[env:esp32-c3-mini]
|
[env:esp32-c3-mini]
|
||||||
platform = espressif32@6.5.0
|
platform = espressif32@6.6.0
|
||||||
board = lolin_c3_mini
|
board = lolin_c3_mini
|
||||||
build_flags = ${env.build_flags}
|
build_flags = ${env.build_flags}
|
||||||
-DUSE_HSPI_FOR_EPD
|
-DUSE_HSPI_FOR_EPD
|
||||||
|
@ -273,7 +272,7 @@ monitor_filters =
|
||||||
esp32_exception_decoder
|
esp32_exception_decoder
|
||||||
|
|
||||||
[env:esp32-c3-mini-de]
|
[env:esp32-c3-mini-de]
|
||||||
platform = espressif32@6.5.0
|
platform = espressif32@6.6.0
|
||||||
board = lolin_c3_mini
|
board = lolin_c3_mini
|
||||||
build_flags = ${env:esp32-c3-mini.build_flags}
|
build_flags = ${env:esp32-c3-mini.build_flags}
|
||||||
-DLANG_DE
|
-DLANG_DE
|
||||||
|
@ -281,7 +280,7 @@ monitor_filters =
|
||||||
esp32_exception_decoder
|
esp32_exception_decoder
|
||||||
|
|
||||||
[env:opendtufusion-minimal]
|
[env:opendtufusion-minimal]
|
||||||
platform = espressif32@6.5.0
|
platform = espressif32@6.6.0
|
||||||
board = esp32-s3-devkitc-1
|
board = esp32-s3-devkitc-1
|
||||||
upload_protocol = esp-builtin
|
upload_protocol = esp-builtin
|
||||||
build_flags = ${env.build_flags}
|
build_flags = ${env.build_flags}
|
||||||
|
@ -306,19 +305,18 @@ monitor_filters =
|
||||||
esp32_exception_decoder, colorize
|
esp32_exception_decoder, colorize
|
||||||
|
|
||||||
[env:opendtufusion]
|
[env:opendtufusion]
|
||||||
platform = espressif32@6.5.0
|
platform = espressif32@6.6.0
|
||||||
board = esp32-s3-devkitc-1
|
board = esp32-s3-devkitc-1
|
||||||
upload_protocol = esp-builtin
|
upload_protocol = esp-builtin
|
||||||
build_flags = ${env:opendtufusion-minimal.build_flags}
|
build_flags = ${env:opendtufusion-minimal.build_flags}
|
||||||
-DENABLE_MQTT
|
-DENABLE_MQTT
|
||||||
-DPLUGIN_DISPLAY
|
-DPLUGIN_DISPLAY
|
||||||
-DENABLE_HISTORY
|
-DENABLE_HISTORY
|
||||||
-DPLUGIN_ZEROEXPORT
|
|
||||||
monitor_filters =
|
monitor_filters =
|
||||||
esp32_exception_decoder, colorize
|
esp32_exception_decoder, colorize
|
||||||
|
|
||||||
[env:opendtufusion-de]
|
[env:opendtufusion-de]
|
||||||
platform = espressif32@6.5.0
|
platform = espressif32@6.6.0
|
||||||
board = esp32-s3-devkitc-1
|
board = esp32-s3-devkitc-1
|
||||||
upload_protocol = esp-builtin
|
upload_protocol = esp-builtin
|
||||||
build_flags = ${env:opendtufusion.build_flags}
|
build_flags = ${env:opendtufusion.build_flags}
|
||||||
|
@ -326,8 +324,24 @@ build_flags = ${env:opendtufusion.build_flags}
|
||||||
monitor_filters =
|
monitor_filters =
|
||||||
esp32_exception_decoder, colorize
|
esp32_exception_decoder, colorize
|
||||||
|
|
||||||
|
[env:opendtufusion-zero_export]
|
||||||
|
platform = espressif32@6.6.0
|
||||||
|
board = esp32-s3-devkitc-1
|
||||||
|
upload_protocol = esp-builtin
|
||||||
|
build_flags = ${env:opendtufusion.build_flags}
|
||||||
|
-DPLUGIN_ZEROEXPORT
|
||||||
|
monitor_filters =
|
||||||
|
esp32_exception_decoder, colorize
|
||||||
|
|
||||||
|
[env:opendtufusion-zero_export-de]
|
||||||
|
platform = espressif32@6.6.0
|
||||||
|
board = esp32-s3-devkitc-1
|
||||||
|
upload_protocol = esp-builtin
|
||||||
|
build_flags = ${env:opendtufusion-zero_export.build_flags}
|
||||||
|
-DLANG_DE
|
||||||
|
|
||||||
[env:opendtufusion-ethernet]
|
[env:opendtufusion-ethernet]
|
||||||
platform = espressif32@6.5.0
|
platform = espressif32@6.6.0
|
||||||
board = esp32-s3-devkitc-1
|
board = esp32-s3-devkitc-1
|
||||||
upload_protocol = esp-builtin
|
upload_protocol = esp-builtin
|
||||||
build_flags = ${env:opendtufusion-minimal.build_flags}
|
build_flags = ${env:opendtufusion-minimal.build_flags}
|
||||||
|
@ -347,7 +361,7 @@ monitor_filters =
|
||||||
esp32_exception_decoder, colorize
|
esp32_exception_decoder, colorize
|
||||||
|
|
||||||
[env:opendtufusion-ethernet-de]
|
[env:opendtufusion-ethernet-de]
|
||||||
platform = espressif32@6.5.0
|
platform = espressif32@6.6.0
|
||||||
board = esp32-s3-devkitc-1
|
board = esp32-s3-devkitc-1
|
||||||
upload_protocol = esp-builtin
|
upload_protocol = esp-builtin
|
||||||
build_flags = ${env:opendtufusion-ethernet.build_flags}
|
build_flags = ${env:opendtufusion-ethernet.build_flags}
|
||||||
|
|
|
@ -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>
|
||||||
|
@ -98,6 +97,11 @@ class powermeter {
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if defined(ZEROEXPORT_POWERMETER_TIBBER)
|
#if defined(ZEROEXPORT_POWERMETER_TIBBER)
|
||||||
|
/* Anscheinend nutzt bei mir Tibber auch diese Freq.
|
||||||
|
862.75 MHz - keine Verbindung
|
||||||
|
863.00 MHz - geht (standard) jedoch hat Tibber dann Probleme... => 4 & 5 Balken
|
||||||
|
863.25 MHz - geht (ohne Tibber Probleme) => 3 & 4 Balken
|
||||||
|
*/
|
||||||
case zeroExportPowermeterType_t::Tibber:
|
case zeroExportPowermeterType_t::Tibber:
|
||||||
result = getPowermeterWattsTibber(*mLog, group, &power);
|
result = getPowermeterWattsTibber(*mLog, group, &power);
|
||||||
mPreviousTsp += 2000; // Zusätzliche Pause
|
mPreviousTsp += 2000; // Zusätzliche Pause
|
||||||
|
@ -254,7 +258,7 @@ class powermeter {
|
||||||
PubMqttType *mMqtt = nullptr;
|
PubMqttType *mMqtt = nullptr;
|
||||||
JsonObject *mLog;
|
JsonObject *mLog;
|
||||||
|
|
||||||
unsigned long mPreviousTsp = 0;
|
unsigned long mPreviousTsp = millis();
|
||||||
|
|
||||||
float mPowermeterBuffer[ZEROEXPORT_MAX_GROUPS][5] = {0};
|
float mPowermeterBuffer[ZEROEXPORT_MAX_GROUPS][5] = {0};
|
||||||
short mPowermeterBufferPos[ZEROEXPORT_MAX_GROUPS] = {0};
|
short mPowermeterBufferPos[ZEROEXPORT_MAX_GROUPS] = {0};
|
||||||
|
@ -495,16 +499,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);
|
||||||
|
|
|
@ -637,40 +637,28 @@ class ZeroExport {
|
||||||
|
|
||||||
if (obj["path"] == "ctrl" && obj["cmd"] == "zero") {
|
if (obj["path"] == "ctrl" && obj["cmd"] == "zero") {
|
||||||
int8_t topicGroup = getGroupFromTopic(topic.c_str());
|
int8_t topicGroup = getGroupFromTopic(topic.c_str());
|
||||||
if (topicGroup != -1)
|
|
||||||
mLog["g"] = topicGroup;
|
|
||||||
int8_t topicInverter = getInverterFromTopic(topic.c_str());
|
int8_t topicInverter = getInverterFromTopic(topic.c_str());
|
||||||
if (topicInverter == -1)
|
|
||||||
mLog["i"] = topicInverter;
|
if (topicGroup != -1) mLog["g"] = topicGroup;
|
||||||
|
if (topicInverter == -1) mLog["i"] = topicInverter;
|
||||||
|
|
||||||
|
mLog["k"] = topic;
|
||||||
|
|
||||||
// "topic":"ctrl/zero/enabled"
|
// "topic":"ctrl/zero/enabled"
|
||||||
if (topic.indexOf("ctrl/zero/enabled") != -1) {
|
if (topic.indexOf("ctrl/zero/enabled") != -1) mCfg->enabled = mLog["v"] = (bool)obj["val"];
|
||||||
mCfg->enabled = (bool)obj["val"];
|
|
||||||
mLog["k"] = "ctrl/zero/enabled";
|
|
||||||
mLog["v"] = mCfg->enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
// "topic":"ctrl/zero/sleep"
|
// "topic":"ctrl/zero/sleep"
|
||||||
if (topic.indexOf("ctrl/zero/sleep") != -1) {
|
else if (topic.indexOf("ctrl/zero/sleep") != -1) mCfg->sleep = mLog["v"] = (bool)obj["val"];
|
||||||
mCfg->sleep = (bool)obj["val"];
|
|
||||||
mLog["k"] = "ctrl/zero/sleep";
|
else if ((topicGroup >= 0) && (topicGroup < ZEROEXPORT_MAX_GROUPS))
|
||||||
mLog["v"] = mCfg->sleep;
|
{
|
||||||
}
|
String stopicGroup = String(topicGroup);
|
||||||
|
|
||||||
if ((topicGroup >= 0) && (topicGroup < ZEROEXPORT_MAX_GROUPS)) {
|
|
||||||
// "topic":"ctrl/zero/groups/+/enabled"
|
// "topic":"ctrl/zero/groups/+/enabled"
|
||||||
if (topic.indexOf("ctrl/zero/groups/" + String(topicGroup) + "/enabled") != -1) {
|
if (topic.endsWith("/enabled")) mCfg->groups[topicGroup].enabled = mLog["v"] = (bool)obj["val"];
|
||||||
mCfg->groups[topicGroup].enabled = (bool)obj["val"];
|
|
||||||
mLog["k"] = "ctrl/zero/groups/" + String(topicGroup) + "/enabled";
|
|
||||||
mLog["v"] = mCfg->groups[topicGroup].enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
// "topic":"ctrl/zero/groups/+/sleep"
|
// "topic":"ctrl/zero/groups/+/sleep"
|
||||||
if (topic.indexOf("ctrl/zero/groups/" + String(topicGroup) + "/sleep") != -1) {
|
else if (topic.endsWith("/sleep")) mCfg->groups[topicGroup].sleep = mLog["v"] = (bool)obj["val"];
|
||||||
mCfg->groups[topicGroup].sleep = (bool)obj["val"];
|
|
||||||
mLog["k"] = "ctrl/zero/groups/" + String(topicGroup) + "/sleep";
|
|
||||||
mLog["v"] = mCfg->groups[topicGroup].sleep;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Auf Eis gelegt, dafür 2 Gruppen mehr
|
// Auf Eis gelegt, dafür 2 Gruppen mehr
|
||||||
// 0.8.103008.2
|
// 0.8.103008.2
|
||||||
|
@ -695,55 +683,37 @@ class ZeroExport {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// "topic":"ctrl/zero/groups/+/battery/switch"
|
// "topic":"ctrl/zero/groups/+/battery/switch"
|
||||||
if (topic.indexOf("ctrl/zero/groups/" + String(topicGroup) + "/battery/switch") != -1) {
|
else if (topic.endsWith("/battery/switch")) mCfg->groups[topicGroup].battSwitch = mLog["v"] = (bool)obj["val"];
|
||||||
mCfg->groups[topicGroup].battSwitch = (bool)obj["val"];
|
|
||||||
mLog["k"] = "ctrl/zero/groups/" + String(topicGroup) + "/battery/switch";
|
|
||||||
mLog["v"] = mCfg->groups[topicGroup].battSwitch;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
else if (topic.indexOf("/advanced/") != -1)
|
||||||
|
{
|
||||||
// "topic":"ctrl/zero/groups/+/advanced/setPoint"
|
// "topic":"ctrl/zero/groups/+/advanced/setPoint"
|
||||||
if (topic.indexOf("ctrl/zero/groups/" + String(topicGroup) + "/advanced/setPoint") != -1) {
|
if (topic.endsWith("/setPoint")) mCfg->groups[topicGroup].setPoint = mLog["v"] = (int16_t)obj["val"];
|
||||||
mCfg->groups[topicGroup].setPoint = (int16_t)obj["val"];
|
|
||||||
mLog["k"] = "ctrl/zero/groups/" + String(topicGroup) + "/advanced/setPoint";
|
|
||||||
mLog["v"] = mCfg->groups[topicGroup].setPoint;
|
|
||||||
}
|
|
||||||
|
|
||||||
// "topic":"ctrl/zero/groups/+/advanced/powerTolerance"
|
// "topic":"ctrl/zero/groups/+/advanced/powerTolerance"
|
||||||
if (topic.indexOf("ctrl/zero/groups/" + String(topicGroup) + "/advanced/powerTolerance") != -1) {
|
else if (topic.endsWith("/powerTolerance")) mCfg->groups[topicGroup].powerTolerance = mLog["v"] = (uint8_t)obj["val"];
|
||||||
mCfg->groups[topicGroup].powerTolerance = (uint8_t)obj["val"];
|
|
||||||
mLog["k"] = "ctrl/zero/groups/" + String(topicGroup) + "/advanced/powerTolerance";
|
|
||||||
mLog["v"] = mCfg->groups[topicGroup].powerTolerance;
|
|
||||||
}
|
|
||||||
|
|
||||||
// "topic":"ctrl/zero/groups/+/advanced/powerMax"
|
// "topic":"ctrl/zero/groups/+/advanced/powerMax"
|
||||||
if (topic.indexOf("ctrl/zero/groups/" + String(topicGroup) + "/advanced/powerMax") != -1) {
|
else if (topic.endsWith("/powerMax")) mCfg->groups[topicGroup].powerMax = mLog["v"] = (uint16_t)obj["val"];
|
||||||
mCfg->groups[topicGroup].powerMax = (uint16_t)obj["val"];
|
|
||||||
mLog["k"] = "ctrl/zero/groups/" + String(topicGroup) + "/advanced/powerMax";
|
|
||||||
mLog["v"] = mCfg->groups[topicGroup].powerMax;
|
|
||||||
}
|
}
|
||||||
|
else if (topic.indexOf("/inverter/") != -1)
|
||||||
if ((topicInverter >= 0) && (topicInverter < ZEROEXPORT_GROUP_MAX_INVERTERS)) {
|
{
|
||||||
|
if ((topicInverter >= 0) && (topicInverter < ZEROEXPORT_GROUP_MAX_INVERTERS))
|
||||||
|
{
|
||||||
// "topic":"ctrl/zero/groups/+/inverter/+/enabled"
|
// "topic":"ctrl/zero/groups/+/inverter/+/enabled"
|
||||||
if (topic.indexOf("ctrl/zero/groups/" + String(topicGroup) + "/inverter/" + String(topicInverter) + "/enabled") != -1) {
|
if (topic.endsWith("/enabled")) mCfg->groups[topicGroup].inverters[topicInverter].enabled = mLog["v"] = (bool)obj["val"];
|
||||||
mCfg->groups[topicGroup].inverters[topicInverter].enabled = (bool)obj["val"];
|
|
||||||
mLog["k"] = "ctrl/zero/groups/" + String(topicGroup) + "/inverter/" + String(topicInverter) + "/enabled";
|
|
||||||
mLog["v"] = mCfg->groups[topicGroup].inverters[topicInverter].enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
// "topic":"ctrl/zero/groups/+/inverter/+/powerMin"
|
// "topic":"ctrl/zero/groups/+/inverter/+/powerMin"
|
||||||
if (topic.indexOf("ctrl/zero/groups/" + String(topicGroup) + "/inverter/" + String(topicInverter) + "/powerMin") != -1) {
|
else if (topic.endsWith("/powerMin")) mCfg->groups[topicGroup].inverters[topicInverter].powerMin = mLog["v"] = (uint16_t)obj["val"];
|
||||||
mCfg->groups[topicGroup].inverters[topicInverter].powerMin = (uint16_t)obj["val"];
|
|
||||||
mLog["k"] = "ctrl/zero/groups/" + String(topicGroup) + "/inverter/" + String(topicInverter) + "/powerMin";
|
|
||||||
mLog["v"] = mCfg->groups[topicGroup].inverters[topicInverter].powerMin;
|
|
||||||
}
|
|
||||||
|
|
||||||
// "topic":"ctrl/zero/groups/+/inverter/+/powerMax"
|
// "topic":"ctrl/zero/groups/+/inverter/+/powerMax"
|
||||||
if (topic.indexOf("ctrl/zero/groups/" + String(topicGroup) + "/inverter/" + String(topicInverter) + "/powerMax") != -1) {
|
else if (topic.endsWith("/powerMax")) mCfg->groups[topicGroup].inverters[topicInverter].powerMax = mLog["v"] = (uint16_t)obj["val"];
|
||||||
mCfg->groups[topicGroup].inverters[topicInverter].powerMax = (uint16_t)obj["val"];
|
else mLog["k"] = "error";
|
||||||
mLog["k"] = "ctrl/zero/groups/" + String(topicGroup) + "/inverter/" + String(topicInverter) + "/powerMax";
|
|
||||||
mLog["v"] = mCfg->groups[topicGroup].inverters[topicInverter].powerMax;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
mLog["k"] = "error";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -791,6 +761,7 @@ class ZeroExport {
|
||||||
while (*pGroupSection != '/' && digitsCopied < 2) strGroup[digitsCopied++] = *pGroupSection++;
|
while (*pGroupSection != '/' && digitsCopied < 2) strGroup[digitsCopied++] = *pGroupSection++;
|
||||||
strGroup[digitsCopied] = '\0';
|
strGroup[digitsCopied] = '\0';
|
||||||
int8_t group = atoi(strGroup);
|
int8_t group = atoi(strGroup);
|
||||||
|
mLog["getGroupFromTopic"] = group;
|
||||||
return group;
|
return group;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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