diff --git a/CHANGELOG.md b/CHANGELOG.md index 546fed4..6e171c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,4 @@ +0.0.9 - add versioned json output 0.0.8 - move json duration string to mopp module (pip) 0.0.7 - topic for durations array 0.0.6 - topic changed diff --git a/config.py b/config.py index fbe635c..53596d5 100644 --- a/config.py +++ b/config.py @@ -14,4 +14,6 @@ MQTT_PORT = 1883 TOPIC = "/moip/udp2mqtt/mopp" -TOPICDURATIONS = "/moip/udp2mqtt/durations" \ No newline at end of file +TOPICDURATIONS = "/moip/udp2mqtt/durations" + +MORSE_JSON_VERSION = 1 \ No newline at end of file diff --git a/udp2mqtt.py b/udp2mqtt.py index 4d21f5c..bc3b2a5 100644 --- a/udp2mqtt.py +++ b/udp2mqtt.py @@ -84,10 +84,14 @@ def on_log(mqttc, obj, level, string): # decode the mopp message to a json string containing the durations mydecoded = b.return_duration_json(r["Message"]) + payload = { + "version": config.MORSE_JSON_VERSION, + } + payload.update(mydecoded) # And send mqtt #infot = mqttc.publish(config.TOPIC, data_bytes, qos=2) // publish raw mopp data to another topic? - infot = mqttc.publish(config.TOPICDURATIONS, mydecoded, qos=2) + infot = mqttc.publish(config.TOPICDURATIONS, payload, qos=2) infot.wait_for_publish()