Pzem-004t stop working

Suddenly two devices stopped working after more than a year. The sensors return unknown value. I tried to reset, recharge, nothing to do. Do you think it could be a software problem or do I have to buy two new Pzem?

esphome:
  name: energy-monitor
  friendly_name: Energy Monitor

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:
  level: debug
  baud_rate: 0

# Enable Home Assistant API
api:
  encryption:
    key: "xxxxx"

ota:
  platform: esphome
  password: "xxxx"
  

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  fast_connect: True
  #manual_ip:
    #static_ip: 192.168.1.79
    #gateway: 192.168.1.1
    #subnet: 255.255.255.0
    #dns1: 192.168.1.1
    #dns2: 8.8.4.4

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Energy-Monitor Fallback Hotspot"
    password: "xxxxx"

time:
  - platform: sntp
    id: my_time
    timezone: Europe/Rome

binary_sensor:
  - platform: status
    name: EspHome Node Status
text_sensor:
  - platform: version
    name: "Node Version"
    hide_timestamp: True
  - platform: wifi_info
    ip_address:
      name: "Node IP Address"

captive_portal:

uart:
  - id: ubus
    rx_pin: GPIO1
    tx_pin: GPIO3
    baud_rate: 9600
    stop_bits: 1

modbus:
  - id: mbus
    uart_id: ubus
button:
  - platform: restart
    name: "Restart"

sensor:
  - platform: wifi_signal
    name: "WiFi Signal"
    update_interval: 30s

  - platform: pzemac
    id: pzemac_1
    modbus_id: mbus
    address: 1
    current:
      name: "Clima salone Corrente"
    voltage:
      name: "Clima salone Tensione"
    energy:
      name: "Clima salone Energia"
    power:
      name: "Clima salone potenza"
    update_interval: never

  - platform: pzemac
    id: pzemac_2
    modbus_id: mbus
    address: 2
    current:
      name: "Corrente Pompa pozzo"
    voltage:
      name: "Tensione Pompa pozzo"
    energy:
      name: "Energia Pompa pozzo"
    power:
      name: "Potenza Pompa pozzo"
    frequency:
      name: "Frequenza Pompa pozzo"
    power_factor:
      name: "Power Factor Pompa pozzo"
    update_interval: never

  - platform: pzemac
    id: pzemac_3
    modbus_id: mbus
    address: 3
    current:
      name: "Clima camera corrente"
    voltage:
      name: "Clima camera tensione"
    energy:
      name: "Clima camera energia"
    power:
      name: "Clima camera potenza"
    update_interval: never


interval:
  - interval: 3s
    then:
      - delay: 150ms
      - lambda: "id(pzemac_1).update();"
      - delay: 150ms
      - lambda: "id(pzemac_2).update();"
      - delay: 150ms
      - lambda: "id(pzemac_3).update();"


switch:
  - platform: uart
    uart_id: ubus
    id: reset_pzem_1
    name: pzem reset 1
    data: [0x01, 0x42, 0x80, 0x11]

  - platform: uart
    uart_id: ubus
    id: reset_pzem_2
    name: pzem reset 2
    data: [0x02, 0x42, 0x80, 0xE1]

  - platform: uart
    uart_id: ubus
    id: reset_pzem_3
    name: pzem reset 3
    data: [0x03, 0x42, 0x81, 0x71]

The entity ids might have changed. Are the sensors unknown in Devices & Services → ESPHome → energy-monitor

1 Like

What you get on esphome log?

1 Like

Yes, the sensors were unknown in Devices & Services → ESPHome → energy-monitor. This morning I saw that they are there, it seems that they disappeared for about 3 hours.

I don’t know where to see yesterday’s esphome log

Disappeared again after a few days. I really don’t know what and where to look for. Anyone available to help me step by step? Thanks.

This might help PZEM-004T Stale or unavailable sensor values - #2 by mwolter

1 Like

Thanks, I could try but it’s too complicated for me, I don’t know what to change in my yaml. Please, could you change it for me?