[Energy] Fix for New Year's Day (#22536)

Fix rollover on New Year's Day
This commit is contained in:
SteWers 2024-11-23 16:05:15 +01:00 committed by GitHub
parent fb0666e6c8
commit f255233f90
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -407,7 +407,7 @@ void Energy200ms(void) {
}
bool midnight = (LocalTime() == Midnight());
if ((midnight || RtcTime.day_of_year > Settings->energy_kWhdoy) && TasmotaGlobal.uptime > 10) {
if ((midnight || RtcTime.day_of_year != Settings->energy_kWhdoy) && TasmotaGlobal.uptime > 10) {
Energy->kWhtoday_offset_init = true;
Settings->energy_kWhdoy = RtcTime.day_of_year;

View File

@ -663,7 +663,7 @@ void Energy200ms(void) {
}
bool midnight = (LocalTime() == Midnight());
if ((midnight || RtcTime.day_of_year > Energy->Settings.energy_kWhdoy) && TasmotaGlobal.uptime > 10) {
if ((midnight || RtcTime.day_of_year != Energy->Settings.energy_kWhdoy) && TasmotaGlobal.uptime > 10) {
Energy->kWhtoday_offset_init = true;
Energy->Settings.energy_kWhdoy = RtcTime.day_of_year;