I have a question about the using the %timestamp% Tag in my customer json string. I like to use the timestring but is there a possibility to send this timestamp only 1 time at my json object? I transfer 20 values from modbus master to my mqtt broker and need only one time the timestamp and not includes in every data point!
I checked the manuals but I didn´t found any helpful documents!
Could you please confirm the device model you are using?
Also, what firmware version is currently running on the device?
Does the MQTT broker receive a single message containing an array of 20 objects, or 20 separate MQTT messages?
Would grouping the Modbus registers be a suitable option for you? For example, if the register values are continuous (e.g., from 40001 to 40020)
You could also select the format type as a Lua script and create a script to produce the required format. This would be the most efficient method. Please note that troubleshooting and writing scripts is outside the scope of our technical support.
Hi, I trying some scripts in my RUT241 but it´s doesn´t works to read values with lua from my modbus client! Is gernerally posible to read modbus values with lua at the RUT241?
But it makes no sense to provide Lua and not supporting reading modbus values from modbus client!
I’d like to clarify how the Lua script functions within the Data to Server configuration. When you select Lua as the format type, the script itself does not read or poll values from your Modbus devices. Register polling is still handled natively by the router. The Lua script’s role is just to format the payload.
Here’s how the process works:
The router polls the Modbus registers.
It then passes the collected data as an object to the Lua script via the predefined function handle_format_request(data). You can find this function in the example script that you can download when you select Lua as the format type.