Hiking DDS238-2 ZN/S is a cheap €25 single phase energy meter which can measure import and export energy in addition to all the standard parameters, and has a Modbus interface over RS485.

I used this Modbus registry information to create this device template for Home Assistant where the meter is attached to the Protoss PE11 RS485 to TCP gateway (available for €25) available on IP 123.123.123.123
which must be adjusted for your setup or switched to a serial config:
modbus:
- name: Protoss PE11
type: tcp
host: 123.123.123.123
port: 502
timeout: 0.5
sensors:
- name: DDS238-2 ZN-S Total Energy
device_class: energy
state_class: total
unit_of_measurement: kWh
address: 0
count: 2
data_type: uint32
scale: 0.01
precision: 2
- name: DDS238-2 ZN-S Export Energy
device_class: energy
state_class: total_increasing
unit_of_measurement: kWh
address: 8
count: 2
data_type: uint32
scale: 0.01
precision: 2
- name: DDS238-2 ZN-S Import Energy
device_class: energy
state_class: total_increasing
unit_of_measurement: kWh
address: 10
count: 2
data_type: uint32
scale: 0.01
precision: 2
- name: DDS238-2 ZN-S Voltage
device_class: voltage
unit_of_measurement: V
address: 12
data_type: uint16
scale: 0.1
precision: 1
- name: DDS238-2 ZN-S Current
device_class: current
unit_of_measurement: A
address: 13
data_type: uint16
scale: 0.01
precision: 2
- name: DDS238-2 ZN-S Power
device_class: power
data_type: int16
unit_of_measurement: W
address: 14
- name: DDS238-2 ZN-S Reactive Power
device_class: apparent_power
data_type: uint16
unit_of_measurement: VAr
address: 15
- name: DDS238-2 ZN-S Power Factor
device_class: power_factor
unit_of_measurement: '%'
data_type: uint16
address: 16
scale: 0.001
precision: 3
- name: DDS238-2 ZN-S Frequency
device_class: frequency
unit_of_measurement: Hz
data_type: uint16
address: 17
scale: 0.01
precision: 2