Browse Source

DEV Powermeter MQTT (json)

pull/1701/head
Patrick Amrhein 8 months ago
parent
commit
96492e4e6e
  1. 2
      src/defines.h
  2. 11
      src/plugins/zeroExport/powermeter.h
  3. 1
      src/web/html/setup.html

2
src/defines.h

@ -13,7 +13,7 @@
//------------------------------------- //-------------------------------------
#define VERSION_MAJOR 0 #define VERSION_MAJOR 0
#define VERSION_MINOR 8 #define VERSION_MINOR 8
#define VERSION_PATCH 125 #define VERSION_PATCH 1250001
//------------------------------------- //-------------------------------------
typedef struct { typedef struct {
uint8_t ch; uint8_t ch;

11
src/plugins/zeroExport/powermeter.h

@ -220,13 +220,13 @@ class powermeter {
float power = 0.0; float power = 0.0;
DynamicJsonDocument datajson(512); DynamicJsonDocument datajson(512);
if (!deserializeJson(datajson, obj["val"])) if (!deserializeJson(datajson, String(obj["val"])))
{ {
switch (mCfg->groups[group].pm_target) { switch (mCfg->groups[group].pm_target) {
case 0: power = datajson["a_act_power"]; break; case 0: power = (float)datajson["total_act_power"]; break;
case 1: power = datajson["b_act_power"]; break; case 1: power = (float)datajson["a_act_power"]; break;
case 2: power = datajson["c_act_power"]; break; case 2: power = (float)datajson["b_act_power"]; break;
case 3: power = datajson["total_act_power"]; break; case 3: power = (float)datajson["c_act_power"]; break;
} }
} else { } else {
power = (float)obj["val"]; power = (float)obj["val"];
@ -236,6 +236,7 @@ class powermeter {
mCfg->groups[group].power = power; // TODO: join two sites together (PM & MQTT) mCfg->groups[group].power = power; // TODO: join two sites together (PM & MQTT)
// MQTT - Powermeter // MQTT - Powermeter
DPRINTLN(DBG_INFO, String("ze: mqtt powermeter") + String(power));
/// BUG: 001 Anfang - Dieser Teil ist deaktiviert weil er zu abstürzen der DTU führt /// BUG: 001 Anfang - Dieser Teil ist deaktiviert weil er zu abstürzen der DTU führt
// if (mCfg->debug) { // if (mCfg->debug) {
// if (mMqtt->isConnected()) { // if (mMqtt->isConnected()) {

1
src/web/html/setup.html

@ -1671,7 +1671,6 @@
} }
else if(value == "Mqtt") { else if(value == "Mqtt") {
divsToHide.childNodes[1].style.display = 'none'; divsToHide.childNodes[1].style.display = 'none';
divsToHide.childNodes[2].style.display = 'none';
divsToHide.childNodes[4].style.display = 'none'; divsToHide.childNodes[4].style.display = 'none';
divsToHide.childNodes[5].style.display = 'none'; divsToHide.childNodes[5].style.display = 'none';
divsToHide.childNodes[6].style.display = 'none'; divsToHide.childNodes[6].style.display = 'none';

Loading…
Cancel
Save