mqtt-tools/mqttwarn

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

Open

#637 创建于 2023年4月14日

在 GitHub 查看
 (5 评论) (3 反应) (0 负责人)Python (184 fork)batch import
bughelp wantedquality

仓库指标

Star
 (930 star)
PR 合并指标
 (30 天内没有已合并 PR)

描述

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.

贡献者指南