esphome / issues

Issue Tracker for ESPHome
https://esphome.io/
291 stars 34 forks source link

PZEM-004T V1.0 Can't establish UART communication #2538

Open Lauriz7 opened 2 years ago

Lauriz7 commented 2 years ago

The problem

Hello, I am trying to connect PZEM-004T V1.0 with NodeMCU.

However i can’t get any serial communication going.

any ideas what i am doing wrong? RX of PZEM is connected to ESP8266 GPIO1 TX, and TX of PZEM to ESP8266 GPIO3 RX. Powered by 5V VU pin.

It is NodeMCU V3. GPIO1 should be TX and GPIO3 should be RX on this board. I literally tried every combination of step bits and RX/RX, tried software serial on D1/D2… Even tried to flash tasmota, but then flash size is only 1MB and in tasmota lite there is no PZEM configuration module.

I made sure that PZEM receives 5.146V, and RX/TX are inversed as they should be.

I tried another PZEM-004T board, did not help. Tried inversing RX/TX in hardware, did not help. I'm out of ideas.

Which version of ESPHome has the issue?

2021.9.2

What type of installation are you using?

Home Assistant Add-on

Which version of Home Assistant has the issue?

2021.8

What platform are you using?

ESP8266

Board

NodeMCU V3

Component causing the issue

No response

Example YAML snippet

esphome:
  name: vanvex2
  platform: ESP8266
  board: nodemcuv2

# Enable logging
logger:
  level: VERY_VERBOSE
  baud_rate: 0
# Enable Home Assistant API
api:

web_server:
    port: 80

switch:
  - platform: gpio
    name: "Vanvex_button_temp"
    pin: 12
    id: button1_d6

  - platform: gpio
    name: "Vanvex_button_down"
    pin: 14
    id: button2_d5

  - platform: gpio
    name: "Vanvex_button_up"
    pin: 13
    id: button2_d7

uart:
  id: uart_pz
  tx_pin: GPIO1
  rx_pin: GPIO3
  baud_rate: 9600
  stop_bits: 1

sensor:
  - platform: pzem004t
    uart_id: uart_pz
    current:
      name: "Vanvex Current"
    voltage:
      name: "Vanvex Voltage"
    power:
      name: "Vanvex Power"
    energy:
      name: "Vanvex Energy"
    update_interval: 80s

Anything in the logs that might be useful for us?

