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
543 views 0 comments
by anonymous

Hi,

I am using TRB245 as ModbusTCP master to read 3 register values from a PLC. i.e., Read holding register, with first register at 1, and register count of 3. I got a reading of three values from the PLC, i.e. 22,23,0

When I use Data to Server service with MQTT protocol, I need to send these three values individually in the following format to a IoT cloud platform: 

{"data": {"key": value, "key": value, "key": value } }

i.e., {"data": {"VR1": 22, "VR2": 23, "VR3": 0 } }

As register data (JSON object) - %a can only produce 22,23,0 in a serial of 3 numbers (an array?)

How can I get access to the individual value of the array of %a of TRB245?

I have tried %a[0] for the first value of %a; it was not working for me.

Please help.

Thanks.

1 Answer

0 votes
by anonymous

Hello,

In your case, you would need to create 3 data to server instances and set Data filtering option By slave ID and specify the ID of the slave:

Regards.