How can i write a modbus register through MQTT?


Firmware version: RUT9_R_00.07.06.5
Router: RUT950 (i have another one RUT956 but i think is the same)

I configured the following:

  • modbus TCP Client1 => reg1: 16bit integer READ /
  • modbus TCP Client2 => reg2: 16bit integer WRITE /
  • and data to server

The result is like this, after I customized the message:
reg1 = {“data”: 100, “server_name”: Modbus_Test_1, “Request name”: Reg1}
reg2 = {“data”: OK, “server_name”: Modbus_Test2, “Request name”: Reg2}

I have that "ok"on reg2 writing and I don’t know where it comes from because it is an integer.

how do I send a message through mqtt to write a variable on modbus?


see my post link


As another user pointed out, this can be done via scripts. However, an easier option would be to use Modbus MQTT Gateway. Configuration examples for each can be found here:

This can be used to write/read Modbus registers on the RUT device itself, as well as any connected devices.
Hope this helps!

Best regards,

This topic was automatically closed after 15 days. New replies are no longer allowed.