Fix PZEM continue energy monitoring when one phase fails (#21968)

This commit is contained in:
Theo Arends 2024-08-15 17:32:11 +02:00
parent bb0db6d8f8
commit 652b9cef87
4 changed files with 12 additions and 10 deletions

View File

@ -12,6 +12,7 @@ All notable changes to this project will be documented in this file.
### Fixed ### Fixed
- Shutter timing registers overflow (#21966) - Shutter timing registers overflow (#21966)
- PZEM continue energy monitoring when one phase fails (#21968)
### Removed ### Removed
- ESP8266 Analog input support using energy driver as only one channel is available - ESP8266 Analog input support using energy driver as only one channel is available

View File

@ -128,6 +128,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm
### Fixed ### Fixed
- Shutter timing registers overflow [#21966](https://github.com/arendst/Tasmota/issues/21966) - Shutter timing registers overflow [#21966](https://github.com/arendst/Tasmota/issues/21966)
- PZEM continue energy monitoring when one phase fails [#21968](https://github.com/arendst/Tasmota/issues/21968)
### Removed ### Removed
- ESP8266 Analog input support using energy driver as only one channel is available - ESP8266 Analog input support using energy driver as only one channel is available

View File

@ -79,14 +79,14 @@ void PzemAcEverySecond(void)
Energy->frequency[PzemAc.phase] = (float)((buffer[17] << 8) + buffer[18]) / 10.0f; // 50.0 Hz Energy->frequency[PzemAc.phase] = (float)((buffer[17] << 8) + buffer[18]) / 10.0f; // 50.0 Hz
Energy->power_factor[PzemAc.phase] = (float)((buffer[19] << 8) + buffer[20]) / 100.0f; // 1.00 Energy->power_factor[PzemAc.phase] = (float)((buffer[19] << 8) + buffer[20]) / 100.0f; // 1.00
Energy->import_active[PzemAc.phase] = (float)((buffer[15] << 24) + (buffer[16] << 16) + (buffer[13] << 8) + buffer[14]) / 1000.0f; // 4294967.295 kWh Energy->import_active[PzemAc.phase] = (float)((buffer[15] << 24) + (buffer[16] << 16) + (buffer[13] << 8) + buffer[14]) / 1000.0f; // 4294967.295 kWh
}
}
if (PzemAc.phase == Energy->phase_count -1) { if (PzemAc.phase == Energy->phase_count -1) {
if (TasmotaGlobal.uptime > (PZEM_AC_STABILIZE * ENERGY_MAX_PHASES)) { if (TasmotaGlobal.uptime > (PZEM_AC_STABILIZE * ENERGY_MAX_PHASES)) {
EnergyUpdateTotal(); EnergyUpdateTotal();
} }
} }
} }
}
}
if (0 == PzemAc.send_retry || data_ready) { if (0 == PzemAc.send_retry || data_ready) {
if (0 == PzemAc.phase) { if (0 == PzemAc.phase) {

View File

@ -81,14 +81,14 @@ void PzemDcEverySecond(void)
Energy->current[PzemDc->channel] = (float)((buffer[5] << 8) + buffer[6]) / 100.0f; // 655.00 A Energy->current[PzemDc->channel] = (float)((buffer[5] << 8) + buffer[6]) / 100.0f; // 655.00 A
Energy->active_power[PzemDc->channel] = (float)((buffer[9] << 24) + (buffer[10] << 16) + (buffer[7] << 8) + buffer[8]) / 10.0f; // 429496729.0 W Energy->active_power[PzemDc->channel] = (float)((buffer[9] << 24) + (buffer[10] << 16) + (buffer[7] << 8) + buffer[8]) / 10.0f; // 429496729.0 W
Energy->import_active[PzemDc->channel] = (float)((buffer[13] << 24) + (buffer[14] << 16) + (buffer[11] << 8) + buffer[12]) / 1000.0f; // 4294967.295 kWh Energy->import_active[PzemDc->channel] = (float)((buffer[13] << 24) + (buffer[14] << 16) + (buffer[11] << 8) + buffer[12]) / 1000.0f; // 4294967.295 kWh
}
}
if (PzemDc->channel == Energy->phase_count -1) { if (PzemDc->channel == Energy->phase_count -1) {
if (TasmotaGlobal.uptime > (PZEM_DC_STABILIZE * ENERGY_MAX_PHASES)) { if (TasmotaGlobal.uptime > (PZEM_DC_STABILIZE * ENERGY_MAX_PHASES)) {
EnergyUpdateTotal(); EnergyUpdateTotal();
} }
} }
} }
}
}
if (0 == PzemDc->send_retry || data_ready) { if (0 == PzemDc->send_retry || data_ready) {
if (0 == PzemDc->channel) { if (0 == PzemDc->channel) {