After changing the addresses of three Pzem-004t V3s, I put the original code back to read the registers and I no longer get the data.
Furthermore, I don’t understand why, although this test is done with a Pzem address 0x03, the log says 0x01
INFO ESPHome 2023.10.1
INFO Reading configuration /config/esphome/home-energy.yaml...
INFO Generating C++ source...
INFO Compiling app...
Processing home-energy (board: esp01_1m; framework: arduino; platform: platformio/[email protected])
--------------------------------------------------------------------------------
HARDWARE: ESP8266 80MHz, 80KB RAM, 1MB Flash
Dependency Graph
|-- ESPAsyncTCP-esphome @ 2.0.0
|-- ESPAsyncWebServer-esphome @ 3.1.0
|-- DNSServer @ 1.1.1
|-- ESP8266WiFi @ 1.0
|-- ESP8266mDNS @ 1.2
|-- noise-c @ 0.1.4
RAM: [==== ] 42.3% (used 34668 bytes from 81920 bytes)
Flash: [===== ] 48.7% (used 498673 bytes from 1023984 bytes)
========================= [SUCCESS] Took 2.11 seconds =========================
INFO Successfully compiled program.
INFO Connecting to 192.168.1.62
INFO Uploading /data/build/home-energy/.pioenvs/home-energy/firmware.bin (502832 bytes)
INFO Compressed to 352421 bytes
Uploading: [============================================================] 100% Done...
INFO Waiting for result...
INFO OTA successful
INFO Successfully uploaded program.
INFO Starting log output from 192.168.1.62 using esphome API
INFO Successfully connected to 192.168.1.62
[17:54:29][I][app:102]: ESPHome version 2023.10.1 compiled on Oct 22 2023, 17:50:50
[17:54:29][C][wifi:546]: WiFi:
[17:54:29][C][wifi:382]: Local MAC: 7C:87:CE:B6:C5:3F
[17:54:29][C][wifi:383]: SSID: [redacted]
[17:54:29][C][wifi:384]: IP Address: 192.168.1.62
[17:54:29][C][wifi:385]: BSSID: [redacted]
[17:54:29][C][wifi:387]: Hostname: 'home-energy'
[17:54:29][C][wifi:389]: Signal strength: -69 dB ▂▄▆█
[17:54:29][C][wifi:393]: Channel: 1
[17:54:29][C][wifi:394]: Subnet: 255.255.255.0
[17:54:29][C][wifi:395]: Gateway: 192.168.1.254
[17:54:29][C][wifi:396]: DNS1: 8.8.8.8
[17:54:29][C][wifi:397]: DNS2: 8.8.4.4
[17:54:29][C][logger:361]: Logger:
[17:54:29][C][logger:362]: Level: DEBUG
[17:54:29][C][logger:363]: Log Baud Rate: 115200
[17:54:29][C][logger:365]: Hardware UART: UART0
[17:54:30][C][uart.arduino_esp8266:102]: UART Bus:
[17:54:30][C][uart.arduino_esp8266:103]: TX Pin: GPIO12
[17:54:30][C][uart.arduino_esp8266:104]: RX Pin: GPIO14
[17:54:30][C][uart.arduino_esp8266:106]: RX Buffer Size: 256
[17:54:30][C][uart.arduino_esp8266:108]: Baud Rate: 9600 baud
[17:54:30][C][uart.arduino_esp8266:109]: Data Bits: 8
[17:54:30][C][uart.arduino_esp8266:110]: Parity: NONE
[17:54:30][C][uart.arduino_esp8266:111]: Stop bits: 1
[17:54:30][C][uart.arduino_esp8266:115]: Using software serial
[17:54:30][C][modbus:143]: Modbus:
[17:54:30][C][modbus:145]: Send Wait Time: 250 ms
[17:54:30][C][modbus:146]: CRC Disabled: NO
[17:54:30][C][pzemac:067]: PZEMAC:
[17:54:30][C][pzemac:068]: Address: 0x01
[17:54:30][C][pzemac:069]: Voltage 'Home Voltage'
[17:54:30][C][pzemac:069]: Device Class: 'voltage'
[17:54:30][C][pzemac:069]: State Class: 'measurement'
[17:54:30][C][pzemac:069]: Unit of Measurement: 'V'
[17:54:30][C][pzemac:069]: Accuracy Decimals: 1
[17:54:30][C][pzemac:069]: Icon: 'mdi:flash-circle'
[17:54:30][C][pzemac:070]: Current 'Home Current'
[17:54:30][C][pzemac:070]: Device Class: 'current'
[17:54:30][C][pzemac:070]: State Class: 'measurement'
[17:54:30][C][pzemac:070]: Unit of Measurement: 'A'
[17:54:30][C][pzemac:070]: Accuracy Decimals: 1
[17:54:30][C][pzemac:070]: Icon: 'mdi:flash-circle'
[17:54:30][C][pzemac:071]: Power 'Home Power'
[17:54:30][C][pzemac:071]: Device Class: 'power'
[17:54:30][C][pzemac:071]: State Class: 'measurement'
[17:54:30][C][pzemac:071]: Unit of Measurement: 'W'
[17:54:30][C][pzemac:071]: Accuracy Decimals: 1
[17:54:30][C][pzemac:071]: Icon: 'mdi:flash-circle'
[17:54:30][C][pzemac:072]: Energy 'Home Energy'
[17:54:30][C][pzemac:072]: Device Class: 'energy'
[17:54:30][C][pzemac:072]: State Class: 'total'
[17:54:30][C][pzemac:072]: Unit of Measurement: 'kWh'
[17:54:30][C][pzemac:072]: Accuracy Decimals: 2
[17:54:30][C][pzemac:072]: Icon: 'mdi:flash-circle'
[17:54:30][C][pzemac:074]: Power Factor 'Home Power Factor'
[17:54:30][C][pzemac:074]: Device Class: 'power_factor'
[17:54:30][C][pzemac:074]: State Class: 'measurement'
[17:54:30][C][pzemac:074]: Unit of Measurement: ''
[17:54:30][C][pzemac:074]: Accuracy Decimals: 2
[17:54:30][D][pzemac:049]: PZEM AC: V=234.4 V, I=0.000 A, P=0.0 W, E=1.0 Wh, F=49.9 Hz, PF=0.00
[17:54:30][D][sensor:093]: 'Home Voltage': Sending state 234.39999 V with 1 decimals of accuracy
[17:54:30][D][sensor:093]: 'Home Current': Sending state 0.00000 A with 1 decimals of accuracy
[17:54:30][D][sensor:093]: 'Home Power': Sending state 0.00000 W with 1 decimals of accuracy
[17:54:30][D][sensor:093]: 'Home Energy': Sending state 0.00100 kWh with 2 decimals of accuracy
[17:54:30][D][sensor:093]: 'Home Power Factor': Sending state 0.00000 with 2 decimals of accuracy
[17:54:30][W][component:214]: Component modbus took a long time for an operation (0.05 s).
[17:54:30][W][component:215]: Components should block for at most 20-30ms.
[17:54:30][C][captive_portal:088]: Captive Portal:
[17:54:30][C][mdns:115]: mDNS:
[17:54:30][C][mdns:116]: Hostname: home-energy
[17:54:30][C][ota:097]: Over-The-Air Updates:
[17:54:30][C][ota:098]: Address: 192.168.1.62:8266
[17:54:30][C][ota:101]: Using Password.
[17:54:30][C][api:138]: API Server:
[17:54:30][C][api:139]: Address: 192.168.1.62:6053
[17:54:30][C][api:141]: Using noise encryption: YES
[17:54:30][C][wifi_signal.sensor:009]: WiFi Signal 'WiFi Sensor'
[17:54:30][C][wifi_signal.sensor:009]: Device Class: 'signal_strength'
[17:54:30][C][wifi_signal.sensor:009]: State Class: 'measurement'
[17:54:30][C][wifi_signal.sensor:009]: Unit of Measurement: 'dBm'
[17:54:30][C][wifi_signal.sensor:009]: Accuracy Decimals: 0
[17:54:31][D][api.connection:1032]: Home Assistant 2023.10.3 (192.168.1.69): Connected successfully
[17:54:31][D][api.connection:171]: Home Assistant 2023.10.3 (192.168.1.69) requested disconnected
[17:54:33][D][pzemac:049]: PZEM AC: V=234.6 V, I=0.000 A, P=0.0 W, E=1.0 Wh, F=49.9 Hz, PF=0.00
[17:54:33][D][sensor:093]: 'Home Voltage': Sending state 234.60001 V with 1 decimals of accuracy
[17:54:33][D][sensor:093]: 'Home Current': Sending state 0.00000 A with 1 decimals of accuracy
[17:54:33][D][sensor:093]: 'Home Power': Sending state 0.00000 W with 1 decimals of accuracy
[17:54:33][D][sensor:093]: 'Home Energy': Sending state 0.00100 kWh with 2 decimals of accuracy
[17:54:33][D][sensor:093]: 'Home Power Factor': Sending state 0.00000 with 2 decimals of accuracy
[17:54:36][D][pzemac:049]: PZEM AC: V=234.7 V, I=0.000 A, P=0.0 W, E=1.0 Wh, F=49.9 Hz, PF=0.00
[17:54:36][D][sensor:093]: 'Home Voltage': Sending state 234.70000 V with 1 decimals of accuracy
[17:54:36][D][sensor:093]: 'Home Current': Sending state 0.00000 A with 1 decimals of accuracy
[17:54:36][D][sensor:093]: 'Home Power': Sending state 0.00000 W with 1 decimals of accuracy
[17:54:36][D][sensor:093]: 'Home Energy': Sending state 0.00100 kWh with 2 decimals of accuracy
[17:54:36][D][sensor:093]: 'Home Power Factor': Sending state 0.00000 with 2 decimals of accuracy
[17:54:38][D][api:102]: Accepted 192.168.1.69
[17:54:38][W][component:214]: Component api took a long time for an operation (0.29 s).
[17:54:38][W][component:215]: Components should block for at most 20-30ms.
[17:54:39][D][pzemac:049]: PZEM AC: V=235.2 V, I=0.000 A, P=0.0 W, E=1.0 Wh, F=49.9 Hz, PF=0.00
[17:54:39][D][sensor:093]: 'Home Voltage': Sending state 235.20000 V with 1 decimals of accuracy
[17:54:39][D][sensor:093]: 'Home Current': Sending state 0.00000 A with 1 decimals of accuracy
[17:54:39][D][sensor:093]: 'Home Power': Sending state 0.00000 W with 1 decimals of accuracy
[17:54:39][D][sensor:093]: 'Home Energy': Sending state 0.00100 kWh with 2 decimals of accuracy
[17:54:39][D][sensor:093]: 'Home Power Factor': Sending state 0.00000 with 2 decimals of accuracy
[17:54:39][D][api.connection:1032]: Home Assistant 2023.10.3 (192.168.1.69): Connected successfully
[17:54:39][D][api.connection:171]: Home Assistant 2023.10.3 (192.168.1.69) requested disconnected
[17:54:42][D][pzemac:049]: PZEM AC: V=237.4 V, I=0.000 A, P=0.0 W, E=1.0 Wh, F=49.9 Hz, PF=0.00
[17:54:42][D][sensor:093]: 'Home Voltage': Sending state 237.39999 V with 1 decimals of accuracy
[17:54:42][D][sensor:093]: 'Home Current': Sending state 0.00000 A with 1 decimals of accuracy
[17:54:42][D][sensor:093]: 'Home Power': Sending state 0.00000 W with 1 decimals of accuracy
[17:54:42][D][sensor:093]: 'Home Energy': Sending state 0.00100 kWh with 2 decimals of accuracy
[17:54:42][D][sensor:093]: 'Home Power Factor': Sending state 0.00000 with 2 decimals of accuracy
[17:54:45][D][api:102]: Accepted 192.168.1.69
[17:54:45][W][component:214]: Component api took a long time for an operation (0.29 s).
[17:54:45][W][component:215]: Components should block for at most 20-30ms.
[17:54:45][D][pzemac:049]: PZEM AC: V=236.2 V, I=0.000 A, P=0.0 W, E=1.0 Wh, F=49.9 Hz, PF=0.00
[17:54:45][D][sensor:093]: 'Home Voltage': Sending state 236.20000 V with 1 decimals of accuracy
[17:54:45][D][sensor:093]: 'Home Current': Sending state 0.00000 A with 1 decimals of accuracy
[17:54:45][D][sensor:093]: 'Home Power': Sending state 0.00000 W with 1 decimals of accuracy
[17:54:45][D][sensor:093]: 'Home Energy': Sending state 0.00100 kWh with 2 decimals of accuracy
[17:54:45][D][sensor:093]: 'Home Power Factor': Sending state 0.00000 with 2 decimals of accuracy
[17:54:47][D][api.connection:1032]: Home Assistant 2023.10.3 (192.168.1.69): Connected successfully
[17:54:47][D][api.connection:171]: Home Assistant 2023.10.3 (192.168.1.69) requested disconnected
[17:54:48][D][pzemac:049]: PZEM AC: V=236.3 V, I=0.000 A, P=0.0 W, E=1.0 Wh, F=49.9 Hz, PF=0.00
[17:54:48][D][sensor:093]: 'Home Voltage': Sending state 236.30000 V with 1 decimals of accuracy
[17:54:48][D][sensor:093]: 'Home Current': Sending state 0.00000 A with 1 decimals of accuracy
[17:54:48][D][sensor:093]: 'Home Power': Sending state 0.00000 W with 1 decimals of accuracy
[17:54:48][D][sensor:093]: 'Home Energy': Sending state 0.00100 kWh with 2 decimals of accuracy
[17:54:49][D][sensor:093]: 'Home Power Factor': Sending state 0.00000 with 2 decimals of accuracy
[17:54:51][D][pzemac:049]: PZEM AC: V=233.7 V, I=0.000 A, P=0.0 W, E=1.0 Wh, F=49.9 Hz, PF=0.00
[17:54:51][D][sensor:093]: 'Home Voltage': Sending state 233.70000 V with 1 decimals of accuracy
[17:54:51][D][sensor:093]: 'Home Current': Sending state 0.00000 A with 1 decimals of accuracy
[17:54:51][D][sensor:093]: 'Home Power': Sending state 0.00000 W with 1 decimals of accuracy
[17:54:51][D][sensor:093]: 'Home Energy': Sending state 0.00100 kWh with 2 decimals of accuracy
[17:54:51][D][sensor:093]: 'Home Power Factor': Sending state 0.00000 with 2 decimals of accuracy
[17:54:52][D][sensor:093]: 'WiFi Sensor': Sending state -67.00000 dBm with 0 decimals of accuracy
[17:54:53][D][api:102]: Accepted 192.168.1.69