Added realtime day use to MQTT

This commit is contained in:
Gunnar Skjold 2022-03-17 18:51:13 +01:00
parent a92524eaf8
commit beafcd300b
8 changed files with 9 additions and 5 deletions

View File

@ -202,10 +202,6 @@ uint8_t EnergyAccounting::getCurrentThreshold() {
return config->thresholds[currentThresholdIdx];
}
uint8_t EnergyAccounting::getCurrentHour() {
return currentHour;
}
float EnergyAccounting::getMonthMax() {
return data.maxHour / 100.0;
}

View File

@ -35,7 +35,6 @@ public:
float getMonthMax();
uint8_t getCurrentThreshold();
uint8_t getCurrentHour();
EnergyAccountingData getData();
void setData(EnergyAccountingData&);

View File

@ -23,6 +23,7 @@ bool JsonMqttHandler::publish(AmsData* data, AmsData* previousState, EnergyAccou
hw->getTemperature(),
data->getActiveImportPower(),
ea->getUseThisHour(),
ea->getUseToday(),
ea->getCurrentThreshold()
);
return mqtt->publish(topic, json);
@ -49,6 +50,7 @@ bool JsonMqttHandler::publish(AmsData* data, AmsData* previousState, EnergyAccou
data->getL2Voltage(),
data->getL3Voltage(),
ea->getUseThisHour(),
ea->getUseToday(),
ea->getCurrentThreshold()
);
return mqtt->publish(topic, json);
@ -80,6 +82,7 @@ bool JsonMqttHandler::publish(AmsData* data, AmsData* previousState, EnergyAccou
data->getReactiveExportCounter(),
data->getMeterTimestamp(),
ea->getUseThisHour(),
ea->getUseToday(),
ea->getCurrentThreshold()
);
return mqtt->publish(topic, json);
@ -115,6 +118,7 @@ bool JsonMqttHandler::publish(AmsData* data, AmsData* previousState, EnergyAccou
data->getReactiveExportCounter(),
data->getMeterTimestamp(),
ea->getUseThisHour(),
ea->getUseToday(),
ea->getCurrentThreshold()
);
return mqtt->publish(topic, json);

View File

@ -73,6 +73,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);
return true;
}

View File

@ -11,6 +11,7 @@
},
"realtime" : {
"h" : %.2f,
"d" : %.1f,
"t" : %d
}
}

View File

@ -23,6 +23,7 @@
},
"realtime" : {
"h" : %.2f,
"d" : %.1f,
"t" : %d
}
}

View File

@ -28,6 +28,7 @@
},
"realtime" : {
"h" : %.2f,
"d" : %.1f,
"t" : %d
}
}

View File

@ -32,6 +32,7 @@
},
"realtime" : {
"h" : %.2f,
"d" : %.1f,
"t" : %d
}
}