[23:49:17][C][wifi:501]: WiFi:
[23:49:17][C][wifi:361]:   SSID: [redacted]
[23:49:17][C][wifi:362]:   IP Address: 192.168.1.205
[23:49:17][C][wifi:364]:   BSSID: [redacted]
[23:49:17][C][wifi:365]:   Hostname: 'vanvex2'
[23:49:17][C][wifi:369]:   Signal strength: -84 dB ▂▄▆█
[23:49:17][V][wifi:371]:   Priority: 0.0
[23:49:17][C][wifi:373]:   Channel: 1
[23:49:17][C][wifi:374]:   Subnet: 255.255.255.0
[23:49:17][C][wifi:375]:   Gateway: 192.168.1.1
[23:49:17][C][wifi:376]:   DNS1: 192.168.1.1
[23:49:17][C][wifi:377]:   DNS2: (IP unset)
[23:49:17][C][uart_esp8266:097]: UART Bus:
[23:49:17][C][uart_esp8266:099]:   TX Pin: GPIO1
[23:49:17][C][uart_esp8266:102]:   RX Pin: GPIO3
[23:49:17][C][uart_esp8266:103]:   RX Buffer Size: 256
[23:49:17][C][uart_esp8266:105]:   Baud Rate: 9600 baud
[23:49:17][C][uart_esp8266:106]:   Data Bits: 8
[23:49:17][C][uart_esp8266:107]:   Parity: NONE
[23:49:17][C][uart_esp8266:108]:   Stop bits: 1
[23:49:17][C][uart_esp8266:110]:   Using hardware serial interface.
[23:49:17][C][switch.gpio:048]: GPIO Switch 'Vanvex_button_temp'
[23:49:17][C][switch.gpio:049]:   Pin: GPIO12 (Mode: OUTPUT)
[23:49:17][C][switch.gpio:071]:   Restore Mode: Restore (Defaults to OFF)
[23:49:17][C][switch.gpio:048]: GPIO Switch 'Vanvex_button_down'
[23:49:17][C][switch.gpio:049]:   Pin: GPIO14 (Mode: OUTPUT)
[23:49:17][C][switch.gpio:071]:   Restore Mode: Restore (Defaults to OFF)
[23:49:17][C][switch.gpio:048]: GPIO Switch 'Vanvex_button_up'
[23:49:17][C][switch.gpio:049]:   Pin: GPIO13 (Mode: OUTPUT)
[23:49:17][C][switch.gpio:071]:   Restore Mode: Restore (Defaults to OFF)
[23:49:17][C][logger:193]: Logger:
[23:49:17][C][logger:194]:   Level: VERY_VERBOSE
[23:49:17][C][logger:195]:   Log Baud Rate: 0
[23:49:17][C][logger:196]:   Hardware UART: UART0
[23:49:17][C][pzem004t:110]: PZEM004T:
[23:49:17][C][pzem004t:111]: Voltage 'Vanvex Voltage'
[23:49:17][C][pzem004t:111]:   Device Class: 'voltage'
[23:49:17][C][pzem004t:111]:   State Class: 'measurement'
[23:49:17][C][pzem004t:111]:   Unit of Measurement: 'V'
[23:49:17][C][pzem004t:111]:   Accuracy Decimals: 1
[23:49:17][C][pzem004t:112]: Current 'Vanvex Current'
[23:49:17][C][pzem004t:112]:   Device Class: 'current'
[23:49:17][C][pzem004t:112]:   State Class: 'measurement'
[23:49:17][C][pzem004t:112]:   Unit of Measurement: 'A'
[23:49:17][C][pzem004t:112]:   Accuracy Decimals: 2
[23:49:17][C][pzem004t:113]: Power 'Vanvex Power'
[23:49:17][C][pzem004t:113]:   Device Class: 'power'
[23:49:17][C][pzem004t:113]:   State Class: 'measurement'
[23:49:17][C][pzem004t:113]:   Unit of Measurement: 'W'
[23:49:17][C][pzem004t:113]:   Accuracy Decimals: 0
[23:49:17][C][captive_portal:148]: Captive Portal:
[23:49:17][C][web_server:152]: Web Server:
[23:49:17][C][web_server:153]:   Address: vanvex2.local:80
[23:49:17][C][ota:029]: Over-The-Air Updates:
[23:49:17][C][ota:030]:   Address: vanvex2.local:8266
[23:49:17][C][ota:032]:   Using Password.
[23:49:17][C][api:135]: API Server:
[23:49:17][C][api:136]:   Address: vanvex2.local:6053
[23:49:17][VV][scheduler:151]: Running interval '' with interval=10000 last_execution=2674332 (now=2684339)
[23:49:21][VV][api.service:327]: on_ping_request: PingRequest {}
[23:49:21][VV][api.service:043]: send_ping_response: PingResponse {}
[23:49:27][VV][scheduler:151]: Running interval '' with interval=10000 last_execution=2684332 (now=2694335)
[23:49:32][VV][api.service:327]: on_ping_request: PingRequest {}
[23:49:32][VV][api.service:043]: send_ping_response: PingResponse {}
[23:49:36][VV][api.service:327]: on_ping_request: PingRequest {}
[23:49:36][VV][api.service:043]: send_ping_response: PingResponse {}
[23:49:37][VV][scheduler:151]: Running interval '' with interval=10000 last_execution=2694332 (now=2704332)

Additional information

No response

github-actions[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.