subscribe to our Youtube


14261 questions

16894 answers


54591 members

+1 vote
1,137 views 2 comments
Dear Community,

I recently bought a TRB145 now I use the latest firmware. I have a Synology Mosquitto MQTT broker and an MQTT Explorer to see the traffic. I have several analog IO-RS485 converters (half duplex) in a loop.

My target to send every RS485 package come from these units to MQTT. and also "ask" these units to send data with special hexa  messages back to  RS485 through MQTT. So I need a simple two way RS485-MQTT gateway what can handle binary traffic.

I followed the directions to set up MQTT server and publisher. Now I can ask my service provider 100 times with device/get operator command, but

- DATA TO SERVER does not do anything (I maintain active traffic in RS485 different way for testing), no TLS is used, credentials is set up but MQTT is silent (I monitor all the topics the same time with MQTT Explorer)

- RS485 menu item does not have a modem option for MQTT

- MODBUS MQTT GATEWAY: I did not find out how to communicate. Most reponse I get 0 ERROR: INVALID REQUEST. But I guess this is not the RS485 listening what I desire.

Can you please help me?



1 Answer

0 votes


TRB145 Modbus serial master functionality can only be used for data reading and sending via MQTT from connected RS485 devices.

If you want to read and write data to connected RS485 devices, you have to use Modbus gateway functionality in Services -> RS485 (

Talking about Modbus MQTT gateway. It only works with Modbus TCP protocol and it use special message format (information below):

  • Format version
    • Must be 0, which signifies a textual format (currently the only one implemented)
  • Cookie (a 64-bit unsigned integer in range [0;2^64-1])
  • IP type
    • 0 means an IPv4 address
    • 1 means an IPv6 address
    • 2 means a hostname that will be resolved to an IP address
  • IP (of the Modbus TCP slave)
    • IPv6 must be presented in full form (e. g.: 2001:0db8:0000:0000:0000:8a2e:0370:7334)
  • Port (of the Modbus TCP slave)
  • Timeout for Modbus TCP connection, in seconds. Range: [1;999].
  • Slave ID. Range: [1;255].
  • Modbus function. Only these are supported at the moment:
    • 3 (read holding registers)
    • 6 (write to a single holding register)
    • 16 (write to multiple holding registers)
  • The number of the first register (in range [1;65536]): from which registers will be read/written to.
  • If modbus function is 3
    • Register count (in range [1;125]): must not exceed the boundary (first register number + register count <= 65537)
  • If modbus function is 6
    • Register value (in range [0;65535])
  • If modbus function is 16
    • Register count (in range [1;123]): must not exceed the boundary (first register number + register count <= 65537)
    • Register values, separated with commas without spaces, e.g. 1,2,3,654,21,789.
      • There must be exactly as many values as specified (with register count).
      • Each value must be in range [0;65535].

    Answer message format:

  • <COOKIE> OK - for functions 6 and 16

  • <COOKIE> OK <VALUE> <VALUE> <VALUE>... - for function 3, where <VALUE> <VALUE> <VALUE>... are read register values

  • <COOKIE> ERROR: ... - for failures, where ... is the error description

Examples with RUT955 Modbus requests:

  • Setting relay on:
    • Request:
      • 0 65432 0 502 5 1 6 203 1
    • Response:
      • 65432 OK
  • Setting relay off:
    • Request:
      • 0 65432 0 502 5 1 6 203 0
    • Response:
      • 65432 OK
  • Retrieving uptime
    • Request:
      • 0 65432 0 502 5 1 3 2 2
    • Response;
      • 65432 OK 0 5590

Thank you for the answer. As I see my devices are communicating via Modbus RTU protocol instead of Modbus TCP. That might be the issue. Is there a plan/chance to support Modbus RTU messages via MQTT with TRB145?


Hello Vilmos,

Currently we do not have such plans.

Best regards.