skip seen for active write messages and publish read pendant for those

This commit is contained in:
John
2022-01-30 14:51:44 +01:00
parent b7106e89a9
commit b3f474e3b8
3 changed files with 12 additions and 3 deletions
+1 -1
View File
@@ -90,7 +90,7 @@
# - "$" matches the end of the input, e.g. "al$" matches "hal" but not "all".
# - "*" matches a single arbitrary length wildcard part in the middle, e.g. "^a*l$" matches "all" but not "always".
# include only messages having data sent at least once.
# include only messages having data sent at least once (only checked for passive or read messages, not for active write).
# HA integration: filtering only seen messages to avoid unnecessary "pollution"
filter-seen = 1
# include only messages having a priority less than or equal to the specified value.
+1 -1
View File
@@ -84,7 +84,7 @@
# - "$" matches the end of the input, e.g. "al$" matches "hal" but not "all".
# - "*" matches a single arbitrary length wildcard part in the middle, e.g. "^a*l$" matches "all" but not "always".
# include only messages having data sent at least once.
# include only messages having data sent at least once (only checked for passive or read messages, not for active write).
filter-seen = 1
# include only messages having a priority less than or equal to the specified value.
#filter-priority =
+10 -1
View File
@@ -1274,7 +1274,10 @@ void MqttHandler::run() {
for (const auto& message : messages) {
if (filterSeen) {
if (message->getLastUpdateTime()==0) {
continue; // no data ever
if (message->isPassive() || !message->isWrite()) {
// only wait for data on passive or read messages
continue; // no data ever
}
}
if (message->getDataHandlerState()==1) {
// already seen in the past, check for poll prio update
@@ -1425,6 +1428,12 @@ void MqttHandler::run() {
if (filterSeen && message->getLastUpdateTime()>message->getCreateTime()) {
// ensure data is published as well
m_updatedMessages[message->getKey()]++;
} else if (filterSeen && direction=="w") {
// publish data for read pendant of write message
Message* read = m_messages->find(message->getCircuit(), message->getName(), "", true);
if (read && read->getLastUpdateTime()>0) {
m_updatedMessages[read->getKey()]++;
}
}
}
time(&m_definitionsSince);