Data to Server Formating

Hello. Currently I have my custom format set as: {"date":"%timestamp%","%name%":"%data%","modbus_server":"%server_name%"}
and this returns six different mqtt responses. However this is very inefficient and I would like to send all the registers with one response for example: {"date":"%timestamp%","%name1%":"%data1%","%name2%":"%data2%","%name3%":"%data3%","%name4%":"%data4%","%name5%":"%data5%","%name6%":"%data6%","modbus_server":"%server_name%"}

This would make things alot easier, but I am unable to find a method to achieve this.

Hello,

To achieve your desired format and consolidate multiple registers into a single MQTT response, you can adjust the Segment Count in the Data to Server instance data configuration window. Set the Segment Count to the number of Modbus TCP server devices you have as shown in the screenshot below:

I hope this helps! If you need further assistance, feel free to reach out.

Best regards,

Hello,

Thank you for the response. Unfortunately that is not the result i’m looking for. Because that returns six segments with 6 dates. What im looking for is one string with one date and all the data readings like this: {“date”:“%timestamp%”,“%name1%”:“%data1%”,“%name2%”:“%data2%”,“%name3%”:“%data3%”,“%name4%”:“%data4%”,“%name5%”:“%data5%”,“%name6%”:“%data6%”,“modbus_server”:“%server_name%”}

However I have found a work around where I create two extra data collections.

I do however get and issue where if a modbus request fails the data to server would mix up the register formation and send the data with the wrong register name.

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