-
Notifications
You must be signed in to change notification settings - Fork 184
Filtering
A notification can be filtered (or supressed) using a custom function.
An optional filter
declaration in our configuration file, defines the name of a function we provide. The function is provided in an other file, as specified by the functions
directive in the configuration file.
filter = owntracks_filter()
This specifies that when a message for the defined topic owntracks/jane/phone
is processed, our function owntracks_filter()
should be invoked to parse that. The filter function should return True
if the message should be suppressed, or False
if the message should be processed. (As usual, topic names may contain MQTT wildcards.)
The function we define to do that is:
def owntracks_filter(topic, message):
return message.find('event') == -1
This filter will suppress any messages that do not contain the event
token. This filter goes in the file specified by the functions directive
.