Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Total energy (today, yesterday) statistical error in three pzem-004t #7301

Closed
4 tasks
boyyao opened this issue Dec 23, 2019 · 6 comments
Closed
4 tasks

Total energy (today, yesterday) statistical error in three pzem-004t #7301

boyyao opened this issue Dec 23, 2019 · 6 comments
Labels
duplicated Result - Duplicated Issue

Comments

@boyyao
Copy link

boyyao commented Dec 23, 2019

PROBLEM DESCRIPTION

A clear and concise description of what the problem is.

REQUESTED INFORMATION

Make sure your have performed every step and checked the applicable boxes before submitting your issue. Thank you!

  • [OK ] Read the Contributing Guide and Policy and the Code of Conduct
  • [OK ] Searched the problem in issues
  • [ OK] Searched the problem in the docs
  • [ OK] Searched the problem in the forum
  • [OK ] Searched the problem in the chat
  • [OK ] Device used (e.g., Sonoff Basic): Sonoff Basic
  • [ OK] Tasmota binary firmware version number used: 7.1.2
    • [OK ] Pre-compiled
    • Self-compiled
      • IDE / Compiler used: _____
  • Flashing tools used: _____
  • [OK ] Provide the output of command: Backlog Template; Module; GPIO 255:
12:01:13 SRC: Backlog
12:01:13 CMD: 组: 0, 索引: 1, 命令: "MODULE", 数据: ""
12:01:13 MQT: stat/tasmota/RESULT = {"Module":{"1":"Sonoff Basic"}}
12:01:14 SRC: Backlog
12:01:14 CMD: 组: 0, 索引: 1, 命令: "GPIO", 数据: "255"
12:01:14 MQT: stat/tasmota/RESULT = {"GPIO0":{"17":"Button1"},"GPIO1":{"98":"PZEM016 Rx"},"GPIO2":{"0":"无"},"GPIO3":{"62":"PZEM0XX Tx"},"GPIO4":{"0":"无"},"GPIO5":{"0":"无"},"GPIO9":{"0":"无"},"GPIO10":{"0":"无"},"GPIO12":{"21":"Relay1"},"GPIO13":{"56":"Led1i"},"GPIO14":{"0":"无"},"GPIO15":{"0":"无"},"GPIO16":{"0":"无"}}



  • [OK ] If using rules, provide the output of this command: Backlog Rule1; Rule2; Rule3:
12:02:43 CMD: Backlog Rule1; Rule2; Rule3
12:02:43 SRC: WebConsole from 192.168.3.237
12:02:43 CMD: 组: 0, 索引: 1, 命令: "BACKLOG", 数据: "Rule1; Rule2; Rule3"
12:02:43 SRC: Backlog
12:02:43 CMD: 组: 0, 索引: 1, 命令: "RULE", 数据: ""
12:02:43 MQT: stat/tasmota/RESULT = {"Rule1":"OFF","Once":"OFF","StopOnError":"OFF","Free":511,"Rules":""}
12:02:43 SRC: Backlog
12:02:43 CMD: 组: 0, 索引: 2, 命令: "RULE", 数据: ""
12:02:43 MQT: stat/tasmota/RESULT = {"Rule2":"OFF","Once":"OFF","StopOnError":"OFF","Free":511,"Rules":""}
12:02:43 DMP: 01 04 14 09 3D 05 45 00 00 0A 30 00 00 47 AB 00 00 01 F4 00 52 00 00 78 EE
12:02:43 SRC: Backlog
12:02:43 CMD: 组: 0, 索引: 3, 命令: "RULE", 数据: ""
12:02:43 MQT: stat/tasmota/RESULT = {"Rule3":"OFF","Once":"OFF","StopOnError":"OFF","Free":511,"Rules":""}


  • [OK ] Provide the output of this command: Status 0:
  12:03:19 CMD: Status 0
