From 191d9fa562c3ebe8d998a4a5729ea495e48c09bf Mon Sep 17 00:00:00 2001 From: Gunnar Skjold Date: Fri, 1 Apr 2022 20:39:22 +0200 Subject: [PATCH] Added month max to mqtt --- src/mqtt/JsonMqttHandler.cpp | 12 ++++++++---- src/mqtt/RawMqttHandler.cpp | 1 + web/json1.json | 3 ++- web/json2.json | 3 ++- web/json3.json | 3 ++- web/json4.json | 3 ++- 6 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/mqtt/JsonMqttHandler.cpp b/src/mqtt/JsonMqttHandler.cpp index 590953f4..43e47fcc 100644 --- a/src/mqtt/JsonMqttHandler.cpp +++ b/src/mqtt/JsonMqttHandler.cpp @@ -24,7 +24,8 @@ bool JsonMqttHandler::publish(AmsData* data, AmsData* previousState, EnergyAccou data->getActiveImportPower(), ea->getUseThisHour(), ea->getUseToday(), - ea->getCurrentThreshold() + ea->getCurrentThreshold(), + ea->getMonthMax() ); return mqtt->publish(topic, json); } else if(data->getListType() == 2) { @@ -51,7 +52,8 @@ bool JsonMqttHandler::publish(AmsData* data, AmsData* previousState, EnergyAccou data->getL3Voltage(), ea->getUseThisHour(), ea->getUseToday(), - ea->getCurrentThreshold() + ea->getCurrentThreshold(), + ea->getMonthMax() ); return mqtt->publish(topic, json); } else if(data->getListType() == 3) { @@ -83,7 +85,8 @@ bool JsonMqttHandler::publish(AmsData* data, AmsData* previousState, EnergyAccou data->getMeterTimestamp(), ea->getUseThisHour(), ea->getUseToday(), - ea->getCurrentThreshold() + ea->getCurrentThreshold(), + ea->getMonthMax() ); return mqtt->publish(topic, json); } else if(data->getListType() == 4) { @@ -119,7 +122,8 @@ bool JsonMqttHandler::publish(AmsData* data, AmsData* previousState, EnergyAccou data->getMeterTimestamp(), ea->getUseThisHour(), ea->getUseToday(), - ea->getCurrentThreshold() + ea->getCurrentThreshold(), + ea->getMonthMax() ); return mqtt->publish(topic, json); } diff --git a/src/mqtt/RawMqttHandler.cpp b/src/mqtt/RawMqttHandler.cpp index e79bcc1a..d906f8a8 100644 --- a/src/mqtt/RawMqttHandler.cpp +++ b/src/mqtt/RawMqttHandler.cpp @@ -75,6 +75,7 @@ bool RawMqttHandler::publish(AmsData* data, AmsData* meterState, EnergyAccountin mqtt->publish(topic + "/realtime/import/hour", String(ea->getUseThisHour(), 3)); mqtt->publish(topic + "/realtime/import/day", String(ea->getUseToday(), 2)); mqtt->publish(topic + "/realtime/import/threshold", String(ea->getCurrentThreshold(), 10), true, 0); + mqtt->publish(topic + "/realtime/import/monthmax", String(ea->getMonthMax(), 3), true, 0); return true; } diff --git a/web/json1.json b/web/json1.json index 26c77431..b7dd9495 100644 --- a/web/json1.json +++ b/web/json1.json @@ -12,6 +12,7 @@ "realtime" : { "h" : %.2f, "d" : %.1f, - "t" : %d + "t" : %d, + "x" : %.2f } } diff --git a/web/json2.json b/web/json2.json index 40ee037b..5a5c0014 100644 --- a/web/json2.json +++ b/web/json2.json @@ -24,6 +24,7 @@ "realtime" : { "h" : %.2f, "d" : %.1f, - "t" : %d + "t" : %d, + "x" : %.2f } } diff --git a/web/json3.json b/web/json3.json index 5e82251d..48701fe9 100644 --- a/web/json3.json +++ b/web/json3.json @@ -29,6 +29,7 @@ "realtime" : { "h" : %.2f, "d" : %.1f, - "t" : %d + "t" : %d, + "x" : %.2f } } diff --git a/web/json4.json b/web/json4.json index 0e57e2b4..3e0dc904 100644 --- a/web/json4.json +++ b/web/json4.json @@ -33,6 +33,7 @@ "realtime" : { "h" : %.2f, "d" : %.1f, - "t" : %d + "t" : %d, + "x" : %.2f } }