Enabling typ-handling

Enable FMS and ZVEI-handling for plugin; message is set depending on the available information and processed to the http-handling. If typ is invalid an empty message will be sent.
The text of the message can be adapted with regard to the information resulting from decoding
This commit is contained in:
Florian 2017-04-16 23:47:08 +02:00 committed by GitHub
parent 1d62fe34f8
commit 642d95b11a

View file

@ -58,6 +58,20 @@ def run(typ,freq,data):
"""
try:
if configHandler.checkConfig("Sms77"): #read and debug the config
# create an empty message an fill it with the required information
message = ""
if typ == "FMS":
logging.debug("FMS detected, building message")
message = data["description"]+"<br>"+data["status"]
elif typ == "ZVEI":
logging.debug("ZVEI detected, building message")
mesage = data["description"]
elif typ == "POC":
logging.debug("POC detected, building message")
message = data["description"]+"<br>"+data["msg"].replace(";", "<br>")
else:
logging.warning("Invalid typ - use empty message")
try:
@ -74,7 +88,7 @@ def run(typ,freq,data):
"to": globalVars.config.get("Sms77", "to"),
"from": globalVars.config.get("Sms77", "from"),
"type": globalVars.config.get("Sms77", "type"),
"text": data["description"]+"<br>"+data["msg"].replace(";", "<br>")
"text": message
}),{"Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain"})
except: