Tijani
April 25, 2025, 4:59pm
1
HI everyone
I recently upgraded the firmware of a TRB140 to TRB1_R_00.07.13.4 version and since then i couldn’t read data over modbus using this script:
val1=$(ubus call modbus_client.rpc tcp.test '{"id":1,"timeout":10,"function":3,"first_reg":321,"reg_count":"1","data_type":"32bit_float1234","no_brackets":1,"ip":"192.168.1.5","port":"502","delay":0}' | jsonfilter -e '@.result')
val2=$(ubus call modbus_client.rpc tcp.test '{"id":1,"timeout":10,"function":3,"first_reg":323,"reg_count":"1","data_type":"32bit_float1234","no_brackets":1,"ip":"192.168.1.5","port":"502","delay":0}' | jsonfilter -e '@.result')
val3=$(ubus call modbus_client.rpc tcp.test '{"id":1,"timeout":10,"function":3,"first_reg":325,"reg_count":"1","data_type":"32bit_float1234","no_brackets":1,"ip":"192.168.1.5","port":"502","delay":0}' | jsonfilter -e '@.result')
val4=$(ubus call modbus_client.rpc tcp.test '{"id":1,"timeout":10,"function":3,"first_reg":327,"reg_count":"1","data_type":"32bit_float1234","no_brackets":1,"ip":"192.168.1.5","port":"502","delay":0}' | jsonfilter -e '@.result')
and i get a suite of incremental numbers instead
thanks for helping with this problem
Hello,
Starting from recent firmware versions (>7.13), there was a change in the usage of the ubus modbus command, and it’s now recommended to use the API calls for reading Modbus register data.
However, there’s a known workaround method involving two ubus calls that you can use to achieve similar functionality. This workaround has been outlined in the topics here:
For anyone that still has this issue basically the solution was to make to ubus calls. One to modbus_client.rpc serial.test then a second one to modbus_client.rpc request_status. The first ubus call just returns an Id value for the modbus request then the second returns the modbus value for that Id value.
Here’s a demo code to help:
#!/bin/ash
REQUEST_ID=$(ubus call modbus_client.rpc serial.test ‘{“id”:1,“timeout”:5,“function”:3,“first_reg”:421,“reg_count”:“2”,“data_type”:“32bit_int1234”,“no_…
Thank you so much Chrish, this is working perfectly nice and are almost as responsive as earlier.
You saved my use case with quite many RUT956 devices interfacing Modbus-devices and the ability to keep the firmware updated!
Since you pointed out that catching ubus could create an issue, maybe with memory?, i made a test script for tcp.test, doing the job continuously and flawlessly.
After running 90k+ calls i cannot see any significant changes in memory use(terminal → top). But maybe you have…
Update:
It seems that on the latest firmware this ubus call command works properly, as like on previous releases (<7.13); hence, if there’s a need for its usage, please update your device’s RutOS firmware to 7.14 .
Best regards,
1 Like
system
Closed
April 30, 2025, 11:08pm
4
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.