Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [mosquitto-dev] mqttwarn filter

Hi Edwin,

this list is for mosquitto - not mqttwarn.

You may want to ask you question on the mqttwarn issue list - https://github.com/jpmens/mqttwarn/issues

Nick


On 4 April 2014 20:12, Edwin de Graaf <egraaf@xxxxxxxxxx> wrote:
I could not find a better place to ask my question ... Hope you don't mind me here.

I am trying to use mqttwarn with owntracks to generate an alert when I leave work, so I can send my wife a message. So I have created an entry in the mqttwarn.ini like so:

[owntracks/egraaf/werkfoon]
targets = log:info, pushover:wife
filter = OwntracksFilter()
datamap = OwnTracksTopic2Data()
format = {username}: {event} => {desc}

The datamap is from the mqttwarn README example, and it works fine. The filter is something I cobbled together:

def OwntracksFilter(topic, message):
    data = "">items())
    if data['desc'] == "Work" and data['event'] == "leave":
        return False
    return True

The filter raises a Python exception, and I don't know why
In the mqttwarn log:
Cannot invoke filter function OwntracksFilter defined in owntracks/egraaf/werkfoon: 'desc'

I have no experience with Python, so I am probably missing something simple, but I would love some help here. The Python file with my own functions loads fine, and I can call the filter function with a json formatted message without errors.
_______________________________________________
mosquitto-dev mailing list
mosquitto-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/mosquitto-dev


Back to the top