ModbusTCP to MQTT datastring

Hello,

I am using a RUT241

With ModbusTCP Client I am reading some Modbus registers from a PLC, this goes OK.

I am sending this data to a MQTT broker with Data to Server, this goes also OK.

My question is that all values start with the word “data” and I want: or the ModbusRegister name + value or only the value..

Here is an example of the received string.

Date : {“EcoPlus”:[{“data”:“108.873917”},{“data”:“7425111”},{“data”:“128”},{“data”:“0.040438”},{“data”:“1.000000”},{“data”:“1.000000”},{“data”:“15.820300”},{“data”:“0”},{“data”:“0”},{“data”:“2”},{“data”:“19636”}]}

Is this a configuration setting in the RUT241?

Thank you,

Maurits

Hello,

There’s is no simple option to edit this directly, so you would have to opt for one of these 2 options:

  1. Either check whether the received data format is configurable from your MQTT broker.
  2. Use a custom LUA Script in the Data to server, however, this will require some programming knowledge.

Regards,
M.

Thank you for your reply.

It doesn’t matter any more, I am writing a vb.net program and with Newtonsoft.Json.Linq I get all values in one array, without the register name or “Data”.

Works well for me.

Thanks

1 Like