Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Paho » Extract and graph an integer of binary data from mqtt topic.(How to extract and graph an integer from binary mqtt data (using mqtt-spy?))
Extract and graph an integer of binary data from mqtt topic. [message #1857294] Sat, 28 January 2023 17:57
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 tried posting in mosquito forum, but got no reply. 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? Perhaps there is another toolset that can easily do this instead of mqtt-spy?
Previous Topic:MQTT on LAN
Next Topic:mqtt paho different than mosquitto_sub
Goto Forum:
  


Current Time: Fri Apr 26 18:14:41 GMT 2024

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

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

Back to the top