Energy accounting

This commit is contained in:
Gunnar Skjold
2022-01-29 19:27:48 +01:00
parent 8c69f9a738
commit 77ce5d8e90
25 changed files with 483 additions and 342 deletions

View File

@@ -2,7 +2,7 @@
#include "hexutils.h"
#include "Uptime.h"
bool RawMqttHandler::publish(AmsData* data, AmsData* meterState) {
bool RawMqttHandler::publish(AmsData* data, AmsData* meterState, EnergyAccounting* ea) {
if(topic.isEmpty() || !mqtt->connected())
return false;
@@ -71,6 +71,8 @@ bool RawMqttHandler::publish(AmsData* data, AmsData* meterState) {
mqtt->publish(topic + "/meter/import/active", String(data->getActiveImportPower()));
}
}
mqtt->publish(topic + "/realtime/import/hour", String(ea->getUseThisHour(), 3));
mqtt->publish(topic + "/realtime/import/threshold", String(ea->getCurrentThreshold(), 10), true, 0);
return true;
}