MQTT Payload Invalid JSON?

Topics about the Software of Revolution Pi
Post Reply
User avatar
palmerpi
Posts: 21
Joined: 04 Feb 2019, 17:17
Answers: 0
Location: Northern Ireland
Contact:

MQTT Payload Invalid JSON?

Post by palmerpi »

Hello,

wondering if someone has had a similar issue or any suggestions,

I'm am publishing to MQTT Mosquito broker on the RevPi.
All seems to be working correctly and I can see the message when I subscribe in NODERED. However when I try to use Kepware MQTT client to subscribe to the same message I get and warning error which is filling up log when there are thousands of messages. (Although Im definitely getting the message and can parse it to get values.
The Kepware suggestion is to "Reconfigure the payload to be valid JSON" I have no control what comes out of the DIO to the MQTT broker as far as I can see.

Unexpected token found while looking for the end of the MQTT payload. |
Channel = '<channel>', Topic = '<topic>', Line = <line>, Col = <col>.
Error Type:
Warning
Possible Cause:
Unexpected token while looking for the end of the document.
Possible Solution:
Reconfigure the payload to be valid JSON


In the MQTT example we see output such as

pi @ raspberrypi: ~ $ mosquitto_sub -t "#" -v
revpi8143 / io / temp_heater 215
revpi8143 / io / temp_outside 227

I believe the JSON that Kepware is expecting contains brackets delimiters etc and not what is output from RevPI. In the example the format is so

Is there a way to have this message reformatted to something like perhaps revpi8143/io/ {"tst":1470825369,"topic":"greeting","qos":0,"retain":0,"payload":"hello world"}?
Im not sure. Assistance much appreciated.

Thank you

Alan

Any assistance appreciated
User avatar
palmerpi
Posts: 21
Joined: 04 Feb 2019, 17:17
Answers: 0
Location: Northern Ireland
Contact:

Re: MQTT Payload Invalid JSON?

Post by palmerpi »

Has anyone got the revpi and DIO sending data to KEPWARE server? At a loss, the invalid JSON MQTT message being produced at the Kepware side is causing the failure. Nodered is fine with the MQTT message but not kepware. Is there a way of changing the MQTT publish that Revpi utilises?
User avatar
palmerpi
Posts: 21
Joined: 04 Feb 2019, 17:17
Answers: 0
Location: Northern Ireland
Contact:

Re: MQTT Payload Invalid JSON?

Post by palmerpi »

As a follow up to this. The issue was with Kepware and had to get them to make a workaround/fix
Post Reply