Increase accumulated values to 3 decimals

This commit is contained in:
Gunnar Skjold 2022-01-03 08:41:58 +01:00
parent c1d4ba772e
commit 6d12d7120c
4 changed files with 13 additions and 13 deletions

View File

@ -15,10 +15,10 @@ bool RawMqttHandler::publish(AmsData* data, AmsData* meterState) {
mqtt->publish(topic + "/meter/id", data->getMeterId(), true, 0);
mqtt->publish(topic + "/meter/type", data->getMeterModel(), true, 0);
mqtt->publish(topic + "/meter/clock", String(data->getMeterTimestamp()));
mqtt->publish(topic + "/meter/import/reactive/accumulated", String(data->getReactiveImportCounter(), 2), true, 0);
mqtt->publish(topic + "/meter/import/active/accumulated", String(data->getActiveImportCounter(), 2), true, 0);
mqtt->publish(topic + "/meter/export/reactive/accumulated", String(data->getReactiveExportCounter(), 2), true, 0);
mqtt->publish(topic + "/meter/export/active/accumulated", String(data->getActiveExportCounter(), 2), true, 0);
mqtt->publish(topic + "/meter/import/reactive/accumulated", String(data->getReactiveImportCounter(), 3), true, 0);
mqtt->publish(topic + "/meter/import/active/accumulated", String(data->getActiveImportCounter(), 3), true, 0);
mqtt->publish(topic + "/meter/export/reactive/accumulated", String(data->getReactiveExportCounter(), 3), true, 0);
mqtt->publish(topic + "/meter/export/active/accumulated", String(data->getActiveExportCounter(), 3), true, 0);
if(full || meterState->getPowerFactor() != data->getPowerFactor()) {
mqtt->publish(topic + "/meter/powerfactor", String(data->getPowerFactor(), 2));
}

View File

@ -747,7 +747,7 @@ void AmsWebServer::dataJson() {
if(eapi != NULL && strlen(eapi->getToken()) > 0)
price = eapi->getValueForHour(0);
char json[340];
char json[384];
snprintf_P(json, sizeof(json), DATA_JSON,
maxPwr == 0 ? meterState->isThreePhase() ? 20000 : 10000 : maxPwr,
meterConfig->productionCapacity,

View File

@ -6,10 +6,10 @@
"e" : %d,
"ri" : %d,
"re" : %d,
"ic" : %.2f,
"ec" : %.2f,
"ric" : %.2f,
"rec" : %.2f,
"ic" : %.3f,
"ec" : %.3f,
"ric" : %.3f,
"rec" : %.3f,
"u1" : %.2f,
"u2" : %.2f,
"u3" : %.2f,

View File

@ -20,10 +20,10 @@
"U1" : %.2f,
"U2" : %.2f,
"U3" : %.2f,
"tPI" : %.2f,
"tPO" : %.2f,
"tQI" : %.2f,
"tQO" : %.2f,
"tPI" : %.3f,
"tPO" : %.3f,
"tQI" : %.3f,
"tQO" : %.3f,
"rtc" : %lu
}
}