avoid duplicate definition sent when writable messages are included
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
* fix potentially unnecessary arbitration start for non-enhanced proto
|
||||
* fix smaller issues in KNX integration
|
||||
* fix numeric replacement+infinite and float min/max values in MQTT JSON payload format
|
||||
* fix duplicate definition sent for same message when writable messages are included in MQTT integration
|
||||
|
||||
## Features
|
||||
* add support for setting visual ping, IP gateway, MAC from ID, and variant to ebuspicloader
|
||||
|
||||
@@ -961,6 +961,7 @@ void MqttHandler::run() {
|
||||
ostringstream ostr;
|
||||
deque<Message*> messages;
|
||||
m_messages->findAll("", "", m_levels, false, true, true, true, true, true, 0, 0, false, &messages);
|
||||
bool includeActiveWrite = FileReader::matches("w", filterDirection, true, true);
|
||||
for (const auto& message : messages) {
|
||||
bool checkPollAdjust = false;
|
||||
if (filterSeen > 0) {
|
||||
@@ -1011,7 +1012,13 @@ void MqttHandler::run() {
|
||||
if (filterPriority > 0 && (message->getPollPriority() == 0 || message->getPollPriority() > filterPriority)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (includeActiveWrite && !message->isWrite()) {
|
||||
// check for existance of write message with same name
|
||||
Message* write = m_messages->find(message->getCircuit(), message->getName(), "", true);
|
||||
if (write) {
|
||||
continue; // avoid sending definition of read AND write message with the same key
|
||||
}
|
||||
}
|
||||
StringReplacers msgValues = m_replacers; // need a copy here as the contents are manipulated
|
||||
msgValues.set("circuit", message->getCircuit());
|
||||
msgValues.set("name", message->getName());
|
||||
|
||||
Reference in New Issue
Block a user