Data to Server JSON format

I want to sent the GPS data from the router via MQTT to an external MQTT broker.
I am able to sent the data and I receive it with the external MQTT broker.

However, I need the data be sent in this format:
{“dateTime”:“1233456”, “gpsLat”:“52.1234”, “gpsLong”: “9.987”}

Currently, I receive the data this way:
[{“dateTime”:“1693128700.0”,“gpsLat”:“52.152435”},{“dateTime”:“1693128700.0”,“gpsLong”:“9.929356”}]

My current JSON string is:
{“dateTime”:“%t.0”,“%r”:“%a”}

How can I specify a specific First Register e.g. 144 for latitude and 146 for longitude in the JSON string?

TIA!

Hello,

It should be enough to change the Segment count option to All instead of 1. Make sure that both registers are being read from the same Modbus Master instance (so that they both arrive together).
The JSON format string should look like so:

{“dateTime”:“%t”,“%r”:“%a”}

Best regards,

Thank you for your quick reply.

Segment count was actually on 2. If I change it to All, I get this:
[{“dateTime”:“1693220784”,“gpsLat”:“52.152493”},{“dateTime”:“1693220784”,“gpsLong”:“9.929337”},{“dateTime”:“1693220786”,“gpsLat”:“52.152493”},{“dateTime”:“1693220786”,“gpsLong”:“9.929337”},{“dateTime”:“1693220788”,“gpsLat”:“52.152493”},{“dateTime”:“1693220788”,“gpsLong”:“9.929337”}]

How do I ensure that that both registers are being read from the same Modbus Master instance?

This is what I have for Modbus TCP Master:

just as additional info:

Hello,

Apologies, indeed, it currently is not possible to achieve this with the current Data to Server instance.
Data sender will receive a lot of improvements with the next RutOS release, which will make such configuration possible. The release date for this firmware is currently unknown.

Best regards,

Hello Daumantas,

while it isn’t the answer I was looking for, thank you for update.

Cheers,
Stefan

This topic was automatically closed after 15 days. New replies are no longer allowed.