mirror of
https://github.com/lumapu/ahoy.git
synced 2025-06-07 05:01:39 +02:00
parent
7050a34868
commit
db8b17502e
2 changed files with 10 additions and 1 deletions
|
@ -2,3 +2,4 @@
|
||||||
|
|
||||||
## 0.6.1 - 2023-04-01
|
## 0.6.1 - 2023-04-01
|
||||||
* merge LED fix - LED1 shows MqTT state, LED configureable active high/low #839
|
* merge LED fix - LED1 shows MqTT state, LED configureable active high/low #839
|
||||||
|
* only publish new inverter data #826
|
||||||
|
|
|
@ -49,6 +49,7 @@ class PubMqtt {
|
||||||
mTxCnt = 0;
|
mTxCnt = 0;
|
||||||
mSubscriptionCb = NULL;
|
mSubscriptionCb = NULL;
|
||||||
memset(mLastIvState, MQTT_STATUS_NOT_AVAIL_NOT_PROD, MAX_NUM_INVERTERS);
|
memset(mLastIvState, MQTT_STATUS_NOT_AVAIL_NOT_PROD, MAX_NUM_INVERTERS);
|
||||||
|
memset(mIvLastRTRpub, 0, MAX_NUM_INVERTERS * 4);
|
||||||
mLastAnyAvail = false;
|
mLastAnyAvail = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -522,7 +523,13 @@ class PubMqtt {
|
||||||
void sendData(Inverter<> *iv, uint8_t curInfoCmd) {
|
void sendData(Inverter<> *iv, uint8_t curInfoCmd) {
|
||||||
record_t<> *rec = iv->getRecordStruct(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++) {
|
for (uint8_t i = 0; i < rec->length; i++) {
|
||||||
bool retained = false;
|
bool retained = false;
|
||||||
if (curInfoCmd == RealTimeRunData_Debug) {
|
if (curInfoCmd == RealTimeRunData_Debug) {
|
||||||
|
@ -653,6 +660,7 @@ class PubMqtt {
|
||||||
subscriptionCb mSubscriptionCb;
|
subscriptionCb mSubscriptionCb;
|
||||||
bool mLastAnyAvail;
|
bool mLastAnyAvail;
|
||||||
uint8_t mLastIvState[MAX_NUM_INVERTERS];
|
uint8_t mLastIvState[MAX_NUM_INVERTERS];
|
||||||
|
uint32_t mIvLastRTRpub[MAX_NUM_INVERTERS];
|
||||||
uint16_t mIntervalTimeout;
|
uint16_t mIntervalTimeout;
|
||||||
|
|
||||||
// last will topic and payload must be available trough lifetime of 'espMqttClient'
|
// last will topic and payload must be available trough lifetime of 'espMqttClient'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue