Finally fixed my RS485 Modbus drops (Moved from USB to TCP Gateway)

Just wanted to share a quick hardware solution that finally solved my Modbus nightmares. Like many of you, my HA server is in a rack, but my energy meter is locked in a metal breaker box in the garage.

I started with a cheap USB-to-RS485 dongle and a long wire. It was terrible. I had random disconnects, Linux port mapping issues (the classic /dev/ttyUSB0 changing on reboot), and massive EMI from the breakers causing CRC errors.

I eventually decided to ditch the USB route entirely and moved to a TCP bridging method.

I dropped a Valtoris serial-to-ethernet server directly into the panel next to the meter (honestly, any decent industrial Modbus TCP gateway like this or a Waveshare would work). It handles the serial polling locally and just outputs clean Modbus TCP over ethernet to my LAN switch.

Since HA natively supports Modbus TCP, you don't need any drivers or USB mapping. You just point it to the gateway's IP. Here is the YAML snippet in case anyone wants to replicate this setup:

```yaml
modbus:
  - name: "TCP_Meter_Bridge"
    type: tcp
    host: 192.168.1.188   # Replace with your gateway's static IP
    port: 502             
    sensors:
      - name: "Main Power"
        slave: 1          # Your RS485 meter ID
        address: 30052    # Register address (check your manual)
        input_type: input
        device_class: power
        state_class: measurement

My connection has been rock solid since I switched and not a single drop since. If you are having issues with your USB adapters constantly dropping off your HA instance, I highly recommend spending a little extra money and moving the physical layer to a dedicated TCP server.

If anyone needs help setting registers for certain meters let me know!

1 Like

RS485/ModBus is known for reliability, hence widespread use in the industry.

This initial problem you experienced wouldn't be from failing to connect the standard 120ohm terminating resistor on each end of your RS485 wiring, would it? They are often already on the board and the jumper shunt just needs to be moved across, or can be purchased separately for a few cents. This termination usually eliminates the exact symptoms you describe (by design).

It would be a shame for all this added effort and cost for the want of two resistors.