dalsi uprava vypoctu delty (ignorujeme orezane vyroby)
Some checks failed
CI and deploy / migration-check (push) Failing after 17s
CI and deploy / deploy (push) Has been skipped

This commit is contained in:
Dusan Vojacek
2026-04-22 22:42:12 +02:00
parent 568b584748
commit 1dfab8c7a1
11 changed files with 174 additions and 12 deletions

View File

@@ -1,7 +1,10 @@
import axios, { type AxiosInstance } from 'axios'
import type { FullStatusResponse } from '../types/fullStatus'
import type { SiteConfigurationResponse } from '../types/siteConfiguration'
import type {
SiteConfigurationResponse,
SitePvForecastCalibrationRow,
} from '../types/siteConfiguration'
import type { Notification } from '../types/dashboard'
import type { CurrentPlanResponse, RunPlanResponse } from '../types/plan'
@@ -59,6 +62,28 @@ export async function getSiteConfiguration(siteId: number): Promise<SiteConfigur
return data
}
/** PATCH /sites/{id}/configuration/pv-forecast-calibration — pouze uvedená pole. */
export type PvForecastCalibrationPatchPayload = {
delta_learn_min_ts?: string
pv_curtailment_policy_effective_from?: string | null
top_n_days?: number | null
non_top_day_factor?: number | null
day_weight_gamma?: number | null
half_life_days?: number | null
threshold_w?: number | null
}
export async function patchPvForecastCalibration(
siteId: number,
payload: PvForecastCalibrationPatchPayload,
): Promise<SitePvForecastCalibrationRow> {
const { data } = await client.patch<SitePvForecastCalibrationRow>(
`/sites/${siteId}/configuration/pv-forecast-calibration`,
payload,
)
return data as SitePvForecastCalibrationRow
}
export type SiteNotificationsResponse = {
notifications: Notification[]
}

View File

@@ -32,6 +32,19 @@ export type SiteConfigurationOperational = {
active_plan_created_at: string | null
}
/** Řádek `ems.site_pv_forecast_calibration` (GET /configuration → `pv_forecast_calibration`). */
export type SitePvForecastCalibrationRow = {
site_id: number
delta_learn_min_ts: string
pv_curtailment_policy_effective_from?: string | null
top_n_days?: number | null
non_top_day_factor?: number | string | null
day_weight_gamma?: number | string | null
half_life_days?: number | string | null
threshold_w?: number | null
updated_at?: string
}
export type SiteConfigurationResponse = {
site: SiteConfigurationSite
grid_connection: Record<string, unknown> | null
@@ -46,5 +59,7 @@ export type SiteConfigurationResponse = {
heat_pumps: Record<string, unknown>[]
operating_mode: Record<string, unknown> | null
active_overrides: Record<string, unknown>[]
/** Kalibrace PV delty; null pokud v DB chybí řádek (měl by existovat po V057). */
pv_forecast_calibration?: SitePvForecastCalibrationRow | null
operational: SiteConfigurationOperational
}