Browse Source

0.6.1

* only publish new inverter data #826
pull/854/head
lumapu 2 years ago
parent
commit
db8b17502e
  1. 1
      src/CHANGES.md
  2. 10
      src/publisher/pubMqtt.h

1
src/CHANGES.md

@ -2,3 +2,4 @@
## 0.6.1 - 2023-04-01
* merge LED fix - LED1 shows MqTT state, LED configureable active high/low #839
* only publish new inverter data #826

10
src/publisher/pubMqtt.h

@ -49,6 +49,7 @@ class PubMqtt {
mTxCnt = 0;
mSubscriptionCb = NULL;
memset(mLastIvState, MQTT_STATUS_NOT_AVAIL_NOT_PROD, MAX_NUM_INVERTERS);
memset(mIvLastRTRpub, 0, MAX_NUM_INVERTERS * 4);
mLastAnyAvail = false;
}
@ -522,7 +523,13 @@ class PubMqtt {
void sendData(Inverter<> *iv, uint8_t curInfoCmd) {
record_t<> *rec = iv->getRecordStruct(curInfoCmd);
if (iv->getLastTs(rec) > 0) {
uint32_t lastTs = iv->getLastTs(rec);
bool pubData = (lastTs > 0);
if (curInfoCmd == RealTimeRunData_Debug)
pubData &= (lastTs != mIvLastRTRpub[iv->id]);
if (pubData) {
mIvLastRTRpub[iv->id] = lastTs;
for (uint8_t i = 0; i < rec->length; i++) {
bool retained = false;
if (curInfoCmd == RealTimeRunData_Debug) {
@ -653,6 +660,7 @@ class PubMqtt {
subscriptionCb mSubscriptionCb;
bool mLastAnyAvail;
uint8_t mLastIvState[MAX_NUM_INVERTERS];
uint32_t mIvLastRTRpub[MAX_NUM_INVERTERS];
uint16_t mIntervalTimeout;
// last will topic and payload must be available trough lifetime of 'espMqttClient'

Loading…
Cancel
Save