12:03:19 SRC: WebConsole from 192.168.3.237
12:03:19 CMD: 组: 0, 索引: 1, 命令: "STATUS", 数据: "0"
12:03:19 MQT: stat/tasmota/STATUS = {"Status":{"Module":1,"FriendlyName":["Tasmota"],"Topic":"tasmota","ButtonTopic":"0","Power":0,"PowerOnState":3,"LedState":1,"LedMask":"FFFF","SaveData":1,"SaveState":1,"SwitchTopic":"0","SwitchMode":[0,0,0,0,0,0,0,0],"ButtonRetain":0,"SwitchRetain":0,"SensorRetain":0,"PowerRetain":0}}
12:03:19 MQT: stat/tasmota/STATUS1 = {"StatusPRM":{"Baudrate":115200,"GroupTopic":"tasmotas","OtaUrl":"http://thehackbox.org/tasmota/release/tasmota.bin","RestartReason":"Hardware Watchdog","Uptime":"0T03:07:19","StartupUTC":"2019-12-23T00:56:00","Sleep":50,"CfgHolder":4617,"BootCount":39,"SaveCount":92,"SaveAddress":"F8000"}}
12:03:19 MQT: stat/tasmota/STATUS2 = {"StatusFWR":{"Version":"7.1.2(tasmota)","BuildDateTime":"2019-12-13T02:31:32","Boot":31,"Core":"2_6_1","SDK":"2.2.2-dev(5ab15d1)","Hardware":"ESP8266EX"}}
12:03:20 MQT: stat/tasmota/STATUS3 = {"StatusLOG":{"SerialLog":0,"WebLog":4,"MqttLog":0,"SysLog":0,"LogHost":"","LogPort":514,"SSId":["傻逼姚的wifi",""],"TelePeriod":60,"Resolution":"558180C0","SetOption":["00008009","2805C8000100060000005A00000000000000","00000000","00000000"]}}
12:03:20 MQT: stat/tasmota/STATUS4 = {"StatusMEM":{"ProgramSize":565,"Free":436,"Heap":22,"ProgramFlashSize":1024,"FlashSize":1024,"FlashChipId":"14405E","FlashMode":3,"Features":["00000804","8FDAE397","003683A0","22B617CD","01001BC0","00007881"],"Drivers":"1,2,3,4,5,6,7,8,9,10,12,16,18,19,20,21,22,24,26,29","Sensors":"1,2,3,4,5,6,7,8,9,10,14,15,17,18,20,22,26,34"}}
12:03:20 MQT: stat/tasmota/STATUS5 = {"StatusNET":{"Hostname":"tasmota-6296","IPAddress":"192.168.3.3","Gateway":"192.168.3.1","Subnetmask":"255.255.255.0","DNSServer":"192.168.3.1","Mac":"EC:FA:BC:62:B8:98","Webserver":2,"WifiConfig":4}}
12:03:20 MQT: stat/tasmota/STATUS6 = {"StatusMQT":{"MqttHost":"192.168.3.2","MqttPort":1883,"MqttClientMask":"DVES_%06X","MqttClient":"DVES_62B898","MqttUser":"mqtt","MqttCount":1,"MAX_PACKET_SIZE":1000,"KEEPALIVE":30}}
12:03:20 MQT: stat/tasmota/STATUS7 = {"StatusTIM":{"UTC":"Mon Dec 23 04:03:20 2019","Local":"Mon Dec 23 12:03:20 2019","StartDST":"Sun Mar 31 02:00:00 2019","EndDST":"Sun Oct 27 03:00:00 2019","Timezone":"+08:00","Sunrise":"15:41","Sunset":"23:56"}}
12:03:20 MQT: stat/tasmota/STATUS9 = {"StatusPTH":{"PowerDelta":0,"PowerLow":0,"PowerHigh":0,"VoltageLow":0,"VoltageHigh":0,"CurrentLow":0,"CurrentHigh":0}}
12:03:20 MQT: stat/tasmota/STATUS10 = {"StatusSNS":{"Time":"2019-12-23T12:03:20","ENERGY":{"TotalStartTime":"2019-12-22T06:58:59","Total":52.093,"Yesterday":27.058,"Today":25.035,"Power":[265,14,157],"ApparentPower":[322,47,180],"ReactivePower":[182,45,87],"Factor":[0.82,0.29,0.87],"Frequency":[50,50,50],"Voltage":[236,236,238],"Current":[1.363,0.198,0.757]}}}
12:03:20 MQT: stat/tasmota/STATUS11 = {"StatusSTS":{"Time":"2019-12-23T12:03:20","Uptime":"0T03:07:20","UptimeSec":11240,"Heap":22,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"POWER":"OFF","Wifi":{"AP":1,"SSId":"傻逼姚的wifi","BSSId":"00:90:4C:18:C2:34","Channel":10,"RSSI":100,"LinkCount":1,"Downtime":"0T00:00:08"}}}



  • Provide the output of the Console log output when you experience your issue; if applicable:
    (Please use weblog 4 for more debug information)
  Console output here:


TO REPRODUCE

Steps to reproduce the behavior:

EXPECTED BEHAVIOUR

A clear and concise description of what you expected to happen.

SCREENSHOTS

If applicable, add screenshots to help explain your problem.
p

ADDITIONAL CONTEXT

