Relative Content

Tag Archive for python-3.xmqtt

Sending Hex data Over Mqtt in modbus protocol

import paho.mqtt.client as mqtt # MQTT broker details broker = “test.mosquitto.org” port = 1883 topic = “M66_Rx” # Modbus RTU Frame as a list of hex values modbus_hex = [0x11, 0x03, 0x01, 0x02, 0x01, 0x04, 0xe7, 0x59] # Convert the list of hex values to a byte array modbus_bytes = bytes(modbus_hex) # MQTT client setup […]

Sending Hex data Over Mqtt in modbus protocol

import paho.mqtt.client as mqtt # MQTT broker details broker = “test.mosquitto.org” port = 1883 topic = “M66_Rx” # Modbus RTU Frame as a list of hex values modbus_hex = [0x11, 0x03, 0x01, 0x02, 0x01, 0x04, 0xe7, 0x59] # Convert the list of hex values to a byte array modbus_bytes = bytes(modbus_hex) # MQTT client setup […]