10444 questions

12453 answers

19377 comments

21853 members

0 votes
125 views 2 comments
by

I am able to read Modbus TCP data on Teltonika device via configured ‘Modbus TCP Master’. Then I send Modbus data to MQTT server via ‘Data to Server’ configuration and I am able to read all data on MQTT broker and then in my MQTT Client application. Here, I have some confusion about MQTT data structure of JSON Format. To read data as in JSON format I have set ‘%a’ in its format. But I received all the data of my Modbus tags in %a in data field only. How can I differentiate the data that comes from different register addresses?

Below are examples:

I have configured different Modbus Addresses to read its data. I am able to read all data of Modbus as configured.  The First name APP411 data I received in [192,168,1,10] format, Level data is 171, Setpoints data like [70,20,250]

I have configured data to server for MQTT protocol. In JSON Format you can see I am reading all the Modbus tags value in “data” field with %a JSON format. Then I am getting data on MQTT Broker.

While I’m reading these values in MQTT client, There is confusion to read data with the same parameter.

In “data”:[192,168,1,10] & “data”: [70,20,250]

 Then “data” at index [0] is 192 or 70 ? Then “data” at index [1] is 168 or 20 ? Then “data” at index [2] is 1 or 250 ?

 How can I read these values? Can you please help me with that?

1 Answer

0 votes
by
Hello,

Key thing to reading these lines is word "Requester". In your case, requester:setpoints, requester:level, requester:app441 shows from where the data comes. You can always change JSON format and fully customize segment, depending on the information you need: https://wiki.teltonika-networks.com/view/RUTX11_Data_to_Server

Regards,

Tomas M.
by
Thanks, Tomas for the reply.

I have put the "Requester" parameter with a value set as per my Modbus segments.

After that, I noticed that RUT955 not even publishing any messages on MQTT, though on Modbus Master I got a value from the device.

My Data to server ON and set to forward Modbus data to MQTT Broker (HiveMQ) but on broker I'm not receiving any messages that published from RUT955.

How can I trace it? Any idea/suggestion/tips?
by

Hello,

- Firstly, restore your Data to Server configuration to previous one where everything worked.

- When everything works, adjust JSON format according to your needs. Here is your original: {"id":%i,"TS":"%t","Date":"%d","Name":"%n","IP":"%p","Requester":"%r","Address":"%z","data":%a}

Cut IP part if it makes data reading difficult like this: {"id":%i,"TS":"%t","Date":"%d","Name":"%n","Requester":"%r","Address":"%z","data":%a}

- On Data to Server settings there is data filtering option, try changing it from all data to slave id/slave ip. Check the results.

- I tested your configuration with flespi.io broker and it displayed text nicely. You might find other brokers (like flespi.io) better fit your needs.

I have attached a few screenshots with my configuration of data to server and flespi broker results.

Regards,

Tomas M.