From 48ecdd666cf5ee44fc5753cc04d40e79ece32ed7 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Thu, 22 Feb 2018 08:28:02 +0100 Subject: [PATCH] add msg mode to plugin --- boswatch/plugin/plugin.py | 10 ++++++++++ plugins/template/template.py | 6 +++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/boswatch/plugin/plugin.py b/boswatch/plugin/plugin.py index 413a96c..6e521da 100644 --- a/boswatch/plugin/plugin.py +++ b/boswatch/plugin/plugin.py @@ -92,6 +92,9 @@ class Plugin: if bwPacket.get("mode") is "zvei": logging.debug("[%s] zvei()", self._pluginName) self.zvei(bwPacket) + if bwPacket.get("mode") is "msg": + logging.debug("[%s] msg()", self._pluginName) + self.msg(bwPacket) except: self._alarmErrorCount += 1 logging.exception("[%s] alarm error", self._pluginName) @@ -161,6 +164,13 @@ class Plugin: @param bwPacket: bwPacket instance""" logging.warning("ZVEI not implemented in %s", self._pluginName) + def msg(self, bwPacket): + """!Called on MSG packet + Must be inherit + + @param bwPacket: bwPacket instance""" + logging.warning("MSG not implemented in %s", self._pluginName) + def teardown(self): """!Called after alarm Must be inherit""" diff --git a/plugins/template/template.py b/plugins/template/template.py index 7fdb9d0..bc57e3f 100644 --- a/plugins/template/template.py +++ b/plugins/template/template.py @@ -51,7 +51,11 @@ class BoswatchPlugin(Plugin): """!Called on ZVEI alarm @param bwPacket: bwPacket instance""" - pass + + def msg(self, bwPacket): + """!Called on MSG packet + + @param bwPacket: bwPacket instance""" def teardown(self): """!Called after alarm"""