Hello,
As I couldn’t find anywhere a working example on how to configure Paecefair PZEM-6L24 with Modbus integration and an network - Modbus gateway I’m sharing what I have been able to achieve here. A bit frustrating at first as seems that the device uses not so obvious way of reporting data via Modbus. I’m using PUSR USR-DR164 wifi gateway.
Here is my config of the serial port on the gateway:
And here fully working Modbus integration config. Some of it I was only able to figure out using Gemini (e.g. the custom data types, which didn’t work with any of the standard ones).
- name: "pzem_meter"
type: tcp
host: 10.144.30.105 # Replace with your adapter's IP
port: 502
delay: 1
timeout: 5
byte_order: little
word_order: little
sensors:
- name: "PZEM A Voltage"
unique_id: pzem_a_voltage
address: 0
slave: 1
input_type: input
unit_of_measurement: V
scale: 0.1
precision: 1
data_type: uint16
swap: byte
- name: "PZEM B Voltage"
unique_id: pzem_b_voltage
address: 1
slave: 1
input_type: input
unit_of_measurement: V
scale: 0.1
precision: 1
data_type: uint16
swap: byte
- name: "PZEM C Voltage"
unique_id: pzem_c_voltage
address: 2
slave: 1
input_type: input
unit_of_measurement: V
scale: 0.1
precision: 1
data_type: uint16
swap: byte
# --- CURRENT ---
- name: "PZEM A Current"
unique_id: pzem_a_current
address: 3
slave: 1
input_type: input
unit_of_measurement: A
scale: 0.01
precision: 2
data_type: uint16
swap: byte
- name: "PZEM B Current"
unique_id: pzem_b_current
address: 4
slave: 1
input_type: input
unit_of_measurement: A
scale: 0.01
precision: 2
data_type: uint16
swap: byte
- name: "PZEM C Current"
unique_id: pzem_c_current
address: 5
slave: 1
input_type: input
unit_of_measurement: A
scale: 0.01
precision: 2
data_type: uint16
swap: byte
# --- ACTIVE POWER PER PHASE ---
# Phase A: Registers 14 and 15 (0x000E and 0x000F)
- name: "PZEM A Active Power"
unique_id: pzem_a_active_power
address: 14
slave: 1
input_type: input
unit_of_measurement: W
scale: 0.1
precision: 1
device_class: power
state_class: measurement
data_type: custom
structure: "<i"
count: 2
# swap: word
# Phase B: Registers 16 and 17 (0x0010 and 0x0011)
- name: "PZEM B Active Power"
unique_id: pzem_b_active_power
address: 16
slave: 1
input_type: input
unit_of_measurement: W
scale: 0.1
precision: 1
device_class: power
state_class: measurement
data_type: custom
structure: "<i"
count: 2
# Phase C: Registers 18 and 19 (0x0012 and 0x0013)
- name: "PZEM C Active Power"
unique_id: pzem_c_active_power
address: 18
slave: 1
input_type: input
unit_of_measurement: W
scale: 0.1
precision: 1
device_class: power
state_class: measurement
data_type: custom
structure: "<i"
count: 2
# --- ACTIVE ENERGY PER PHASE ---
# Phase A: Registers 40 and 41 (0x0028 and 0x0029)
- name: "PZEM A Active Energy"
unique_id: pzem_a_active_energy
address: 40
slave: 1
input_type: input
unit_of_measurement: kWh
scale: 0.1
precision: 3
data_type: custom
structure: "<I" # Uppercase 'I' for unsigned 32-bit int (energy is not negative)
count: 2
device_class: energy
state_class: total_increasing
# Phase B: Registers 42 and 43 (0x002A and 0x002B)
- name: "PZEM B Active Energy"
unique_id: pzem_b_active_energy
address: 42
slave: 1
input_type: input
unit_of_measurement: kWh
scale: 0.1
precision: 3
data_type: custom
structure: "<I"
count: 2
device_class: energy
state_class: total_increasing
# Phase C: Registers 44 and 45 (0x002C and 0x002D)
- name: "PZEM C Active Energy"
unique_id: pzem_c_active_energy
address: 44
slave: 1
input_type: input
unit_of_measurement: kWh
scale: 0.1
precision: 3
data_type: custom
structure: "<I"
count: 2
device_class: energy
state_class: total_increasing
# --- FREQUENCY ---
- name: "PZEM Frequency"
unique_id: pzem_frequency
address: 6
slave: 1
input_type: input
device_class: frequency
state_class: measurement
unit_of_measurement: Hz
scale: 0.01
precision: 2
data_type: int16
swap: byte
# --- COMBINED ACTIVE POWER ---
# Registers 0x0020 (Low) and 0x0021 (High) form a 32-bit value
- name: "PZEM Total Active Power"
unique_id: pzem_total_active_power
address: 32 # 0x0020 in decimal
slave: 1
input_type: input
unit_of_measurement: W
device_class: power
state_class: measurement
scale: 0.1
precision: 1
data_type: custom
structure: "<i"
count: 2
# --- COMBINED ACTIVE ENERGY ---
# Registers 0x003A (Low) and 0x003B (High)
- name: "PZEM Total Energy"
unique_id: pzem_total_energy
address: 58 # 0x003A in decimal
slave: 1
input_type: input
unit_of_measurement: kWh
scale: 0.1
precision: 1
state_class: total_increasing
device_class: energy
data_type: custom
structure: "<I" # Capital 'I' for unsigned int 32-bit (energy is not negative)
count: 2
I’m using it for 3 independent single phase circuits so the totals are not that interesting to me but they seem to show correct values.
There are more datapoints available in the documentation but I believe above should cover all the rest of data types that are exposed by the power meter.
