Connect PZEM-016 Energy Meter (ModBus) to Home Assistant – part 2 (directly via RS485 to USB dongle)

In the first part, we described how to connect PZEM-016 ModBus energy monitor using RS485 to TTL converter and Wemos D1 mini board using ESPHome add-on. You can read about it here.

Now, in the second part, we will show you how to connect PZEM-016 energy monitor using RS485 to USB dongle. This is an easier way to connect, but it requires laying the RS485 bus line to the Home Assistant server location.

The required components and wiring diagram are shown below:

pzem-016 rs485 usb

Plug RS485 to USB dongle into your Home Assistant 2021 server (my is core-2021.6.0, supervisor-2021.05.4, Home Assistant OS 5.13)

Add this code to your HA configuration.yaml file

modbus:
  - name: rs485usb
    type: serial
    method: rtu
    port: /dev/ttyUSB2
    baudrate: 9600
    stopbits: 1 
    bytesize: 8
    parity: N
    timeout: 1
    sensors:
      - name: HousePower_PhaseA_Voltage
        unit_of_measurement: V
        slave: 1
        address: 0
        input_type: input
        scale: 0.1
        offset: 0
        precision: 1
      - name: HousePower_PhaseA_Current
        unit_of_measurement: A
        slave: 1
        address: 1
        count: 2
        reverse_order: true
        input_type: input
        scale: 0.001
        offset: 0
        precision: 1
      - name: HousePower_PhaseA_Power
        unit_of_measurement: W
        slave: 1
        address: 3
        count: 2
        reverse_order: true
        input_type: input
        scale: 0.1
        offset: 0
        precision: 1
      - name: HousePower_PhaseA_Wh
        unit_of_measurement: Wh
        slave: 1
        address: 5
        count: 2
        reverse_order: true
        input_type: input
        scale: 1
        offset: 0
        precision: 1
      - name: HousePower_PhaseA_Frequency
        unit_of_measurement: Hz
        slave: 1
        address: 7
        input_type: input
        scale: 0.1
        offset: 0
        precision: 1
      - name: HousePower_PhaseA_PowerFactor
        unit_of_measurement: Pf
        slave: 1
        address: 8
        input_type: input
        scale: 0.01
        offset: 0
        precision: 1

Be careful and choose the correct port! (for example my port – /dev/ttyUSB2)

The port number can be viewed in the ESPHome add-on (top right corner).

If everything works correctly, 6 new sensors (sensor.housepower_phasea_XXX) will appear in the system. You can add them to Home Assistant dashboard manually.

That’s all, PZEM-016 energy monitor is connected! 🙂

In the third part, we will tell you how you can get data from the PZEM-016 using MQTT.

Advertisement
Previous articleConnect PZEM-016 Energy Meter (ModBus) to Home Assistant – part 1 (via RS485 to TTL converter using Wemos D1 mini esp8266 and ESPHome)
Next articleDJI Mini 3 (DJI Mini 2s) possible Release Date, Price & Specs Rumours

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here