SSH script error message

hello,
i’m running a TRB140 FW version TRB1_R_00.07.11.3 to read data from a PLC and send it via SMS
i made a CLI script as below:


number=$phone_number

value=$(ubus call modbus_client.rpc tcp.test '{"id":1,"timeout":10,"function":3,"first_reg":300,"reg_count":"1","data_type":"16bit_int_hi_first","no_brackets":1,"ip":"192.168.1.5","port":"502","delay":0}' | jsonfilter -e '@.result')

gsmctl -S -s "$number $value"

everytime i execute this code i receive an SMS saying “Failed to connect to server: Operation in progress” even though i made sure that the modbus communication is configured succussfully ( i set alarm requests in “modbus TCP devices” configuration and it worked fine)

what could be the mistake i made?

Hello,

A quick test with ModRSsim2 as a simulated Modbus TCP server device indicates that the issue is on an IP connection level between the TRB and your PLC:

Could you check, if you can ping 192.168.1.5?

Also, does the command below return any error (indicating connectivity issues), or simply remain silent (meaning that the device can connect to the PLC):

  • nc 192.168.1.5 502

    • The command above attempts to establish TCP connection with the server 192.168.1.5 on port 502.

    • A couple of expected errors:
      image

      • It takes several minutes to timeout, but indicates that the host is unreachable
      • Connection refused shows that the server receives request, but port 502 is likely closed and actively refuses it.

Also, I have seen a Modbus sensor in the past that can only maintain a single connection with the client. Although I doubt it applies in your case, but maybe, if you already have set alarm requests, and initiate separate requests with a script, these are refused.

Another thought, the default LAN subnet of TRB140 should be 192.168.2.0/24, but you try to connect to the device in 192.168.1.0 subnet. Did you make changes related to that on your TRB?

Best regards,

hello,

thanks for the notes i’ll take them in consideration and verify my connection

and for the subnet of the TRB140, yes i changed it to 192.168.1.3 because the PLC was already set and the system whithin they are insatlled is functional, so, could the modification of the default subnet cause a problem?