Hi,
How to reset total energy value on PZEM-004T V1 (8S) ?
https://esphome.io/components/sensor/pzem004t.html?highlight=pzem
It’s doesn’t works …
esphome:
name: wattmetre
platform: ESP8266
board: nodemcuv2
wifi:
ssid: "***********"
password: "***********"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Wattmetre Fallback Hotspot"
password: "**********"
captive_portal:
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
web_server:
port: 80
# Example configuration entry
uart:
tx_pin: D6
rx_pin: D7
baud_rate: 9600
stop_bits: 1
sensor:
- platform: pzem004t
current:
name: "PZEM-004T Courant"
voltage:
name: "PZEM-004T Tension"
power:
name: "PZEM-004T Puissance"
energy:
name: "PZEM-004T Energie"
update_interval: 10s
# Temps de fonctionnement
- platform: uptime
name: "Allumé depuis (s)"
id: uptime_sec
- platform: wifi_signal
name: "Puissance Signal WiFi"
update_interval: 60s
text_sensor:
- platform: version
name: "Version ESPHome"
- platform: template
name: "Allumé depuis (j)"
lambda: |-
int seconds = (id(uptime_sec).state);
int days = seconds / (24 * 3600);
seconds = seconds % (24 * 3600);
int hours = seconds / 3600;
seconds = seconds % 3600;
int minutes = seconds / 60;
seconds = seconds % 60;
return { (String(days) +"d " + String(hours) +"h " + String(minutes) +"m "+ String(seconds) +"s").c_str() };
icon: mdi:clock-start
update_interval: 60s
switch:
- platform: restart
name: "Redemarrage Wattmetre"
- platform: uart
name: "PZEM-004T Energy Reset"
data: [0x01, 0x42, 0x80, 0x11]
binary_sensor:
- platform: status
name: "Etat du Wattmetre"
Thanks for your support.