note; I have all my scripts setup so that the lwt (last will and testament) publishes 'offline' if the scripts die.
Last active
August 29, 2015 13:57
-
-
Save matbor/9657897 to your computer and use it in GitHub Desktop.
Last Will and Testament Notification Function for mqttwarn. https://github.com/jpmens/mqttwarn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################################ | |
##### Last Will and Testament Notification Function ##### | |
################################################################ | |
#lwt offline message to check for | |
lwtmsg_offline = 'offline' | |
#last will and Testaments topics to not suppress | |
lwttopics2mon = [ | |
'/lwt/testing1', #testing topic | |
] | |
#filter to check to see if the device/software is offline | |
def lwtfilter(topic, message): | |
for t in lwttopics2mon: | |
if t in topic: | |
if message == lwtmsg_offline: | |
return False #dont suppress the notifcations | |
return True #suppress the notification |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[lwt] | |
topic = /lwt/# | |
targets = log:info,pushover:software | |
filter = lwtfilter() | |
format = Device: {topic} went ==> {payload} @{_dthhmm} | |
title = MQTT LWT Notification |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just added a change to allow you to specify the lwt payload in mqttwarn.
mqtt-tools/mqttwarn@1c24e6a