From 813fdb02f50d2e715a6982ccd1db86b776c04795 Mon Sep 17 00:00:00 2001 From: Schrolli Date: Fri, 22 May 2015 07:32:39 +0200 Subject: [PATCH] edit template and interface info --- plugins/interface.txt | 8 ++++++-- plugins/template/template.py | 8 +++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/plugins/interface.txt b/plugins/interface.txt index 73d9c5a..0663412 100644 --- a/plugins/interface.txt +++ b/plugins/interface.txt @@ -5,7 +5,8 @@ freq = [FREQ(Hz)] data = {"KEY1":"VALUE1","KEY2":"VALUE2"} als Python Dict -Follgende Daten sind bei der jeweiligen Alarm-Art enthalten: +Follgende Daten sind bei der jeweiligen Alarm-Art enthalten +und per data["OPTION"] abrufbar: ZVEI: - zvei @@ -26,6 +27,9 @@ Es stehen folgende globale Objecte zur Verf 1.) import logging # Global logger logging - Object +Nachricht ins Log per: logging.LOGLEVEL("MESSAGE") +Mögliche Loglevel: debug|info|warning|error|exception|critical 2.) import globals # Global variables -config - Object (typ: ConfigParser, stellt config.ini bereit) \ No newline at end of file +config - Object (typ: ConfigParser, stellt config.ini bereit) +VALUE = globals.config.get("SECTION", "OPTION") \ No newline at end of file diff --git a/plugins/template/template.py b/plugins/template/template.py index d2dc896..37e1370 100644 --- a/plugins/template/template.py +++ b/plugins/template/template.py @@ -32,7 +32,8 @@ def run(typ,freq,data): logging.debug(" - %s = %s", key, val) except: logging.exception("cannot read config file") - + +########## User Plugin CODE ########## if typ == "FMS": logging.warning(typ + " not supported") elif typ == "ZVEI": @@ -40,7 +41,8 @@ def run(typ,freq,data): elif typ == "POC": logging.warning(typ + " not supported") else: - logging.warning(typ + " not supported") - + logging.warning(typ + " not supported") +########## User Plugin CODE ########## + except: logging.exception("unknown error")