FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

14455 questions

17168 answers

28195 comments

0 members

We are migrating to our new platform at https://community.teltonika.lt. Moving forward, you can continue discussions on this new platform. This current platform will be temporarily maintained for reference purposes.
0 votes
1,554 views 4 comments
by anonymous

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 anonymous
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 anonymous
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 anonymous

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.

by anonymous
I am having trouble with this as well...
We have been using Teltonika RUT240 to push data from VFDs and other gizmos to Schneider Machine advisor.
We use this JSON format in the Data Sender configuration

{

"ID":"%i",

"TS":"%d",

"ST":"%s",

"VR": %a

}
I believe this information and the token was obtained from Machine advisor.
(This goofy "blog" system insists on needlessly double-spacing entered text)

The data shows up in Machine advisor automatically grouped by records with ID, TS, ST and VR
and one can then name the records - since the source ID, and register are visible.

However, in Thingsboard, the records also show up with a similar organization in one of the data handling views
but as far as attaching data to widgets on the dashboard, it seems that all of the various items are lumped together and averaged

rather than being made available as separate records.
I thought that JSON was specific to HTTPs, but it appears it is also used with MQTT.
So I'm confused whether the fix required is on the Teltonika end or the Thingsboard end, or both...
Ideally each of the modbus records being transferred could be tagged on the originating end in the Teltonika
In that way, that tagging would appear in the Thingsboard datastream thereby eliminating the need to reverse-deduce the

type of data being received based on ID , register, values, etc...

Where is the best place to get a general / intermediate overview of this protocol dance ?   and then drill down to details ?
by anonymous

aha... we dug around and simplified our JSON to:
 {%r:%a}

and now the data appears by the name configured in the modbus tcp master config

thx