mqtt-tools/mqttwarn

Documentation vs. code: Clarify and/or fix logic of "filter" function

Open

#637 opened on Apr 14, 2023

View on GitHub
 (3 comments) (3 reactions) (0 assignees)Python (930 stars) (184 forks)batch import
bughelp wantedquality

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 True is a passing filter and False fails.

-- 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 filter property in a topic section needs to return False to stop the outbound notification.

-- Custom functions » Filter functions

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.

Contributor guide