TRB255 modbus serial connection disabled?

Hello,
we have this problem:
we have setup a system which periodically reads the modbus registers of some solar inverters via mqtt/modbus gateway. In some cases we have noticed this behaviour: in the morning all the readings fail until we manually read a random register via the TRB web UI (via RMS portal). After this, the connection seems to “wake up” and the automated readings have success.
It seems that the serial connection enters a standby state.
The only other workaround i have found, besides the manual reading is to reboot the gateway, after this the problem is gone, until the next day.
There’s maybe a way to reset or re-intialize the serial connection of the gateway without having to reboot it every time?

Thank You!

Hello,

Thank you for reaching out.

As an alternative, more efficient method not requiring rebooting the gateway, you could try executing the following command:

/etc/init.d/modbusgateway restart

It might serve as a convenient way to “wake up” the serial connection and allow automated readings to resume successfully.

If you have additional questions or need further assistance, feel free to reach out.

Best regards,

Hello Martynas,
thank you for the quick reply! Ther’s a way to automate this command or better send it to the gateway via mqtt?
Thanks!

Hello,

To automate this command, you can use a Crontabs. For example, the following command will restart the Modbus Gateway service every day on even hours:

0 */2 * * * /etc/init.d/modbusgateway restart >/dev/null 2>&1

Steps to Add the Job to Crontabs:

  1. Open the crontab editor by running on device CLI:
crontab -e
  1. Press I to enter insert mode.
  2. Add the command as shown above.
  3. Press Esc, type :wq, and press Enter to save and exit.

If you wish to execute the command at different intervals, you can use an online tool like crontab-generator.org to create a custom crontab job suited to your needs.

Feel free to let us know if you have additional questions or require further assistance!

Best regards,

Cool thank you! I’ll give it a try.
It will be possible also to create a custom modbus registers that does the same on command?
Thanks!

Hello,
i’m trying to create a script which polls a given modbus register and performs the modbus gateway reset command if certains conditions are met.
The problem is i can’t find a way to read the internal registers of the TRB via CLI.
The various examples i found require to install some external packages, which doesn’t seem are available for the TRB.
Do you have any tips?
Thank you in advance!

Hello,

To read Modbus serial server registers via the TRB CLI, you can use the ubus call command. Here is an example:

ubus call modbus_client.rpc serial.test '{"id":1,"timeout":5,"function":3,"first_reg":1,"reg_count":"1","data_type":"16bit_int_hi_first","no_brackets":1,"serial_type":"/dev/rs485","baudrate":9600,"databits":8,"stopbits":1,"parity":"None","flowcontrol":"None"}'

You can modify the parameters according to your needs, such as the register address, data type, and serial settings.

If you need further assistance, feel free to ask.

Kind regards,