Hi, I currently use a Pzem-004t connected to a Wemos D1 to measure power consumption with this yaml:
esphome:
name: pzemac
friendly_name: Wemos D1
esp8266:
board: esp01_1m
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "aieJbRbkQ8pZIPF/siQ0DEDREArpdjqDbzTRwmbP9Bw="
ota:
password: "5bb7927d4a20446b62043aa7c742e87a"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
manual_ip:
static_ip: 192.168.1.62
gateway: 192.168.1.254
subnet: 255.255.255.0
dns1: 8.8.8.8
dns2: 8.8.4.4
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Wemos-D1 Fallback Hotspot"
password: "BlVuGhyroRCc"
captive_portal:
uart:
id: PZem
rx_pin: 14
tx_pin: 12
baud_rate: 9600
sensor:
- platform: wifi_signal
name: "WiFi Sensor"
update_interval: 60s
- platform: pzemac
current:
name: Home Current
unit_of_measurement: A
accuracy_decimals: 1
icon: mdi:flash-circle
voltage:
name: Home Voltage
unit_of_measurement: V
icon: mdi:flash-circle
power:
name: Home Power
unit_of_measurement: W
accuracy_decimals: 1
icon: mdi:flash-circle
id: home_power
power_factor:
name: Home Power Factor
id: pow_factor
energy:
name: Home Energy
unit_of_measurement: kWh
state_class: total
device_class: energy
accuracy_decimals: 2
filters:
- multiply: 0.001
icon: mdi:flash-circle
id: home_energy
update_interval: 1s
- platform: total_daily_energy
name: "Total Daily Energy"
id: total_day_energy
unit_of_measurement: Wh
state_class: total
device_class: energy
accuracy_decimals: 0
power_id: home_power
button:
- platform: template
name: Reset
id: my_button
on_press:
uart.write: [0x01, 0x42, 0x80, 0x11]
switch:
- platform: uart
uart_id: PZem
id: reset_PZem
name: "PZEM-004T V3 Energy Reset"
data: [0x01, 0x42, 0x80, 0x11]
time:
- platform: homeassistant
on_time:
- seconds: 59
minutes: 59
hours: 23
then:
I would like to add two more pzem on the same wemos but I am not able to change the addresses.
I saw that Esphome has a code (Peacefair PZEM-004T V3 Energy Monitor — ESPHome) to do it but I don’t know how to proceed, should I write it in the yaml? At what point? If anyone can explain to me how to do it step by step I would be grateful