Energy power delta report delayed

Energy power delta report delayed by two seconds allowing hardware to stabilize (#17751)
This commit is contained in:
Theo Arends 2023-05-11 18:10:52 +02:00
parent c776885691
commit 86979646ff
4 changed files with 25 additions and 3 deletions

View File

@ -20,6 +20,8 @@ All notable changes to this project will be documented in this file.
### Changed
- ESP32 Framework (Core) from v2.0.8 to v2.0.9
- autoconf extract `display.ini` to file system
- IRremoteESP8266 library from v2.8.4 to v2.8.5
- Energy power delta report delayed by two seconds allowing hardware to stabilize (#17751)
### Fixed
- Partition_Manager.tapp fixed

View File

@ -127,10 +127,14 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm
- Change command ``FileUpload`` index binary data detection from >199 to >299
### Changed
- IRremoteESP8266 library from v2.8.4 to v2.8.5
- ESP32 Framework (Core) from v2.0.7 to v2.0.9
- Refactored Zero Cross Dimmer [#18481](https://github.com/arendst/Tasmota/issues/18481)
- Energy power delta report delayed by two seconds allowing hardware to stabilize [#17751](https://github.com/arendst/Tasmota/issues/17751)
### Fixed
- ESP8266 Energy Export Active no update regression from v12.3.1.3
- NovaSDS GUI values [#18444](https://github.com/arendst/Tasmota/issues/18444)
- Berry fix rules for string comparisons [#18464](https://github.com/arendst/Tasmota/issues/18464)
- Berry fix rules for string comparisons [#18464](https://github.com/arendst/Tasmota/issues/18464)
- Berry a rare condition when a GC causes a memory corruption
- Partition_Manager.tapp

View File

@ -124,6 +124,7 @@ typedef struct {
#ifdef USE_ENERGY_MARGIN_DETECTION
uint16_t power_history[ENERGY_MAX_PHASES][3];
uint8_t power_steady_counter; // Allow for power on stabilization
uint8_t margin_stable;
bool min_power_flag;
bool max_power_flag;
bool min_voltage_flag;
@ -556,7 +557,8 @@ void EnergyMarginCheck(void) {
if (jsonflg) {
ResponseJsonEndEnd();
MqttPublishPrefixTopicRulesProcess_P(TELE, PSTR(D_RSLT_MARGINS), MQTT_TELE_RETAIN);
EnergyMqttShow();
// EnergyMqttShow();
Energy->margin_stable = 3; // Allow 2 seconds to stabilize before reporting
}
#ifdef USE_ENERGY_POWER_LIMIT
@ -681,6 +683,12 @@ void EnergyEverySecond(void) {
#ifdef USE_ENERGY_MARGIN_DETECTION
EnergyMarginCheck();
if (Energy->margin_stable) {
Energy->margin_stable--;
if (!Energy->margin_stable) {
EnergyMqttShow();
}
}
#endif // USE_ENERGY_MARGIN_DETECTION
}

View File

@ -176,6 +176,7 @@ typedef struct {
uint8_t fifth_second;
uint8_t command_code;
uint8_t power_steady_counter; // Allow for power on stabilization
uint8_t margin_stable;
uint8_t mplr_counter;
uint8_t max_energy_state;
@ -772,7 +773,8 @@ void EnergyMarginCheck(void) {
if (jsonflg) {
ResponseJsonEndEnd();
MqttPublishPrefixTopicRulesProcess_P(TELE, PSTR(D_RSLT_MARGINS), MQTT_TELE_RETAIN);
EnergyMqttShow();
// EnergyMqttShow();
Energy->margin_stable = 3; // Allow 2 seconds to stabilize before reporting
}
// Max Power
@ -893,6 +895,12 @@ void EnergyEverySecond(void) {
}
EnergyMarginCheck();
if (Energy->margin_stable) {
Energy->margin_stable--;
if (!Energy->margin_stable) {
EnergyMqttShow();
}
}
}
/*********************************************************************************************\