Fix ESP32 energy period

Fix ESP32 energy period shows kWh value instead of Wh regression from v12.3.1.5 (#15856)
This commit is contained in:
Theo Arends 2023-03-11 17:01:43 +01:00
parent 2b89b7a134
commit 8a3546e5c4
4 changed files with 5 additions and 3 deletions

View File

@ -24,6 +24,7 @@ All notable changes to this project will be documented in this file.
- TuyaMcu v1 timer integer overflow (#18048)
- PZEM energy monitor stabilize period on larger configs (#18103)
- Rule topic comparison (#18144)
- ESP32 energy period shows kWh value instead of Wh regression from v12.3.1.5 (#15856)
### Removed

View File

@ -140,4 +140,5 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm
- EnergyTotal divided twice during minimal upgrade step regression from v12.3.1.3 [#18024](https://github.com/arendst/Tasmota/issues/18024)
- TuyaMcu v1 timer integer overflow [#18048](https://github.com/arendst/Tasmota/issues/18048)
- PZEM energy monitor stabilize period on larger configs [#18103](https://github.com/arendst/Tasmota/issues/18103)
- Rule topic comparison [#18144](https://github.com/arendst/Tasmota/issues/18144)
- Rule topic comparison [#18144](https://github.com/arendst/Tasmota/issues/18144)
- ESP32 energy period shows kWh value instead of Wh regression from v12.3.1.5 [#15856](https://github.com/arendst/Tasmota/issues/15856)

View File

@ -1304,7 +1304,7 @@ void EnergyShow(bool json) {
if (show_energy_period) {
float energy_period[Energy->phase_count];
for (uint32_t i = 0; i < Energy->phase_count; i++) {
energy_period[i] = (float)(RtcSettings.energy_kWhtoday_ph[i] - Energy->period[i]) / 100;
energy_period[i] = (float)(RtcSettings.energy_kWhtoday_ph[i] - Energy->period[i]) / 100; // Wh
Energy->period[i] = RtcSettings.energy_kWhtoday_ph[i];
}
ResponseAppend_P(PSTR(",\"" D_JSON_PERIOD "\":%s"),

View File

@ -1534,7 +1534,7 @@ void EnergyShow(bool json) {
if (show_energy_period) {
float energy_period[Energy->phase_count];
for (uint32_t i = 0; i < Energy->phase_count; i++) {
energy_period[i] = RtcEnergySettings.energy_today_kWh[i] - Energy->period_kWh[i];
energy_period[i] = (RtcEnergySettings.energy_today_kWh[i] - Energy->period_kWh[i]) * 1000; // Wh
Energy->period_kWh[i] = RtcEnergySettings.energy_today_kWh[i];
}
ResponseAppend_P(PSTR(",\"" D_JSON_PERIOD "\":%s"),