Make and ESP32 act as modbus server, for emulating a SDM630 smart meter

Hi guys :slight_smile:
I have an ESP32 connected to my Growatt Mod inverter, I have no problems reading data out of it. But another TTL->RS485 is connected to the Smart meter input, how can I make the ESP answer the requests? I have already passed the values from HA to the ESP, I just need it to communicate with the Modbus, I know what the Inverter requests:


------- Growatt inverter polls ---------
02 04 00 00 00 12 70 34 => reg [00..16]
02 04 00 12 00 12 D0 31 => reg [18..34]
02 04 00 34 00 0C B1 F2 => reg [52..62]
02 04 00 46 00 0C 11 E9 => reg [70..80]
02 04 00 C8 00 06 F1 C5 => reg [200..204]
02 04 01 56 00 04 10 16 => reg [342..344]

------- SDM 630 real world values ------
Address, value, info just for my self.
0 230.008759 'phase_1_line_to_neutral_volts'
2 230.043762 'phase_2_line_to_neutral_volts'
4 227.713760 'phase_3_line_to_neutral_volts'
6 0.000000 'phase_1_current'
8 0.000000 'phase_2_current'
10 0.229646 'phase_3_current'
12 0.000000 'phase_1_power'
14 0.000000 'phase_2_power'
16 51.771564 'phase_3_power'

18 0.000000 'phase_1_volt_amps'
20 0.000000 'phase_2_volt_amps'
22 52.379429 'phase_3_volt_amps'
24 0.000000 'phase_1_reactive_power'
26 0.000000 'phase_2_reactive_power'
28 -7.029959 'phase_3_reactive_power'
30 1.000000 'phase_1_power_factor'
32 1.000000 'phase_2_power_factor'
34 0.990953 'phase_3_power_factor'

52 51.792999 'total_power'
54 0.000000
56 53.269367 'total_volt_amps'
58 0.000000
60 -7.801102 'total_var'
62 0.989728 'total_power_factor'

70 49.971806 'frequency'
72 0.034000 'total_import_kwh'
74 0.000000 'total_export_kwh'
76 0.000000 'total_import_kvarh'
78 0.000000 'total_export_kvarh'
80 0.034000 'total_kvah'

200 398.413330 'line_1_to_line_2_volts'
202 396.458252 'line_2_to_line_3_volts'
204 396.623444 'line_3_to_line_1_volts'

342 0.034000 'total_kwh'
344 0.000000 'total_kvarh'

Have anyone done anything like it?

Kind regards
Juel

I am trying to do the same….

Using ESPHome, esp8266 + serial to modbus converter…. To send grid power (already known by HA) to the inverter meter port for export limiting within the inverter…

We’re you able to get this working?