Forecast/Planner: 4-day forecast data (#25385)

This commit is contained in:
Michael Geers 2025-11-22 15:01:37 +01:00 • committed by GitHub
parent 33f8d3f13c
commit e1a8e1a524
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 12 additions and 11 deletions

View file

@ -39,8 +39,8 @@ describe("basics", () => {
result = wrapper.vm.slots;
});
test("should return 39 slots", () => {
expect(result.length).eq(192);
test("should return 384 slots", () => {
expect(result.length).eq(384);
});
test("slots should be an hour apart", () => {

View file

@ -144,7 +144,7 @@ export default defineComponent({
base.setSeconds(0, 0);
base.setMinutes(base.getMinutes() - (base.getMinutes() % 15));
return Array.from({ length: 48 * 4 }, (_, i) => {
return Array.from({ length: 96 * 4 }, (_, i) => {
const start = new Date(base.getTime() + quarterHour * i);
const end = new Date(start.getTime() + quarterHour);
const charging = !!this.findSlotInRange(start, end, plan);

View file

@ -85,7 +85,7 @@ export default defineComponent({
computed: {
endDate() {
const end = new Date(this.startDate);
end.setHours(end.getHours() + 48);
end.setHours(end.getHours() + 96);
return end;
},
solarEntries() {

View file

@ -71,7 +71,7 @@ import { ForecastType, findLowestSumSlotIndex } from "@/utils/forecast";
import type { ForecastSlot, SolarDetails } from "./types";
const LOCALES_WITHOUT_DAY_AFTER_TOMORROW = ["en", "tr"];
const FORECASTED_HOURS = 48;
const FORECASTED_HOURS = 96;
const SLOTS_PER_HOUR = 4;
export interface Energy {

View file

@ -216,7 +216,7 @@ export default defineComponent({
base.setSeconds(0, 0);
base.setMinutes(base.getMinutes() - (base.getMinutes() % 15));
return Array.from({ length: 48 * 4 }, (_, i) => {
return Array.from({ length: 96 * 4 }, (_, i) => {
const start = new Date(base.getTime() + quarterHour * i);
const end = new Date(start.getTime() + quarterHour);
const value = this.findRateInRange(start, end, rates)?.value;

View file

@ -21,7 +21,8 @@ test.describe("battery settings co2", async () => {
await modal.getByRole("link", { name: "Grid charging" }).click();
await modal.getByLabel("Enable limit").check();
await modal.getByLabel("CO₂ limit").selectOption({ label: "≤ 150 g/kWh" });
await expect(modal.getByTestId("active-hours")).toHaveText(["Active time", "48 hr"].join(""));
// CO2 demo tariff provides 72 hours, so active hours vary by test execution time
await expect(modal.getByTestId("active-hours").locator(".value")).toHaveText(/^\d+ hr/);
await expect(modal).toContainText("20 g – 150 g");
await page.getByRole("button", { name: "Close" }).click();
await expectModalHidden(modal);

View file

@ -49,7 +49,7 @@ test.describe("battery settings", async () => {
await modal.getByRole("link", { name: "Grid charging" }).click();
await modal.getByLabel("Enable limit").check();
await modal.getByLabel("Price limit").selectOption({ label: "≤ 50.0 ct/kWh" });
await expect(modal.getByTestId("active-hours")).toHaveText(["Active time", "48 hr"].join(""));
await expect(modal.getByTestId("active-hours")).toHaveText(["Active time", "96 hr"].join(""));
await expect(modal).toContainText("5.0 ct – 50.0 ct");
await page.getByRole("button", { name: "Close" }).click();
await expectModalHidden(modal);

View file

@ -42,7 +42,7 @@ test.describe("smart cost limit", async () => {
await expect(modal).toBeVisible();
await modal.getByLabel("Enable limit").check();
await modal.getByLabel("Price limit").selectOption("≤ 40.0 ct/kWh");
await expect(modal.getByTestId("active-hours")).toHaveText(["Active time", "48 hr"].join(""));
await expect(modal.getByTestId("active-hours")).toHaveText(["Active time", "96 hr"].join(""));
await modal.getByLabel("Close").click();
await expect(modal).not.toBeVisible();
await expect(page.getByTestId("vehicle-status-charger")).toHaveText("Charging…");

View file

@ -31,7 +31,7 @@ test.describe("smart feed-in priority", async () => {
await expectModalVisible(modal);
await modal.getByLabel("Enable limit").check();
await modal.getByLabel("Feed-in limit").selectOption("≥ 10.0 ct/kWh");
await expect(modal.getByTestId("active-hours")).toHaveText(["Paused time", "48 hr"].join(""));
await expect(modal.getByTestId("active-hours")).toHaveText(["Paused time", "96 hr"].join(""));
await modal.getByLabel("Close").click();
await expectModalHidden(modal);
@ -59,7 +59,7 @@ test.describe("smart feed-in priority", async () => {
await expectModalVisible(modal1);
await modal1.getByLabel("Enable limit").check();
await modal1.getByLabel("Feed-in limit").selectOption("≥ 10.0 ct/kWh");
await expect(modal1.getByTestId("active-hours")).toHaveText(["Paused time", "48 hr"].join(""));
await expect(modal1.getByTestId("active-hours")).toHaveText(["Paused time", "96 hr"].join(""));
await modal1.getByRole("button", { name: "Apply everywhere?" }).click();
await modal1.getByLabel("Close").click();
await expectModalHidden(modal1);