Skip to content

Commit

Permalink
4.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Hombach authored and Hombach committed Dec 4, 2024
1 parent 80d75bc commit e403d5f
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 2 deletions.
2 changes: 2 additions & 0 deletions build/lib/tibberAPICaller.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/lib/tibberAPICaller.js.map

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions build/lib/tibberCalculator.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/lib/tibberCalculator.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/lib/tibberAPICaller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@ export class TibberAPICaller extends ProjectUtils {
this.adapter.log.debug(`Got prices today from tibber api: ${JSON.stringify(pricesToday)} Force: ${forceUpdate}`);
void this.checkAndSetValue(`Homes.${homeId}.PricesToday.json`, JSON.stringify(pricesToday), "The prices today as json"); // write also it might be empty
//WiP 600
void this.checkAndSetValue(`Homes.${homeId}.PricesYesterday.json`, JSON.stringify(exPricesToday), "The prices yesterday as json");
//WiP 600
this.fetchPriceAverage(homeId, `PricesToday.average`, pricesToday);
this.fetchPriceRemainingAverage(homeId, `PricesToday.averageRemaining`, pricesToday);
this.fetchPriceMaximum(
Expand Down
16 changes: 16 additions & 0 deletions src/lib/tibberCalculator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -776,6 +776,9 @@ export class TibberCalculator extends ProjectUtils {
if (modeLTF) {
// Limited Time Frame mode
const pricesTomorrow: IPrice[] = JSON.parse(await this.getStateValue(`Homes.${channelConfig.chHomeID}.PricesTomorrow.json`));
//WiP 600
const pricesYesterday: IPrice[] = JSON.parse(await this.getStateValue(`Homes.${channelConfig.chHomeID}.PricesYesterday.json`));
//WiP 600
const startTime: Date = channelConfig.chStartTime;
const stopTime: Date = channelConfig.chStopTime;

Expand All @@ -784,6 +787,11 @@ export class TibberCalculator extends ProjectUtils {
if (pricesTomorrow.length !== 0) {
mergedPrices = [...pricesToday, ...pricesTomorrow];
}
//WiP 600
if (pricesYesterday.length !== 0) {
mergedPrices = [...pricesYesterday, ...mergedPrices];
}
//WiP 600

// filter objects to time frame
filteredPrices = mergedPrices.filter(price => {
Expand Down Expand Up @@ -873,6 +881,9 @@ export class TibberCalculator extends ProjectUtils {
if (modeLTF) {
// Limited Time Frame mode, modify filteredPrices accordingly
const pricesTomorrow: IPrice[] = JSON.parse(await this.getStateValue(`Homes.${channelConfig.chHomeID}.PricesTomorrow.json`));
//WiP 600
const pricesYesterday: IPrice[] = JSON.parse(await this.getStateValue(`Homes.${channelConfig.chHomeID}.PricesYesterday.json`));
//WiP 600
const startTime: Date = channelConfig.chStartTime;
const stopTime: Date = channelConfig.chStopTime;

Expand All @@ -881,6 +892,11 @@ export class TibberCalculator extends ProjectUtils {
if (pricesTomorrow.length !== 0) {
mergedPrices = [...pricesToday, ...pricesTomorrow];
}
//WiP 600
if (pricesYesterday.length !== 0) {
mergedPrices = [...pricesYesterday, ...mergedPrices];
}
//WiP 600

// filter objects to time frame
filteredPrices = mergedPrices.filter(price => {
Expand Down

0 comments on commit e403d5f

Please sign in to comment.