Skip to content

Commit

Permalink
Silly bugfix reg solar plant override
Browse files Browse the repository at this point in the history
  • Loading branch information
msegzda committed Feb 16, 2025
1 parent d0dd3a6 commit d4f7cb3
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,14 @@ export class Functions {

const today = DateTime.local();
const todayKey = fnc_todayKey(config);
if (today.month < 3 || today.month > 9) {
this.platform.log.warn('Solar power plant override applies in March-September months only.');
this.pricesCache.set(`solarOverrideApplied_${todayKey}`, true);

if ( !force && this.pricesCache.getSync(`solarOverrideApplied_${todayKey}`) ) {
return;
}

if ( !force && this.pricesCache.getSync(`solarOverrideApplied_${todayKey}`) ) {
if (today.month < 3 || today.month > 9) {
this.platform.log.warn('Solar power plant override applies in March-September months only.');
this.pricesCache.set(`solarOverrideApplied_${todayKey}`, true);
return;
}

Expand Down

0 comments on commit d4f7cb3

Please sign in to comment.