FMS and ZVEI Support

This commit is contained in:
mrduckspace 2020-12-22 13:33:23 +01:00
parent 9101ce33e1
commit 7fe98e2516
2 changed files with 21 additions and 13 deletions

View file

@ -552,14 +552,9 @@ commandZVEI =
commandPOC = commandPOC =
[mqtt] [mqtt]
#Plugin for publish POCSAG Alarm wit MQTT #Adress from MQTT-Broker
brokeraddress = 192.168.178.27
#Adress from MQTT-Broker (Example: 192.168.178.27) topic = alarm/posac
brokeraddress =
#Example:
#topic = alarm/posac
topic =
##################### #####################
##### Not ready yet # ##### Not ready yet #

View file

@ -80,9 +80,21 @@ def run(typ,freq,data):
mqttClient = mqtt.Client() mqttClient = mqtt.Client()
if typ == "FMS": if typ == "FMS":
logging.warning("%s not supported", typ) x = {
"fms": data["fms"],
"status": data["status"],
"direction": data["direction"],
"directionText": data["directionText"],
"tsi": data["tsi"],
"description": data["description"],
"timestamp": timeHandler.curtime()
}
elif typ == "ZVEI": elif typ == "ZVEI":
logging.warning("%s not supported", typ) x = {
"zvei": data["zvei"],
"description": data["description"],
"timestamp": timeHandler.curtime()
}
elif typ == "POC": elif typ == "POC":
functionText = "%FUNCTEXT%" functionText = "%FUNCTEXT%"
functionText = wildcardHandler.replaceWildcards(functionText, data) functionText = wildcardHandler.replaceWildcards(functionText, data)
@ -96,11 +108,12 @@ def run(typ,freq,data):
"description": data["description"], "description": data["description"],
"timestamp": timeHandler.curtime() "timestamp": timeHandler.curtime()
} }
y = json.dumps(x)
mqttClient.connect(broker_address)
mqttClient.publish(topic,y)
else: else:
logging.warning("Invalid Typ: %s", typ) logging.warning("Invalid Typ: %s", typ)
y = json.dumps(x)
mqttClient.connect(broker_address)
mqttClient.publish(topic,y)
########## User Plugin CODE ########## ########## User Plugin CODE ##########
except: except: