mqtt-tools/mqttwarn

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

Open

#637 建立於 2023年4月14日

在 GitHub 查看
 (3 留言) (3 反應) (0 負責人)Python (930 star) (184 fork)batch import
bughelp wantedquality

描述

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.

貢獻者指南