I am trying to undertstand how the “data to server” service works. Here is what I need to do, but I don’t know if this service is suitable for this:
I have two Modbus RTU (RS485) clients connected to the TRB145 (baud rate is 38400, but this is irrelelvant). Their Modbus adresses are nr 3 and nr 4. I need to read two arrays of input registers from each Modbus client every 30 seconds and send the read data via MQTT with QoS 2. Is this possible to achieve? If yes, how should I configure it? I have tryed many combinations, but nothing is being read and sent. Any help is appreciated!
To start, set up the Modbus Serial Client (Master) to retrieve data from your Modbus RTU devices. During the configuration of the Modbus Serial Client, verify if you can successfully retrieve information from the Modbus RTU devices by using the ‘test’ button. Then, the Modbus Serial Client will periodically retrieve data based on the period you’ve specified in your configuration. This data from the devices is then stored in a database.
Next, configure the Data to Server service. Choose Modbus as the data source (it will extract data from the Modbus database) and select MQTT as the protocol. The rest of the settings will depend on your specific requirements. Also, remember to define the JSON message format.
Thanks for your reply, the solution works. I have one more question. What happens if the Data to Server service is not able to connect to the MQTT Broker? If I set up a remote MQTT Broker to connect to, this could happen if the 4G connection is lost for a while. Is the collected data erased or the setup is working like a queue?
There is a ‘retry on fail’ option at the bottom of the Data to Server configuration that you can enable. With this option on, if the device loses internet connectivity and is unable to send the data to the server, the device will start accumulating the Modbus data. Once the connectivity is restored, the device will forward the accumulated data to the server. Thus, ensuring that the data is not lost.
Thanks for your fast response. So if I set the following:
Retry count: 7200
then I can count on having data stored for 5 days, if there is no Internet connection (number of sendings in a day: 60 x 24 = 1440, in 5 days: 5 x 1440 = 7200)?
My last question: do the single packages retain their original timestamps, or each timestamp will be the time when the sending is succesful?
With the newest v7.05 there were quite a few changes to the Data to Server functionality.
Essentially, the retry count and timeout settings are used to make additional attempts to send data in case of failure. These retries are additional actions.
So, let’s say you have these settings:
- Period: 60 seconds
- Retry: Enabled (ON)
- Retry count: 5
- Timeout: 5 seconds
In this configuration, the device will attempt to send a set of data every 60 seconds. If, for any reason, the initial attempt fails, the device will then make up to 5 additional attempts, with a 15-second gap between each attempt (5 seconds for the timeout + 10 seconds). If all these retry attempts fail, the device will wait for 60 seconds before it tries to send the data again. If it fails, it will try to resend it 5 times again, and the loop continues.
P.S: The maximum retry count is 10, and the maximum timeout is 60 seconds.
Thanks for the explanation. In this case I will have to write a kind of queue program that can keep data in memory up to 30 days.
Not sure if this is needed in your case. The Modbus will continue to collect data, and when the connection is reestablished, all the collected data will be sent to the server. It’s worth noting that the Modbus database in the current firmware version has a capacity of approximately 1.2 MB. Hence, depending on factors like the volume of data you plan to collect (the number of requests and their frequency) and the potential duration of connectivity losses, it is possible that the database will get full.
For instance, if you have numerous requests configured for frequent data collection and experience a month-long loss of internet connectivity, there is a likelihood that some data may be lost due to the database reaching its storage limit. Unfortunately, it’s not possible to expand the size of this database. However, it should suffice for accumulating data over a few days or weeks, depending on the quantity and frequency of the information you’re collecting.
Thanks, that is good news. I don’t expect a loss of connection for more than a couple of days.
This topic was automatically closed after 15 days. New replies are no longer allowed.