Make sure we dont use more than 5 peaks if defined higher

This commit is contained in:
Gunnar Skjold
2022-10-06 17:20:13 +02:00
parent b420a0e6f4
commit 06ec97b42a
2 changed files with 6 additions and 7 deletions

View File

@@ -62,7 +62,7 @@ bool HomeAssistantMqttHandler::publish(AmsData* data, AmsData* previousState, En
if(peakCount > 5) peakCount = 5;
for(uint8_t i = 1; i <= peakCount; i++) {
if(!peaks.isEmpty()) peaks += ",";
peaks += String(ea->getPeak(i));
peaks += String(ea->getPeak(i), 2);
}
snprintf_P(json, BufferSize, REALTIME_JSON,
ea->getMonthMax(),