korkece fve predikce, grafy predikci
Some checks failed
CI and deploy / migration-check (push) Failing after 10s
CI and deploy / deploy (push) Has been skipped

This commit is contained in:
Dusan Vojacek
2026-04-22 19:26:46 +02:00
parent ffe80679cc
commit 9ca4b4c577
10 changed files with 819 additions and 5 deletions

View File

@@ -117,6 +117,74 @@ export async function getForecastPvSlotsRange(
return Array.isArray(data?.slots) ? data.slots : []
}
export type ForecastPvSlotCorrectedRow = {
interval_start: string
pv_forecast_total_w?: number | null
pv_forecast_corrected_w?: number | null
slot_of_day?: number | null
}
export type ForecastPvSlotsCorrectedParams = {
delta_from?: string
delta_to?: string
half_life_days?: number
threshold_w?: number
}
export async function getForecastPvSlotsRangeCorrected(
siteId: number,
fromIso: string,
toIso: string,
params?: ForecastPvSlotsCorrectedParams,
): Promise<ForecastPvSlotCorrectedRow[]> {
const { data } = await client.get<{ slots?: ForecastPvSlotCorrectedRow[] }>(
`/sites/${siteId}/forecast/pv-slots-corrected`,
{ params: { from: fromIso, to: toIso, ...params }, timeout: 45_000 },
)
return Array.isArray(data?.slots) ? data.slots : []
}
export type Telemetry15mRow = {
slot_start: string
site_id: number
avg_pv_w?: number | null
avg_load_w?: number | null
avg_grid_w?: number | null
avg_battery_w?: number | null
last_soc_pct?: number | null
sample_count?: number | null
}
export async function getTelemetry15mRange(
siteId: number,
fromIso: string,
toIso: string,
): Promise<Telemetry15mRow[]> {
const { data } = await client.get<{ slots?: Telemetry15mRow[] }>(`/sites/${siteId}/timeseries/telemetry-15m`, {
params: { from: fromIso, to: toIso },
timeout: 60_000,
})
return Array.isArray(data?.slots) ? data.slots : []
}
export type BaselineLoadSlotRow = {
interval_start: string
forecast_w: number
confidence_w?: number
}
export async function getBaselineLoadSlotsRange(
siteId: number,
fromIso: string,
toIso: string,
): Promise<BaselineLoadSlotRow[]> {
const { data } = await client.get<{ slots?: BaselineLoadSlotRow[] }>(
`/sites/${siteId}/forecast/load-baseline-slots`,
{ params: { from: fromIso, to: toIso }, timeout: 60_000 },
)
return Array.isArray(data?.slots) ? data.slots : []
}
/** GET /api/v1/sites/{id}/prices?date=YYYY-MM-DD */
export type SiteEffectivePriceRowDto = {
site_id: number