Skip to main content

NSRTW_mk4 MQTT protocol message parser

Project description

ci-msg-parser

Python library for parsing NSRTW_mk4 MQTT protocol messages.

Quick-Start

Note these instructions are for testing/demo purposes only.

To start, you will need an MQTT server:

$ cat <<EOF > mosquitto.conf
listener 1883 0.0.0.0
allow_anonymous true
EOF

$ docker run --rm -it -p 1883:1883 -v "./mosquitto.conf:/mosquitto/config/mosquitto.conf" eclipse-mosquitto

Make sure your NSRTW_mk4 is configured to connect to your MQTT server.

Next, use a python script to receive and process messages the instrument:

#!/usr/bin/env python

import paho.mqtt.client as mqtt
from ci_msg_parser import *

def on_connect(client, userdata, flags, reason_code, properties):
    client.subscribe("NS/NSRTW_mk4_MQTT/FW17/*")

def on_message(client, userdata, msg):
    parsed = MessageParser.parse(msg.payload)
	

mqttc = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2)
mqttc.on_connect = on_connect
mqttc.on_message = on_message

mqttc.connect("localhost", 1883, 60)
mqttc.loop_forever()
$ pip install paho-mqtt ci-msg-parser
$ python script.py

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ci_msg_parser-0.2.0.tar.gz (2.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ci_msg_parser-0.2.0-py2.py3-none-any.whl (2.6 kB view details)

Uploaded Python 2Python 3

File details

Details for the file ci_msg_parser-0.2.0.tar.gz.

File metadata

  • Download URL: ci_msg_parser-0.2.0.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for ci_msg_parser-0.2.0.tar.gz
Algorithm Hash digest
SHA256 03b5983d85bb5c896b0d67fc6d52cf6a49931f4ca73dbb70f57308febb3a269a
MD5 1a770d3a49e64ad942628e74ac285d74
BLAKE2b-256 299233d376ef20dbe2c48b50856e18637fdca26c24fbbd7aac2bd876752cce40

See more details on using hashes here.

File details

Details for the file ci_msg_parser-0.2.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for ci_msg_parser-0.2.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 79424e27617e63b70bb927acf9d72b8f8f64a373bba81e0e7bfddae63dafeeb2
MD5 2761363ff67d9412d8fc832066e382fc
BLAKE2b-256 d8ec22158d30f126218f56b54151c98d104abad1e2c78d0a7c3d315182716a8c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page