ESP32 as RS-485 bridge for modbus

Hi to all!
I have remote solar controller with modbus (RS-485) interface.
I am currently collecting data using a 4G wireless router (Teltonika RUT955) using its embedded RS-485 interface.
I need to use one of the several RUT240 model I don’t use instead buying new RUT955 (in this case RS-485 interface not available), so I thought to create my own wireless RS-485 bridge using ESP32.

I ordered ESP32 board and RS-485 adapter, meanwhile I am taking a look to the code… Modbus Controller

I am confused about client (so my ESP32) code: I already set on my HA code for reading register at 0x9001 when using RUT955:

# CHR Grado
- name: CHR_Grado
  type: tcp
  host: 10.55.44.20
  port: 503

  sensors:
    - name:  "Battery Capacity"
      slave: 1
      address: 0x9001
      input_type: holding
      unit_of_measurement: AH
      device_class: voltage
      state_class: measurement
      scale: 0.01
      offset: 0
      precision: 1
      data_type: U_WORD

why need I write on ESP32 code for register at 0x9001 again?
Thanks.

I’m not sure what are you trying to do. But with Esphome + rs485 you do the whole setup on esphome.

If you use esphome you don’t need modbus: in Home Assistant

What!?!?!?
I need “modbus” in HA to collect data through modbus protocol, I am currently using this for several RUT955 and it works, why do you say I don’t need it if I want swap RUT955 with ESP?

Because you do it in Esphome…

Esphome it’s not a transparent bridge.

Esphome convert modbus to sensors.

You can use Tasmota.