[Energy] fix PowerDelta

The power change must be greater then the "PowerDelta" value. So it was not possible to send a MQTT message for a change of 1 W.
This commit is contained in:
SteWers 2022-02-07 22:33:09 +01:00 committed by GitHub
parent 708f80d353
commit 39979b5aab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -376,11 +376,11 @@ void EnergyMarginCheck(void)
uint16_t min_power = (Energy.power_history[phase][0] > active_power) ? active_power : Energy.power_history[phase][0];
if (0 == min_power) { min_power++; } // Fix divide by 0 exception (#6741)
delta = (delta * 100) / min_power;
if (delta > Settings->energy_power_delta[phase]) {
if (delta >= Settings->energy_power_delta[phase]) {
threshold_met = true;
}
} else { // 101..32000 = Absolute
if (delta > (Settings->energy_power_delta[phase] -100)) {
if (delta >= (Settings->energy_power_delta[phase] -100)) {
threshold_met = true;
}
}