Add any other context about the problem here.
At first it looked very normal.

But recently, I found that the energy statistics seem to violate the normal values I actually use. So I opened the log and found out. The statistical energy is actually higher than the total energy sent back by three 004ts. And today, yesterday and total energy refresh is slow

The data are as follows:

11:45:02 DMP: 02 04 14 09 54 00 C7 00 00 00 89 00 00 14 1C 00 00 01 F4 00 1D 00 00 C5 47
11:45:03 DMP: 01 04 14 09 52 05 47 00 00 0A 4B 00 00 47 5D 00 00 01 F4 00 52 00 00 9A 8C
11:45:04 DMP: 03 04 14 09 60 03 48 00 00 02 EA 00 00 1E 31 00 00 01 F4 00 25 00 00 F5 AD
2=14 1C = 5148Wh
1= 47 5D = 18269Wh
3=1E 31 = 7729Wh
total = 31146Wh =31.146kWh

(Please, remember to close the issue when the problem has been addressed)

@boyyao
Copy link
Author

boyyao commented Dec 23, 2019

Problem solved
Settings.flag3.hardware_energy_total) { // SetOption72 - Enable hardware energy total counter as reference (#6561)

@boyyao boyyao closed this as completed Dec 23, 2019
@boyyao
Copy link
Author

boyyao commented Dec 24, 2019

Updat:

Is it possible that too much accumulation is not handled here?

` // 0 1 2 3 4 5 6 7 8 9 = ModBus register
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 = Buffer index
// 01 04 14 08 D1 00 6C 00 00 00 F4 00 00 00 26 00 00 01 F4 00 64 00 00 51 34
// Id Cc Sz Volt- Current---- Power------ Energy----- Frequ PFact Alarm Crc--
Energy.voltage[PzemAc.phase] = (float)((buffer[3] << 8) + buffer[4]) / 10.0; // 6553.0 V
Energy.current[PzemAc.phase] = (float)((buffer[7] << 24) + (buffer[8] << 16) + (buffer[5] << 8) + buffer[6]) / 1000.0; // 4294967.000 A
Energy.active_power[PzemAc.phase] = (float)((buffer[11] << 24) + (buffer[12] << 16) + (buffer[9] << 8) + buffer[10]) / 10.0; // 429496729.0 W
Energy.frequency[PzemAc.phase] = (float)((buffer[17] << 8) + buffer[18]) / 10.0; // 50.0 Hz
Energy.power_factor[PzemAc.phase] = (float)((buffer[19] << 8) + buffer[20]) / 100.0; // 1.00

    PzemAc.energy += (float)((buffer[15] << 24) + (buffer[16] << 16) + (buffer[13] << 8) + buffer[14]);                           // 4294967295 Wh
    if (PzemAc.phase == Energy.phase_count -1) { //  If too many  phase????????
      if (PzemAc.energy > PzemAc.last_energy) {  // Handle missed phase
        if (uptime > PZEM_AC_STABILIZE) {
          EnergyUpdateTotal(PzemAc.energy, false);
        }
        PzemAc.last_energy = PzemAc.energy;
      }
      PzemAc.energy = 0;
    }`

In the beginning, everything is normal, but after a period of time (maybe an hour or more), the total value will become the data from which to supplement, and the value is the same as that without opt72.

11:40:41 DMP: 03 04 14 09 6A 03 9A 00 00 03 E3 00 00 2E F9 00 00 01 F3 00 2D 00 00 8C DD
11:40:42 DMP: 02 04 14 09 5D 01 60 00 00 02 A8 00 00 2D 6A 00 00 01 F4 00 51 00 00 A0 73
11:40:43 DMP: 01 04 14 09 5D 06 04 00 00 0C 63 00 00 5D BA 00 00 01 F4 00 56 00 00 15 57
11:40:44 DMP: 03 04 14 09 6A 03 9B 00 00 03 E2 00 00 2E F9 00 00 01 F4 00 2D 00 00 6A 0C
11:40:44 NRG: Energy Total 47645.0000 Wh
11:40:44 NRG: Energy Total updated with hardware value
11:40:45 DMP: 02 04 14 09 5C 00 C8 00 00 00 8B 00 00 2D 6A 00 00 01 F4 00 1D 00 00 8B 25
11:40:46 DMP: 01 04 14 09 5C 06 06 00 00 0C 62 00 00 5D BA 00 00 01 F3 00 56 00 00 3E 8A
11:40:47 DMP: 03 04 14 09 6A 03 72 00 00 03 03 00 00 2E F9 00 00 01 F3 00 24 00 00 EC 8A
11:40:48 DMP: 02 04 14 09 5D 00 C7 00 00 00 8A 00 00 2D 6A 00 00 01 F4 00 1D 00 00 81 AB
11:40:49 DMP: 01 04 14 09 5B 06 02 00 00 0C 5F 00 00 5D BA 00 00 01 F4 00 56 00 00 2E 42
11:40:50 MQT: tele/tasmota/STATE = {"Time":"2019-12-24T11:40:50","Uptime":"0T00:08:43","UptimeSec":523,"Heap":27,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"POWER":"ON","Wifi":{"AP":1,"SSId":"傻逼姚的wifi","BSSId":"00:90:4C:18:C2:34","Channel":10,"RSSI":100,"Signal":-45,"LinkCount":1,"Downtime":"0T00:00:07"}}
11:40:50 MQT: tele/tasmota/SENSOR = {"Time":"2019-12-24T11:40:50","ENERGY":{"TotalStartTime":"2019-12-24T00:00:00","Total":47.645,"Yesterday":0.000,"Today":63.798,"Period":2,"Power":[317,14,77],"ApparentPower":[368,48,213],"ReactivePower":[188,46,198],"Factor":[0.86,0.29,0.36],"Frequency":[50,50,50],"Voltage":[239,240,241],"Current":[1.538,0.199,0.882]}}
11:40:55 WIF: 检查连接...
11:40:55 WIF: 已连接
11:40:55 DMP: 02 04 14 09 5D 00 F3 00 00 01 0C 00 00 2D 6A 00 00 01 F4 00 2E 00 00 D1 AC
11:40:56 DMP: 01 04 14 09 5B 06 14 00 00 0C 7F 00 00 5D BB 00 00 01 F4 00 56 00 00 B2 D6
11:40:57 DMP: 03 04 14 09 6A 03 9B 00 00 03 E6 00 00 2E F9 00 00 01 F4 00 2D 00 00 64 88
11:40:57 NRG: Energy Total 83266.0000 Wh
11:40:57 NRG: Energy Total updated with hardware value
11:40:58 DMP: 02 04 14 09 5D 00 F3 00 00 01 0B 00 00 2D 6A 00 00 01 F3 00 2E 00 00 6F 2B
11:40:59 DMP: 01 04 14 09 5B 06 0B 00 00 0C 68 00 00 5D BB 00 00 01 F3 00 56 00 00 0A F7
11:41:00 DMP: 03 04 14 09 6B 03 9C 00 00 03 E6 00 00 2E F9 00 00 01 F3 00 2D 00 00 5E 85
11:41:00 MQT: tele/tasmota/STATE = {"Time":"2019-12-24T11:41:00","Uptime":"0T00:08:53","UptimeSec":533,"Heap":27,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"POWER":"ON","Wifi":{"AP":1,"SSId":"傻逼姚的wifi","BSSId":"00:90:4C:18:C2:34","Channel":10,"RSSI":100,"Signal":-44,"LinkCount":1,"Downtime":"0T00:00:07"}}
11:41:00 MQT: tele/tasmota/SENSOR = {"Time":"2019-12-24T11:41:00","ENERGY":{"TotalStartTime":"2019-12-24T00:00:00","Total":83.266,"Yesterday":0.000,"Today":99.419,"Period":35621,"Power":[318,27,100],"ApparentPower":[371,58,223],"ReactivePower":[191,52,199],"Factor":[0.86,0.46,0.45],"Frequency":[50,50,50],"Voltage":[239,240,241],"Current":[1.547,0.243,0.924]}}

@boyyao boyyao reopened this Dec 24, 2019
@sheminasalam
Copy link

what is the difference between setoption 72 enabled and disabled?

@pablozg
Copy link
Contributor

pablozg commented Dec 25, 2019

what is the difference between setoption 72 enabled and disabled?

The setoption72 works only in hardware with total energy counter like sdm120, ddsu666, etc.

The reported value is used to update tasmota internal counter and be in sync both counters.

If enabled, tasmota use the reported value as total energy counter.

@ascillato2
Copy link
Collaborator

This issue seems to be the same as #7155

Closing this one in order to have just one thread for the same issue

@ascillato2 ascillato2 added the duplicated Result - Duplicated Issue label Dec 29, 2019
@leranp
Copy link

leranp commented Feb 9, 2021

Same here, the value from the pzem doesn't match the tasmota value in the console, with SetOption72 is ON .
I have also 3 pzem connecting to same board via TX RX
Any solution for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicated Result - Duplicated Issue
Projects
None yet
Development

No branches or pull requests

5 participants