Documentation vs. code: Clarify and/or fix logic of "filter" function
#637 opened on Apr 14, 2023
Description
Dear JP and Ben,
this is an important issue. Maybe you can find a few minutes to look into it.
With kind regards, Andreas.
Introduction
I am bringing this up, because @sevmonster shared their experiences when using mqttwarn's filter feature, and because, after comparing it with the documentation, I discovered an anomaly between mqttwarn's documentation and implementation.
In its current incarnation, should it not be stopping all messages since it always returns
False? Why are messages getting through? Am I misunderstanding the filter function usage?I did individually test the logic in the conditional with dummy data so the rest of it should be sound and do what I want, with the understanding that
Trueis a passing filter andFalsefails.-- https://github.com/jpmens/mqttwarn/issues/632#issuecomment-1505310506
Documentation
While working on GH-635, I am now at the spot where the documentation states:
A function called from the
filterproperty in a topic section needs to returnFalseto stop the outbound notification.
Observations
However, while working on GH-632 and GH-635, we discovered that the opposite might be the case. Both code examples actually demonstrate that you need to return True to stop the outbound notification.