Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Mosquitto » MQTT-SPY Question(How to extract and graph an integer from binary mqtt data using mqtt-spy)
MQTT-SPY Question [message #1857229] Thu, 26 January 2023 02:43
Dale DeJager is currently offline Dale DeJagerFriend
Messages: 2
Registered: January 2023
Junior Member
I'm not sure if this is the best place to ask this question, but I'm unable to find an active forum to ask about MQTT-SPY. I would like to extract two bytes of data from a binary MQTT topic and graph the data as an integer. I've tried various solutions to create a formatter or a value expression for the Payload data in the graphing tool. I cannot find documentation for how to create either a formatter or and expression.

With the "help" of ChatGPT I've tried variations of
function format()
{
	byte[] binaryData = receivedMessage.getPayload();
	int lastTwoBytesAsInt = ByteBuffer.wrap(binaryData, binaryData.length-2, 2).getShort();
	return Integer.toString(lastTwoBytesAsInt);
}

for a formatter or
$.readShort(payload.length - 2)


for a graph value expression.

Is it possible to do what I'm trying to do? If so, how?
Previous Topic:howto mosquitto_sub to test.mosquitto.org on port 8886
Next Topic:Connecting two Windows PCs via MQTT (local ethernet connection)
Goto Forum:
  


Current Time: Thu Apr 25 19:07:18 GMT 2024

Powered by FUDForum. Page generated in 0.03309 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top