@enyo-energy/energy-app-sdk 1.19.0 → 1.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -212,8 +212,14 @@ Energy Apps follow a specific lifecycle managed by the enyo system:
212
212
  const energyApp = new EnergyApp();
213
213
 
214
214
  // Register startup callback
215
- energyApp.register((packageName, version) => {
216
- console.log(`${packageName} v${version} started`);
215
+ energyApp.register((packageName, version, channel, deviceId, environment) => {
216
+ console.log(`${packageName} v${version} started on ${deviceId} (${channel}, ${environment})`);
217
+
218
+ // e.g. skip hardware access when running in the developer portal simulation
219
+ if (environment === EnyoEnergyAppEnvironment.DeveloperPortalSimulation) {
220
+ console.log('Running in simulation - using mocked devices');
221
+ }
222
+
217
223
  energyApp.updateEnergyAppState(EnergyAppStateEnum.Running);
218
224
  });
219
225
 
@@ -369,6 +375,7 @@ Energy Apps use a granular permissions system to control access to system resour
369
375
  - **`EnergyManager`**: Run as the active energy manager
370
376
  - **`EnergyManagerInfo`**: Read information about the active energy manager
371
377
  - **`WeatherForecastRegister`** / **`WeatherForecastUse`**: Publish / consume weather forecasts
378
+ - **`WeatherHistoryRegister`** / **`WeatherHistoryUse`**: Publish / consume observed (past) weather data
372
379
  - **`PvForecastRegister`** / **`PvForecastUse`**: Publish / consume PV forecasts
373
380
  - **`DynamicPriceForecastRegister`** / **`DynamicPriceForecastUse`**: Publish / consume dynamic-price forecasts
374
381
  - **`PvSystemRegister`** / **`PvSystemUse`**: Register / read PV system configuration
@@ -1763,6 +1770,86 @@ const byCoords = await weather.getWeatherForecastByCoordinates('wx-prod', 48.13,
1763
1770
 
1764
1771
  Publishers need `WeatherForecastRegister`; consumers need `WeatherForecastUse`.
1765
1772
 
1773
+ #### `useWeatherHistory(): EnergyAppWeatherHistory`
1774
+
1775
+ The backward-looking counterpart. Where forecasting says what the weather *will* do, this says what it
1776
+ *did* between two timestamps — temperature, wind, cloud cover and solar irradiance. That is what you
1777
+ need to correlate measured consumption with the weather that drove it, build heating-degree-day
1778
+ statistics, check measured PV production against the irradiance that was actually available, or train
1779
+ a consumption model on outdoor conditions.
1780
+
1781
+ ```typescript
1782
+ const weatherHistory = energyApp.useWeatherHistory();
1783
+
1784
+ await weatherHistory.registerHistory({
1785
+ historyId: 'dwd-archive',
1786
+ name: 'DWD Climate Archive',
1787
+ vendor: 'Deutscher Wetterdienst',
1788
+ availableHistoryDays: 730,
1789
+ availableMeasures: [
1790
+ WeatherHistoryMeasureEnum.OutdoorTemperature,
1791
+ WeatherHistoryMeasureEnum.WindSpeed,
1792
+ WeatherHistoryMeasureEnum.GlobalHorizontalIrradiance,
1793
+ ],
1794
+ });
1795
+
1796
+ const temperatures = await weatherHistory.getOutdoorTemperature('dwd-archive', {
1797
+ fromIso: '2026-01-15T00:00:00Z',
1798
+ untilIso: '2026-01-16T00:00:00Z',
1799
+ resolution: WeatherHistoryResolutionEnum.OneHour, // optional, defaults to the provider's
1800
+ });
1801
+
1802
+ temperatures.averageCelsius; // time-weighted mean over the interval
1803
+ temperatures.minCelsius;
1804
+ temperatures.maxCelsius;
1805
+ temperatures.readings; // [{ timestampIso, outdoorTemperatureCelsius }, …]
1806
+ ```
1807
+
1808
+ The interval is half-open — `fromIso` included, `untilIso` excluded — so consecutive intervals line
1809
+ up without double-counting the boundary. A `resolution` finer than the provider's is filled by
1810
+ linear interpolation, a coarser one aggregated as a time-weighted average.
1811
+
1812
+ Reaching further back than the archive goes is **not** an error: you get the covered part plus
1813
+ `coveredFromIso` / `coveredUntilIso` telling you where the data actually began and ended, and an
1814
+ interval the provider holds nothing for returns empty `readings` with no aggregates.
1815
+
1816
+ No location is passed: the registered provider resolves the device's own location through
1817
+ `useLocation()`, so a consumer only states the interval it wants.
1818
+
1819
+ For anything beyond temperature — irradiance, wind, cloud cover — use `getWeatherHistory`, which
1820
+ returns every requested measure per bucket:
1821
+
1822
+ ```typescript
1823
+ const history = await weatherHistory.getWeatherHistory('open-meteo-archive', {
1824
+ fromIso: '2026-01-15T00:00:00Z',
1825
+ untilIso: '2026-01-16T00:00:00Z',
1826
+ resolution: WeatherHistoryResolutionEnum.OneHour,
1827
+ measures: [ // optional, defaults to everything held
1828
+ WeatherHistoryMeasureEnum.GlobalHorizontalIrradiance,
1829
+ WeatherHistoryMeasureEnum.WindSpeed,
1830
+ WeatherHistoryMeasureEnum.CloudArea,
1831
+ ],
1832
+ });
1833
+
1834
+ history.measures; // what actually came back
1835
+ history.readings; // [{ timestampIso, globalHorizontalIrradiance, windSpeedMs, … }, …]
1836
+ history.statistics?.[WeatherHistoryMeasureEnum.WindSpeed]?.averageValue;
1837
+ ```
1838
+
1839
+ Field names and units mirror `WeatherForecastEntry` one to one — `outdoorTemperatureCelsius`,
1840
+ `windSpeedMs`, `cloudAreaPercent` (0–100), `symbol`, and `globalHorizontalIrradiance` /
1841
+ `directNormalIrradiance` / `diffuseHorizontalIrradiance` in W/m² — so an observed series and a
1842
+ forecast series concatenate into one timeline without translation. Every measure on a reading is
1843
+ optional: you get what the provider holds and you asked for, and a measure it does not hold is simply
1844
+ absent rather than an error.
1845
+
1846
+ Aggregates per measure live in `statistics`, keyed by `WeatherHistoryMeasureEnum`. `averageValue` is
1847
+ time-weighted; for the irradiance measures it is a mean power density in W/m², so multiply by the
1848
+ covered duration in hours to get received energy in Wh/m². `symbol` is categorical and therefore
1849
+ never appears in `statistics`.
1850
+
1851
+ Publishers need `WeatherHistoryRegister`; consumers need `WeatherHistoryUse`.
1852
+
1766
1853
  #### `usePvForecasting(): EnergyAppPvForecasting`
1767
1854
 
1768
1855
  Same shape as weather forecasting, but for PV production.
@@ -37,6 +37,8 @@ var EnergyAppPermissionTypeEnum;
37
37
  EnergyAppPermissionTypeEnum["EnergyPrices"] = "EnergyPrices";
38
38
  EnergyAppPermissionTypeEnum["WeatherForecastRegister"] = "WeatherForecastRegister";
39
39
  EnergyAppPermissionTypeEnum["WeatherForecastUse"] = "WeatherForecastUse";
40
+ EnergyAppPermissionTypeEnum["WeatherHistoryRegister"] = "WeatherHistoryRegister";
41
+ EnergyAppPermissionTypeEnum["WeatherHistoryUse"] = "WeatherHistoryUse";
40
42
  EnergyAppPermissionTypeEnum["PvForecastRegister"] = "PvForecastRegister";
41
43
  EnergyAppPermissionTypeEnum["PvForecastUse"] = "PvForecastUse";
42
44
  EnergyAppPermissionTypeEnum["DynamicPriceForecastRegister"] = "DynamicPriceForecastRegister";
@@ -33,6 +33,8 @@ export declare enum EnergyAppPermissionTypeEnum {
33
33
  EnergyPrices = "EnergyPrices",
34
34
  WeatherForecastRegister = "WeatherForecastRegister",
35
35
  WeatherForecastUse = "WeatherForecastUse",
36
+ WeatherHistoryRegister = "WeatherHistoryRegister",
37
+ WeatherHistoryUse = "WeatherHistoryUse",
36
38
  PvForecastRegister = "PvForecastRegister",
37
39
  PvForecastUse = "PvForecastUse",
38
40
  DynamicPriceForecastRegister = "DynamicPriceForecastRegister",
@@ -14,7 +14,7 @@ const version_js_1 = require("./version.cjs");
14
14
  * @example
15
15
  * ```ts
16
16
  * const app = new EnergyApp();
17
- * app.register((packageName, version, channel, deviceId) => {
17
+ * app.register((packageName, version, channel, deviceId, environment) => {
18
18
  * // perform initialization
19
19
  * });
20
20
  * ```
@@ -51,6 +51,12 @@ class EnergyApp {
51
51
  updateEnergyAppState(state) {
52
52
  this.energyAppSdk.updateEnergyAppState(state);
53
53
  }
54
+ /**
55
+ * Registers the package with the enyo system.
56
+ * @param callback - Invoked once the package is initialized with the package name,
57
+ * the installed package version, the {@link EnyoPackageChannel} it was installed from,
58
+ * the id of the device it runs on and the {@link EnyoEnergyAppEnvironment} it is executed in
59
+ */
54
60
  register(callback) {
55
61
  // This registers the package with the enyo system
56
62
  this.energyAppSdk.register(callback);
@@ -182,6 +188,15 @@ class EnergyApp {
182
188
  useWeatherForecasting() {
183
189
  return this.energyAppSdk.useWeatherForecasting();
184
190
  }
191
+ /**
192
+ * Gets the Weather History API for managing weather history providers and retrieving observed weather data.
193
+ * Provides methods to register/deregister weather history providers, list available providers,
194
+ * and fetch the outdoor temperature for a past time interval by zip code or coordinates.
195
+ * @returns The Weather History API instance
196
+ */
197
+ useWeatherHistory() {
198
+ return this.energyAppSdk.useWeatherHistory();
199
+ }
185
200
  /**
186
201
  * Gets the PV Forecasting API for managing PV forecast providers and retrieving PV forecasts.
187
202
  * Provides methods to register/deregister PV forecast providers and fetch power production forecasts.
@@ -19,9 +19,11 @@ import { EnergyAppOnboarding } from "./packages/energy-app-onboarding.cjs";
19
19
  import { EnergyAppOnboardingV2 } from "./packages/energy-app-onboarding-v2.cjs";
20
20
  import { EnergyAppTimeseries } from "./packages/energy-app-timeseries.cjs";
21
21
  import { EnyoPackageChannel } from "./enyo-package-channel.cjs";
22
+ import { EnyoEnergyAppEnvironment } from "./enyo-energy-app-environment.cjs";
22
23
  import { EnergyAppEnergyManager } from "./packages/energy-app-energy-manager.cjs";
23
24
  import { EnergyAppElectricityTariff } from "./packages/energy-app-electricity-tariff.cjs";
24
25
  import { EnergyAppWeatherForecasting } from "./packages/energy-app-weather-forecasting.cjs";
26
+ import { EnergyAppWeatherHistory } from "./packages/energy-app-weather-history.cjs";
25
27
  import { EnergyAppPvForecasting } from "./packages/energy-app-pv-forecasting.cjs";
26
28
  import { EnergyAppDynamicPriceForecast } from "./packages/energy-app-dynamic-price-forecast.cjs";
27
29
  import { EnergyAppPvSystem } from "./packages/energy-app-pv-system.cjs";
@@ -61,7 +63,7 @@ import { UseFetchOptions } from "./types/enyo-fetch.cjs";
61
63
  * @example
62
64
  * ```ts
63
65
  * const app = new EnergyApp();
64
- * app.register((packageName, version, channel, deviceId) => {
66
+ * app.register((packageName, version, channel, deviceId, environment) => {
65
67
  * // perform initialization
66
68
  * });
67
69
  * ```
@@ -79,7 +81,13 @@ export declare class EnergyApp implements EnyoEnergyAppSdk {
79
81
  */
80
82
  onNetworkStatusChanged(listener: (online: boolean) => void | Promise<void>): string;
81
83
  updateEnergyAppState(state: EnergyAppStateEnum): void;
82
- register(callback: (packageName: string, version: number, channel: EnyoPackageChannel, deviceId: string) => void | Promise<void>): void;
84
+ /**
85
+ * Registers the package with the enyo system.
86
+ * @param callback - Invoked once the package is initialized with the package name,
87
+ * the installed package version, the {@link EnyoPackageChannel} it was installed from,
88
+ * the id of the device it runs on and the {@link EnyoEnergyAppEnvironment} it is executed in
89
+ */
90
+ register(callback: (packageName: string, version: number, channel: EnyoPackageChannel, deviceId: string, environment: EnyoEnergyAppEnvironment) => void | Promise<void>): void;
83
91
  onShutdown(callback: () => void | Promise<void>): void;
84
92
  /**
85
93
  * Returns a `fetch` implementation provided by the runtime.
@@ -154,6 +162,13 @@ export declare class EnergyApp implements EnyoEnergyAppSdk {
154
162
  * @returns The Weather Forecasting API instance
155
163
  */
156
164
  useWeatherForecasting(): EnergyAppWeatherForecasting;
165
+ /**
166
+ * Gets the Weather History API for managing weather history providers and retrieving observed weather data.
167
+ * Provides methods to register/deregister weather history providers, list available providers,
168
+ * and fetch the outdoor temperature for a past time interval by zip code or coordinates.
169
+ * @returns The Weather History API instance
170
+ */
171
+ useWeatherHistory(): EnergyAppWeatherHistory;
157
172
  /**
158
173
  * Gets the PV Forecasting API for managing PV forecast providers and retrieving PV forecasts.
159
174
  * Provides methods to register/deregister PV forecast providers and fetch power production forecasts.
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EnyoEnergyAppEnvironment = void 0;
4
+ /**
5
+ * Runtime environment an energy app is executed in.
6
+ *
7
+ * The environment is handed to the callback passed to `register()` so an app can
8
+ * adapt its behaviour, e.g. use verbose logging or mocked hardware access while
9
+ * developing, and skip anything that requires real hardware when it runs inside
10
+ * the developer portal simulation.
11
+ */
12
+ var EnyoEnergyAppEnvironment;
13
+ (function (EnyoEnergyAppEnvironment) {
14
+ /** Running on a real enyo device in development mode (e.g. a developer's test device). */
15
+ EnyoEnergyAppEnvironment["OnDeviceDevelopment"] = "on-device-development";
16
+ /** Running on a real enyo device in production, i.e. at a customer's site. */
17
+ EnyoEnergyAppEnvironment["OnDeviceProduction"] = "on-device-production";
18
+ /** Running inside the developer portal simulation, without real hardware attached. */
19
+ EnyoEnergyAppEnvironment["DeveloperPortalSimulation"] = "developer-portal-simulation";
20
+ })(EnyoEnergyAppEnvironment || (exports.EnyoEnergyAppEnvironment = EnyoEnergyAppEnvironment = {}));
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Runtime environment an energy app is executed in.
3
+ *
4
+ * The environment is handed to the callback passed to `register()` so an app can
5
+ * adapt its behaviour, e.g. use verbose logging or mocked hardware access while
6
+ * developing, and skip anything that requires real hardware when it runs inside
7
+ * the developer portal simulation.
8
+ */
9
+ export declare enum EnyoEnergyAppEnvironment {
10
+ /** Running on a real enyo device in development mode (e.g. a developer's test device). */
11
+ OnDeviceDevelopment = "on-device-development",
12
+ /** Running on a real enyo device in production, i.e. at a customer's site. */
13
+ OnDeviceProduction = "on-device-production",
14
+ /** Running inside the developer portal simulation, without real hardware attached. */
15
+ DeveloperPortalSimulation = "developer-portal-simulation"
16
+ }
@@ -18,9 +18,11 @@ import { EnergyAppOnboarding } from "./packages/energy-app-onboarding.cjs";
18
18
  import { EnergyAppOnboardingV2 } from "./packages/energy-app-onboarding-v2.cjs";
19
19
  import { EnergyAppTimeseries } from "./packages/energy-app-timeseries.cjs";
20
20
  import { EnyoPackageChannel } from "./enyo-package-channel.cjs";
21
+ import { EnyoEnergyAppEnvironment } from "./enyo-energy-app-environment.cjs";
21
22
  import { EnergyAppEnergyManager } from "./packages/energy-app-energy-manager.cjs";
22
23
  import { EnergyAppElectricityTariff } from "./packages/energy-app-electricity-tariff.cjs";
23
24
  import { EnergyAppWeatherForecasting } from "./packages/energy-app-weather-forecasting.cjs";
25
+ import { EnergyAppWeatherHistory } from "./packages/energy-app-weather-history.cjs";
24
26
  import { EnergyAppPvForecasting } from "./packages/energy-app-pv-forecasting.cjs";
25
27
  import { EnergyAppDynamicPriceForecast } from "./packages/energy-app-dynamic-price-forecast.cjs";
26
28
  import { EnergyAppPvSystem } from "./packages/energy-app-pv-system.cjs";
@@ -62,8 +64,13 @@ export declare enum EnergyAppStateEnum {
62
64
  * network operations, storage, and device communication.
63
65
  */
64
66
  export interface EnyoEnergyAppSdk {
65
- /** Register a callback that gets called when the package is initialized */
66
- register: (callback: (packageName: string, version: number, channel: EnyoPackageChannel, deviceId: string) => void | Promise<void>) => void;
67
+ /**
68
+ * Register a callback that gets called when the package is initialized.
69
+ * The callback receives the package name, its version, the release channel it
70
+ * was installed from, the id of the device it runs on and the
71
+ * {@link EnyoEnergyAppEnvironment} the app is executed in.
72
+ */
73
+ register: (callback: (packageName: string, version: number, channel: EnyoPackageChannel, deviceId: string, environment: EnyoEnergyAppEnvironment) => void | Promise<void>) => void;
67
74
  /** health check - returns the current date to check if alive */
68
75
  healthcheck: () => Date;
69
76
  /** Register a callback that gets called when the system is shutting down */
@@ -120,6 +127,8 @@ export interface EnyoEnergyAppSdk {
120
127
  useElectricityTariff: () => EnergyAppElectricityTariff;
121
128
  /** Get the Weather Forecasting API for managing weather forecast providers and retrieving weather forecasts */
122
129
  useWeatherForecasting: () => EnergyAppWeatherForecasting;
130
+ /** Get the Weather History API for managing weather history providers and retrieving observed weather for a past interval */
131
+ useWeatherHistory: () => EnergyAppWeatherHistory;
123
132
  /** Get the PV Forecasting API for managing PV forecast providers and retrieving PV forecasts */
124
133
  usePvForecasting: () => EnergyAppPvForecasting;
125
134
  /** Get the Dynamic Price Forecast API for publishing and consuming forward-looking electricity price forecasts */
@@ -37,6 +37,7 @@ __exportStar(require("./implementations/network-devices/network-access-guard.cjs
37
37
  __exportStar(require("./implementations/network-devices/network-device-manager.cjs"), exports);
38
38
  __exportStar(require("./implementations/storage/storage-schedule-handler.cjs"), exports);
39
39
  __exportStar(require("./enyo-package-channel.cjs"), exports);
40
+ __exportStar(require("./enyo-energy-app-environment.cjs"), exports);
40
41
  __exportStar(require("./types/enyo-timeseries.cjs"), exports);
41
42
  __exportStar(require("./types/enyo-energy-manager.cjs"), exports);
42
43
  __exportStar(require("./packages/energy-app-energy-manager.cjs"), exports);
@@ -48,6 +49,8 @@ __exportStar(require("./packages/energy-app-electricity-tariff.cjs"), exports);
48
49
  __exportStar(require("./types/enyo-pv-forecast.cjs"), exports);
49
50
  __exportStar(require("./types/enyo-forecasting.cjs"), exports);
50
51
  __exportStar(require("./packages/energy-app-weather-forecasting.cjs"), exports);
52
+ __exportStar(require("./types/enyo-weather-history.cjs"), exports);
53
+ __exportStar(require("./packages/energy-app-weather-history.cjs"), exports);
51
54
  __exportStar(require("./packages/energy-app-pv-forecasting.cjs"), exports);
52
55
  __exportStar(require("./packages/energy-app-dynamic-price-forecast.cjs"), exports);
53
56
  __exportStar(require("./types/enyo-pv-system.cjs"), exports);
@@ -21,6 +21,7 @@ export * from './implementations/network-devices/network-access-guard.cjs';
21
21
  export * from './implementations/network-devices/network-device-manager.cjs';
22
22
  export * from './implementations/storage/storage-schedule-handler.cjs';
23
23
  export * from './enyo-package-channel.cjs';
24
+ export * from './enyo-energy-app-environment.cjs';
24
25
  export * from './types/enyo-timeseries.cjs';
25
26
  export * from './types/enyo-energy-manager.cjs';
26
27
  export * from './packages/energy-app-energy-manager.cjs';
@@ -32,6 +33,8 @@ export * from './packages/energy-app-electricity-tariff.cjs';
32
33
  export * from './types/enyo-pv-forecast.cjs';
33
34
  export * from './types/enyo-forecasting.cjs';
34
35
  export * from './packages/energy-app-weather-forecasting.cjs';
36
+ export * from './types/enyo-weather-history.cjs';
37
+ export * from './packages/energy-app-weather-history.cjs';
35
38
  export * from './packages/energy-app-pv-forecasting.cjs';
36
39
  export * from './packages/energy-app-dynamic-price-forecast.cjs';
37
40
  export * from './types/enyo-pv-system.cjs';
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,138 @@
1
+ import { WeatherHistoryRegistration, WeatherHistoryInfo, OutdoorTemperatureHistoryRequest, OutdoorTemperatureHistory, WeatherHistoryRequest, WeatherHistory } from "../types/enyo-weather-history.cjs";
2
+ /**
3
+ * Interface for managing weather history providers and retrieving observed
4
+ * weather data for a past time interval.
5
+ *
6
+ * This is the backward-looking counterpart to `EnergyAppWeatherForecasting`:
7
+ * where the forecasting API answers "what will the weather do", this one
8
+ * answers "what was the weather between these two timestamps" — temperature,
9
+ * wind, cloud cover and solar irradiance. That is the input an app needs to
10
+ * correlate measured consumption with the weather that drove it, to build
11
+ * heating-degree-day statistics, to check measured PV production against the
12
+ * irradiance that was actually available, or to train a consumption model on
13
+ * outdoor conditions.
14
+ *
15
+ * Two queries are offered: {@link EnergyAppWeatherHistory.getWeatherHistory}
16
+ * returns every requested measure per bucket, while
17
+ * {@link EnergyAppWeatherHistory.getOutdoorTemperature} is the shorthand for
18
+ * the common temperature-only case. Neither takes a location — the registered
19
+ * provider resolves the device's own location via `energyApp.useLocation()`,
20
+ * so a consumer only ever states the interval it cares about.
21
+ *
22
+ * Like the forecasting API, data comes from registered providers; an app
23
+ * either registers one (wrapping an external archive) or consumes one that is
24
+ * already registered, or both.
25
+ */
26
+ export interface EnergyAppWeatherHistory {
27
+ /**
28
+ * Registers a new weather history provider or updates an existing one.
29
+ * Uses upsert logic based on historyId - if a provider with the same ID
30
+ * exists, it will be updated; otherwise, a new provider will be created.
31
+ *
32
+ * @param registration - The history provider registration data
33
+ * @returns Promise that resolves when the provider has been registered
34
+ *
35
+ * @example
36
+ * ```typescript
37
+ * await weatherHistory.registerHistory({
38
+ * historyId: 'dwd-archive',
39
+ * name: 'DWD Climate Archive',
40
+ * vendor: 'Deutscher Wetterdienst',
41
+ * availableHistoryDays: 730,
42
+ * availableMeasures: [WeatherHistoryMeasureEnum.OutdoorTemperature]
43
+ * });
44
+ * ```
45
+ */
46
+ registerHistory(registration: WeatherHistoryRegistration): Promise<void>;
47
+ /**
48
+ * Removes a registered weather history provider by its ID.
49
+ * If the provider does not exist, this operation is a no-op.
50
+ *
51
+ * @param historyId - The unique identifier of the history provider to remove
52
+ * @returns Promise that resolves when the provider has been removed
53
+ */
54
+ deregisterHistory(historyId: string): Promise<void>;
55
+ /**
56
+ * Retrieves all registered weather history providers.
57
+ *
58
+ * @returns Promise that resolves to an array of all registered weather history providers
59
+ *
60
+ * @example
61
+ * ```typescript
62
+ * const providers = await weatherHistory.listHistories();
63
+ * providers.forEach(p => console.log(`${p.name} (${p.vendor})`));
64
+ * ```
65
+ */
66
+ listHistories(): Promise<WeatherHistoryInfo[]>;
67
+ /**
68
+ * Fetches the observed outdoor temperature for a time interval.
69
+ *
70
+ * The interval is half-open: `fromIso` is included and `untilIso` is not,
71
+ * so consecutive intervals can be requested back to back without the
72
+ * boundary timestamp being counted twice. Pass `resolution` to get a bucket
73
+ * size other than the provider's own — a finer resolution is filled by
74
+ * linear interpolation, a coarser one aggregated as a time-weighted
75
+ * average.
76
+ *
77
+ * An interval that reaches further back than the provider's archive, or
78
+ * forward past its most recent observation, is not an error: the covered
79
+ * part is returned and `coveredFromIso` / `coveredUntilIso` state where the
80
+ * data actually began and ended. An interval the provider holds no data for
81
+ * at all yields an empty `readings` array.
82
+ *
83
+ * @param historyId - The unique identifier of the history provider to use
84
+ * @param request - The requested interval and resolution
85
+ * @returns Promise that resolves to the observed temperatures for the interval
86
+ *
87
+ * @example
88
+ * ```typescript
89
+ * const temperatures = await weatherHistory.getOutdoorTemperature('dwd-archive', {
90
+ * fromIso: '2026-01-15T00:00:00Z',
91
+ * untilIso: '2026-01-16T00:00:00Z',
92
+ * resolution: WeatherHistoryResolutionEnum.OneHour
93
+ * });
94
+ * console.log(`Average: ${temperatures.averageCelsius}°C`);
95
+ * temperatures.readings.forEach(r =>
96
+ * console.log(`${r.timestampIso}: ${r.outdoorTemperatureCelsius}°C`)
97
+ * );
98
+ * ```
99
+ */
100
+ getOutdoorTemperature(historyId: string, request: OutdoorTemperatureHistoryRequest): Promise<OutdoorTemperatureHistory>;
101
+ /**
102
+ * Fetches the observed weather for a time interval across every requested
103
+ * measure — temperature, wind speed, cloud cover and the three irradiance
104
+ * components.
105
+ *
106
+ * Interval, resolution and coverage behave exactly as described on
107
+ * {@link EnergyAppWeatherHistory.getOutdoorTemperature}. Narrow the result
108
+ * with `measures` when only some quantities are needed — archives are
109
+ * typically billed or rate-limited per quantity. Measures the provider does
110
+ * not hold are simply absent from the readings rather than reported as an
111
+ * error; `measures` on the result states what actually came back.
112
+ *
113
+ * @param historyId - The unique identifier of the history provider to use
114
+ * @param request - The requested interval, resolution and measures
115
+ * @returns Promise that resolves to the observed weather for the interval
116
+ *
117
+ * @example
118
+ * ```typescript
119
+ * const history = await weatherHistory.getWeatherHistory('open-meteo-archive', {
120
+ * fromIso: '2026-01-15T00:00:00Z',
121
+ * untilIso: '2026-01-16T00:00:00Z',
122
+ * resolution: WeatherHistoryResolutionEnum.OneHour,
123
+ * measures: [
124
+ * WeatherHistoryMeasureEnum.GlobalHorizontalIrradiance,
125
+ * WeatherHistoryMeasureEnum.WindSpeed,
126
+ * WeatherHistoryMeasureEnum.CloudArea
127
+ * ]
128
+ * });
129
+ *
130
+ * const ghi = history.statistics?.[WeatherHistoryMeasureEnum.GlobalHorizontalIrradiance];
131
+ * console.log(`Mean irradiance: ${ghi?.averageValue} W/m²`);
132
+ * history.readings.forEach(r =>
133
+ * console.log(`${r.timestampIso}: ${r.globalHorizontalIrradiance} W/m², ${r.windSpeedMs} m/s`)
134
+ * );
135
+ * ```
136
+ */
137
+ getWeatherHistory(historyId: string, request: WeatherHistoryRequest): Promise<WeatherHistory>;
138
+ }
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WeatherHistoryMeasureEnum = exports.WeatherHistoryResolutionEnum = void 0;
4
+ /**
5
+ * Resolution of historical weather data entries.
6
+ *
7
+ * The values mirror {@link ForecastResolutionEnum} so a history series and a
8
+ * forecast series of the same resolution can be concatenated without
9
+ * translating between the two vocabularies.
10
+ */
11
+ var WeatherHistoryResolutionEnum;
12
+ (function (WeatherHistoryResolutionEnum) {
13
+ /** 1-minute intervals */
14
+ WeatherHistoryResolutionEnum["OneMinute"] = "1min";
15
+ /** 15-minute intervals */
16
+ WeatherHistoryResolutionEnum["FifteenMinutes"] = "15min";
17
+ /** 1-hour intervals */
18
+ WeatherHistoryResolutionEnum["OneHour"] = "1hr";
19
+ })(WeatherHistoryResolutionEnum || (exports.WeatherHistoryResolutionEnum = WeatherHistoryResolutionEnum = {}));
20
+ /**
21
+ * A weather quantity a history provider can serve.
22
+ *
23
+ * Used to narrow a request to the measures an app actually needs — archives
24
+ * are usually billed or rate-limited per quantity, so asking for irradiance
25
+ * when only wind is wanted is pure cost.
26
+ */
27
+ var WeatherHistoryMeasureEnum;
28
+ (function (WeatherHistoryMeasureEnum) {
29
+ /** Outdoor air temperature in degrees Celsius */
30
+ WeatherHistoryMeasureEnum["OutdoorTemperature"] = "outdoor-temperature";
31
+ /** Wind speed in meters per second */
32
+ WeatherHistoryMeasureEnum["WindSpeed"] = "wind-speed";
33
+ /** Cloud coverage area in percent */
34
+ WeatherHistoryMeasureEnum["CloudArea"] = "cloud-area";
35
+ /** Global horizontal irradiance in W/m² */
36
+ WeatherHistoryMeasureEnum["GlobalHorizontalIrradiance"] = "global-horizontal-irradiance";
37
+ /** Direct normal irradiance in W/m² */
38
+ WeatherHistoryMeasureEnum["DirectNormalIrradiance"] = "direct-normal-irradiance";
39
+ /** Diffuse horizontal irradiance in W/m² */
40
+ WeatherHistoryMeasureEnum["DiffuseHorizontalIrradiance"] = "diffuse-horizontal-irradiance";
41
+ /** Categorical weather symbol */
42
+ WeatherHistoryMeasureEnum["Symbol"] = "symbol";
43
+ })(WeatherHistoryMeasureEnum || (exports.WeatherHistoryMeasureEnum = WeatherHistoryMeasureEnum = {}));