@enyo-energy/energy-app-sdk 1.2.0 → 1.4.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.
Files changed (70) hide show
  1. package/README.md +245 -5
  2. package/dist/cjs/energy-app-package-definition.cjs +1 -0
  3. package/dist/cjs/energy-app-package-definition.d.cts +1 -0
  4. package/dist/cjs/energy-app-permission.type.cjs +2 -0
  5. package/dist/cjs/energy-app-permission.type.d.cts +3 -1
  6. package/dist/cjs/energy-app.cjs +22 -0
  7. package/dist/cjs/energy-app.d.cts +21 -0
  8. package/dist/cjs/enyo-energy-app-sdk.d.cts +3 -0
  9. package/dist/cjs/implementations/appliances/appliance-manager.cjs +6 -0
  10. package/dist/cjs/implementations/pricing/compose-electricity-prices.cjs +255 -0
  11. package/dist/cjs/implementations/pricing/compose-electricity-prices.d.cts +125 -0
  12. package/dist/cjs/implementations/pricing/price-component-validators.cjs +238 -0
  13. package/dist/cjs/implementations/pricing/price-component-validators.d.cts +57 -0
  14. package/dist/cjs/implementations/pricing/price-schedule-resolver.cjs +182 -0
  15. package/dist/cjs/implementations/pricing/price-schedule-resolver.d.cts +95 -0
  16. package/dist/cjs/index.cjs +7 -0
  17. package/dist/cjs/index.d.cts +7 -0
  18. package/dist/cjs/packages/energy-app-charge.d.cts +8 -81
  19. package/dist/cjs/packages/energy-app-electricity-tariff.d.cts +153 -41
  20. package/dist/cjs/packages/energy-app-grid-fee.cjs +2 -0
  21. package/dist/cjs/packages/energy-app-grid-fee.d.cts +199 -0
  22. package/dist/cjs/packages/energy-app-modbus.d.cts +12 -0
  23. package/dist/cjs/types/enyo-charge.d.cts +0 -71
  24. package/dist/cjs/types/enyo-data-bus-value.d.cts +7 -0
  25. package/dist/cjs/types/enyo-electricity-tariff.cjs +73 -13
  26. package/dist/cjs/types/enyo-electricity-tariff.d.cts +260 -50
  27. package/dist/cjs/types/enyo-energy-prices.d.cts +9 -3
  28. package/dist/cjs/types/enyo-grid-fee.cjs +26 -0
  29. package/dist/cjs/types/enyo-grid-fee.d.cts +247 -0
  30. package/dist/cjs/types/enyo-price-composition.cjs +15 -0
  31. package/dist/cjs/types/enyo-price-composition.d.cts +147 -0
  32. package/dist/cjs/types/enyo-price-schedule.cjs +45 -0
  33. package/dist/cjs/types/enyo-price-schedule.d.cts +137 -0
  34. package/dist/cjs/version.cjs +1 -1
  35. package/dist/cjs/version.d.cts +1 -1
  36. package/dist/energy-app-package-definition.d.ts +1 -0
  37. package/dist/energy-app-package-definition.js +1 -0
  38. package/dist/energy-app-permission.type.d.ts +3 -1
  39. package/dist/energy-app-permission.type.js +2 -0
  40. package/dist/energy-app.d.ts +21 -0
  41. package/dist/energy-app.js +22 -0
  42. package/dist/enyo-energy-app-sdk.d.ts +3 -0
  43. package/dist/implementations/appliances/appliance-manager.js +6 -0
  44. package/dist/implementations/pricing/compose-electricity-prices.d.ts +125 -0
  45. package/dist/implementations/pricing/compose-electricity-prices.js +248 -0
  46. package/dist/implementations/pricing/price-component-validators.d.ts +57 -0
  47. package/dist/implementations/pricing/price-component-validators.js +230 -0
  48. package/dist/implementations/pricing/price-schedule-resolver.d.ts +95 -0
  49. package/dist/implementations/pricing/price-schedule-resolver.js +175 -0
  50. package/dist/index.d.ts +7 -0
  51. package/dist/index.js +7 -0
  52. package/dist/packages/energy-app-charge.d.ts +8 -81
  53. package/dist/packages/energy-app-electricity-tariff.d.ts +153 -41
  54. package/dist/packages/energy-app-grid-fee.d.ts +199 -0
  55. package/dist/packages/energy-app-grid-fee.js +1 -0
  56. package/dist/packages/energy-app-modbus.d.ts +12 -0
  57. package/dist/types/enyo-charge.d.ts +0 -71
  58. package/dist/types/enyo-data-bus-value.d.ts +7 -0
  59. package/dist/types/enyo-electricity-tariff.d.ts +260 -50
  60. package/dist/types/enyo-electricity-tariff.js +71 -11
  61. package/dist/types/enyo-energy-prices.d.ts +9 -3
  62. package/dist/types/enyo-grid-fee.d.ts +247 -0
  63. package/dist/types/enyo-grid-fee.js +23 -0
  64. package/dist/types/enyo-price-composition.d.ts +147 -0
  65. package/dist/types/enyo-price-composition.js +12 -0
  66. package/dist/types/enyo-price-schedule.d.ts +137 -0
  67. package/dist/types/enyo-price-schedule.js +42 -0
  68. package/dist/version.d.ts +1 -1
  69. package/dist/version.js +1 -1
  70. package/package.json +2 -2
@@ -1,78 +1,288 @@
1
+ import { EnyoCurrencyEnum } from './enyo-currency.cjs';
2
+ import { ForecastResolutionEnum } from './enyo-forecasting.cjs';
3
+ import { EnyoPriceAppliesToEnum, EnyoPriceSchedule } from './enyo-price-schedule.cjs';
1
4
  /**
2
- * Enum representing the type of electricity tariff pricing model
5
+ * Which direction of energy flow a tariff prices.
6
+ *
7
+ * A site has exactly one tariff per direction: what it pays for energy drawn
8
+ * from the grid, and what it earns for energy fed back. These are the two slots
9
+ * the whole tariff API is built around — a tariff is not registered into a list
10
+ * and later marked default, it is set into one of these two places.
11
+ *
12
+ * Deliberately not {@link EnyoPriceAppliesToEnum}, which carries a third member
13
+ * (`Both`) that a slot cannot be.
3
14
  */
4
- export declare enum ElectricityTariffTypeEnum {
5
- /** Fixed price that doesn't change over time */
15
+ export declare enum EnyoTariffDirectionEnum {
16
+ /** Energy drawn from the grid — what the customer pays. */
17
+ Consumption = "consumption",
18
+ /** Energy fed into the grid — what the customer earns. */
19
+ FeedIn = "feed-in"
20
+ }
21
+ /**
22
+ * The pricing model a tariff follows.
23
+ */
24
+ export declare enum EnyoTariffPricingTypeEnum {
25
+ /** One price that does not change over time. */
6
26
  Static = "static",
7
- /** Price varies based on time of day (e.g., peak/off-peak) */
27
+ /** Price varies by time of day, weekday or season (e.g. peak/off-peak). */
8
28
  TimeVariable = "time-variable",
9
- /** Price changes dynamically based on market conditions */
29
+ /** Price changes with the market and is published as a dated series. */
10
30
  Dynamic = "dynamic"
11
31
  }
12
32
  /**
13
- * Pricing data for a static (fixed-price) electricity tariff
33
+ * A fixed price per kWh, unchanged around the clock.
14
34
  */
15
- export interface StaticTariffData {
16
- /** Price per kWh for consumption */
35
+ export interface EnyoStaticTariffPricing {
36
+ type: EnyoTariffPricingTypeEnum.Static;
37
+ /** The price per kWh, in the tariff's currency. */
17
38
  pricePerKwh: number;
18
- /** Currency code (ISO 4217, e.g., 'EUR', 'USD') */
19
- currency: string;
20
39
  }
21
40
  /**
22
- * Pricing data for a dynamic electricity tariff
41
+ * A price that follows a calendar schedule — HT/NT, weekend rates, seasonal
42
+ * bands.
43
+ *
44
+ * Uses the same {@link EnyoPriceSchedule} as grid fees and bonuses, so it gets
45
+ * the shared resolver and validator, and so the SDK has one schedule concept
46
+ * rather than one per feature.
23
47
  */
24
- export interface DynamicTariffData {
25
- /** Price per kWh for grid fees */
26
- gridFeePerKwh?: number;
27
- /** Currency code (ISO 4217, e.g., 'EUR', 'USD') */
28
- currency: string;
48
+ export interface EnyoTimeVariableTariffPricing {
49
+ type: EnyoTariffPricingTypeEnum.TimeVariable;
50
+ /** When each price applies. Amounts are the price per kWh. */
51
+ schedule: EnyoPriceSchedule;
52
+ /**
53
+ * IANA time zone the schedule's wall-clock times are expressed in, e.g.
54
+ * `'Europe/Berlin'`. Required — price windows are quoted in local time and
55
+ * must survive daylight-saving transitions.
56
+ */
57
+ timezone: string;
29
58
  }
30
59
  /**
31
- * A single entry in a time-variable tariff schedule
60
+ * A market-following price, carried by the published series rather than by the
61
+ * tariff.
62
+ *
63
+ * Has no fields of its own on purpose: everything about a dynamic price is in
64
+ * the series the owning app publishes with
65
+ * {@link EnergyAppElectricityTariff.publishPrices}, and there is nothing
66
+ * meaningful to state up front.
32
67
  */
33
- export interface TimeVariableScheduleEntry {
34
- /** Relative start offset (e.g., minutes from start of day) */
35
- start: number;
36
- /** Price per kWh during this period */
37
- pricePerKwh: number;
68
+ export interface EnyoDynamicTariffPricing {
69
+ type: EnyoTariffPricingTypeEnum.Dynamic;
38
70
  }
39
71
  /**
40
- * Pricing data for a time-variable electricity tariff
72
+ * How a tariff prices energy.
73
+ *
74
+ * A discriminated union on {@link EnyoTariffPricingTypeEnum}, so the payload a
75
+ * pricing model needs is the payload it carries — a `Static` tariff without a
76
+ * price, or a `Dynamic` one carrying a schedule, does not compile. Narrow it
77
+ * with `switch (tariff.pricing.type)`.
41
78
  */
42
- export interface TimeVariableTariffData {
43
- /** Schedule of time-based price entries */
44
- schedule: TimeVariableScheduleEntry[];
45
- /** Currency code (ISO 4217, e.g., 'EUR', 'USD') */
46
- currency: string;
79
+ export type EnyoTariffPricing = EnyoStaticTariffPricing | EnyoTimeVariableTariffPricing | EnyoDynamicTariffPricing;
80
+ /**
81
+ * A cost component that may or may not already be contained in a published
82
+ * price.
83
+ *
84
+ * Provider APIs differ: some return all-in prices with network charges, levies
85
+ * and discounts baked in, others return the pure energy price. A consumer must
86
+ * never add a component that is already there, so the publishing app declares
87
+ * what its prices contain — see {@link EnyoTariffPriceSeries.includes}.
88
+ */
89
+ export declare enum EnyoPriceComponentEnum {
90
+ /** The grid operator's network charge. */
91
+ GridFee = "grid-fee",
92
+ /** Taxes and statutory levies. */
93
+ TaxesAndLevies = "taxes-and-levies",
94
+ /** Discounts granted on top of the tariff. */
95
+ Bonuses = "bonuses"
47
96
  }
48
97
  /**
49
- * Input data for registering or updating an electricity tariff
98
+ * A time-dependent discount granted on top of a tariff, expressed in currency
99
+ * per kWh — for example "5 ct/kWh cheaper between 22:00 and 06:00" or a
100
+ * promotional rebate that runs for a fixed number of months.
101
+ *
102
+ * Not carried by the tariff itself: the app that owns a tariff knows its own
103
+ * bonuses and either applies them before publishing prices — declaring
104
+ * {@link EnyoPriceComponentEnum.Bonuses} in
105
+ * {@link EnyoTariffPriceSeries.includes} — or passes them to
106
+ * `composeElectricityPrices()` to have them applied and reported separately.
107
+ *
108
+ * Amounts in {@link schedule} are positive magnitudes and are **subtracted**
109
+ * from the price.
110
+ *
111
+ * Consumption-quota bonuses ("the first 100 kWh each month are free") are not
112
+ * expressible here — they require consumption accounting that this model
113
+ * deliberately does not carry.
50
114
  */
51
- export interface EnyoElectricityTariff {
52
- /** Unique identifier for the tariff */
115
+ export interface EnyoTariffBonus {
116
+ /** Unique identifier of the bonus within its tariff. */
53
117
  id: string;
54
- /** The pricing model type of this tariff */
55
- tariffType: ElectricityTariffTypeEnum;
56
- /** Human-readable name of the tariff */
57
- tariffName: string;
58
- /** Name of the energy vendor/provider */
118
+ /** Human-readable name shown to the user, e.g. `'Nachtbonus'`. */
119
+ name: string;
120
+ /**
121
+ * When and how much the discount is. Amounts are positive and subtracted
122
+ * from the price.
123
+ */
124
+ schedule: EnyoPriceSchedule;
125
+ /**
126
+ * IANA time zone the schedule's wall-clock times are expressed in, e.g.
127
+ * `'Europe/Berlin'`.
128
+ */
129
+ timezone: string;
130
+ /** Whether the bonus applies to consumption, feed-in, or both. */
131
+ appliesTo: EnyoPriceAppliesToEnum;
132
+ /** Optional start of the bonus's validity in ISO format (inclusive). */
133
+ validFromIso?: string;
134
+ /** Optional end of the bonus's validity in ISO format (exclusive). */
135
+ validUntilIso?: string;
136
+ /**
137
+ * When `true`, this bonus suppresses every lower-priority bonus in the
138
+ * intervals it covers instead of stacking with them.
139
+ */
140
+ exclusive?: boolean;
141
+ /**
142
+ * Ranking used to pick between competing exclusive bonuses — higher wins.
143
+ * Defaults to `0`.
144
+ */
145
+ priority?: number;
146
+ }
147
+ /**
148
+ * An electricity tariff filling one of the site's two direction slots.
149
+ *
150
+ * Carries no identifier: a tariff is addressed by the direction it prices, and
151
+ * setting one replaces whatever was in that slot. It also carries no grid fee —
152
+ * a network charge belongs to the site's grid connection and is read from
153
+ * `useGridFee()` — and no default flag, because occupying a slot *is* being the
154
+ * tariff in force.
155
+ */
156
+ export interface EnyoElectricityTariff {
157
+ /** Human-readable name of the tariff, e.g. `'Tibber Stromvertrag'`. */
158
+ name: string;
159
+ /** Name of the energy vendor/provider. */
59
160
  vendorName: string;
60
- /** Optional ID of the primary meter appliance associated with this tariff */
61
- primaryMeterApplianceId?: string;
62
- /** Optional static pricing data (relevant when tariffType is Static) */
63
- staticTariffData?: StaticTariffData;
64
- /** Optional time-variable pricing data (relevant when tariffType is TimeVariable) */
65
- timeVariableTariffData?: TimeVariableTariffData;
66
- /** Optional dynamic pricing data*/
67
- dynamicTariffData?: DynamicTariffData;
68
- /** Optional external tariff id for easy identification */
161
+ /** Currency of every amount in this tariff and in the prices published for it. */
162
+ currency: EnyoCurrencyEnum;
163
+ /** How the tariff prices energy. */
164
+ pricing: EnyoTariffPricing;
165
+ /**
166
+ * The owning app's own identifier for this tariff — a contract id, a
167
+ * product code.
168
+ *
169
+ * Optional for the host, which never interprets it, but it is the stable key
170
+ * an app should compare against to notice that the tariff behind a slot is
171
+ * no longer the one it published prices for.
172
+ */
69
173
  externalTariffId?: string;
70
174
  }
71
175
  /**
72
- * Tariff registration data extended with default indicator.
73
- * Used in list responses to indicate which tariff is the system default.
176
+ * A single priced interval.
177
+ */
178
+ export interface EnyoTariffPriceEntry {
179
+ /** Start of the interval in ISO format. */
180
+ timestampIso: string;
181
+ /** Price per kWh for this interval, in the tariff's currency. */
182
+ pricePerKwh: number;
183
+ }
184
+ /**
185
+ * Prices for one direction over a requested range.
186
+ *
187
+ * {@link includes} travels with the series rather than with the tariff because
188
+ * what a price contains is a fact about *that series*: an app may publish pure
189
+ * energy prices today and all-in prices tomorrow, and a consumer composing a
190
+ * price must go by what it was actually handed.
191
+ */
192
+ export interface EnyoTariffPriceSeries {
193
+ /** Which direction these prices are for. */
194
+ direction: EnyoTariffDirectionEnum;
195
+ /** Currency of every amount in {@link entries}. */
196
+ currency: EnyoCurrencyEnum;
197
+ /** Always {@link ForecastResolutionEnum.FifteenMinutes} — matches the grid fee and spot price series. */
198
+ resolution: ForecastResolutionEnum;
199
+ /**
200
+ * Cost components already contained in {@link entries}. Empty means the
201
+ * pure energy price; a component listed here must not be added again.
202
+ */
203
+ includes: EnyoPriceComponentEnum[];
204
+ /** Entries sorted ascending by `timestampIso`. */
205
+ entries: EnyoTariffPriceEntry[];
206
+ }
207
+ /**
208
+ * What an app publishes with
209
+ * {@link EnergyAppElectricityTariff.publishPrices}.
210
+ *
211
+ * Carries no currency or resolution: both come from the tariff occupying the
212
+ * slot, so they cannot disagree with it.
213
+ */
214
+ export interface EnyoTariffPricePublication {
215
+ /**
216
+ * Cost components already applied to {@link entries}. Omitted means the
217
+ * pure energy price.
218
+ */
219
+ includes?: EnyoPriceComponentEnum[];
220
+ /** The priced intervals. Replaces any previously published interval with the same timestamp. */
221
+ entries: EnyoTariffPriceEntry[];
222
+ }
223
+ /**
224
+ * The outcome of a user choosing a tariff.
225
+ */
226
+ export declare enum EnyoTariffActivationStatusEnum {
227
+ /** The tariff is set and usable; prices can be published. */
228
+ Success = "success",
229
+ /** The user must authenticate with the provider before the tariff works. */
230
+ AuthenticationRequired = "authentication-required",
231
+ /** The user must complete an onboarding guide before the tariff works. */
232
+ OnboardingRequired = "onboarding-required",
233
+ /** The tariff could not be activated. */
234
+ Failed = "failed"
235
+ }
236
+ /**
237
+ * What an app reports back when the user picks its tariff.
238
+ *
239
+ * The three non-success states are not failures to be retried — they are
240
+ * requests for the host to send the user somewhere. Carry the pointer that makes
241
+ * each actionable, or the host knows only that something is needed and not what.
242
+ *
243
+ * When a flow finishes later (an OAuth redirect returns, an onboarding guide
244
+ * completes), the app calls
245
+ * {@link EnergyAppElectricityTariff.setTariff} — setting the tariff *is* the
246
+ * activation signal, so there is nothing else to report.
247
+ */
248
+ export interface EnyoTariffActivationResult {
249
+ /** The outcome. */
250
+ status: EnyoTariffActivationStatusEnum;
251
+ /**
252
+ * Where to send the user, when the status is
253
+ * {@link EnyoTariffActivationStatusEnum.AuthenticationRequired}.
254
+ */
255
+ authenticationUrl?: string;
256
+ /**
257
+ * Which onboarding guide to run, when the status is
258
+ * {@link EnyoTariffActivationStatusEnum.OnboardingRequired}. An onboarding
259
+ * v2 guide id registered by this app.
260
+ */
261
+ onboardingGuideId?: string;
262
+ /**
263
+ * Human-readable detail, shown to the user on
264
+ * {@link EnyoTariffActivationStatusEnum.Failed}.
265
+ */
266
+ message?: string;
267
+ }
268
+ /**
269
+ * What happened to a direction slot.
270
+ */
271
+ export declare enum EnyoTariffChangeTypeEnum {
272
+ /** A tariff was set into a slot that was empty, or replaced the one in it. */
273
+ Set = "set",
274
+ /** The slot was emptied. */
275
+ Cleared = "cleared"
276
+ }
277
+ /**
278
+ * Event delivered to listeners registered via
279
+ * {@link EnergyAppElectricityTariff.onTariffChanged}.
74
280
  */
75
- export interface EnyoElectricityTariffWithDefault extends EnyoElectricityTariff {
76
- /** Indicates whether this tariff is the system default */
77
- defaultTariff: boolean;
281
+ export interface EnyoTariffChangeEvent {
282
+ /** What happened. */
283
+ changeType: EnyoTariffChangeTypeEnum;
284
+ /** Which slot changed. */
285
+ direction: EnyoTariffDirectionEnum;
286
+ /** The tariff now in the slot, or `null` when it was cleared. */
287
+ tariff: EnyoElectricityTariff | null;
78
288
  }
@@ -1,11 +1,17 @@
1
- import { ElectricityTariffTypeEnum } from "./enyo-electricity-tariff.cjs";
1
+ import { EnyoTariffPricingTypeEnum } from "./enyo-electricity-tariff.cjs";
2
2
  /**
3
- * Represents complete energy tariff information
3
+ * Represents complete energy tariff information carried on the data bus by
4
+ * `EnergyTariffUpdateV1`.
5
+ *
6
+ * Predates {@link EnergyAppElectricityTariff.publishPrices}, which is the
7
+ * supported way to publish prices for a tariff slot. This shape still carries a
8
+ * `tariffId`, a concept the tariff API no longer has — the two are not
9
+ * interchangeable, and new code should publish through the tariff API.
4
10
  */
5
11
  export interface EnyoEnergyPrices {
6
12
  /** Unique identifier for this tariff */
7
13
  tariffId: string;
8
- type: ElectricityTariffTypeEnum;
14
+ type: EnyoTariffPricingTypeEnum;
9
15
  /** Pricing data structure */
10
16
  prices: EnyoEnergyPriceEntry[];
11
17
  }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EnyoGridFeeChangeTypeEnum = exports.EnyoGridFeeTypeEnum = void 0;
4
+ /**
5
+ * Whether the grid fee that applies to a site is one number or a time-dependent
6
+ * series.
7
+ */
8
+ var EnyoGridFeeTypeEnum;
9
+ (function (EnyoGridFeeTypeEnum) {
10
+ /** One constant charge that applies around the clock. */
11
+ EnyoGridFeeTypeEnum["Static"] = "static";
12
+ /** The charge varies by time of day, weekday or season (e.g. HT/NT). */
13
+ EnyoGridFeeTypeEnum["Dynamic"] = "dynamic";
14
+ })(EnyoGridFeeTypeEnum || (exports.EnyoGridFeeTypeEnum = EnyoGridFeeTypeEnum = {}));
15
+ /**
16
+ * What happened to a grid fee registration.
17
+ */
18
+ var EnyoGridFeeChangeTypeEnum;
19
+ (function (EnyoGridFeeChangeTypeEnum) {
20
+ /** A grid fee was registered where the site had none. */
21
+ EnyoGridFeeChangeTypeEnum["Registered"] = "registered";
22
+ /** The site's existing grid fee was replaced. */
23
+ EnyoGridFeeChangeTypeEnum["Updated"] = "updated";
24
+ /** A grid fee was removed. */
25
+ EnyoGridFeeChangeTypeEnum["Removed"] = "removed";
26
+ })(EnyoGridFeeChangeTypeEnum || (exports.EnyoGridFeeChangeTypeEnum = EnyoGridFeeChangeTypeEnum = {}));
@@ -0,0 +1,247 @@
1
+ import { EnyoCurrencyEnum } from './enyo-currency.cjs';
2
+ import { ForecastResolutionEnum } from './enyo-forecasting.cjs';
3
+ import { EnyoPriceAppliesToEnum, EnyoPriceSchedule } from './enyo-price-schedule.cjs';
4
+ /**
5
+ * A registered dynamic grid fee (network charge).
6
+ *
7
+ * A grid fee is the component of the electricity price the grid operator (DSO)
8
+ * charges for transporting the energy. Historically it was a single constant
9
+ * ct/kWh value; with time-variable network charges (e.g. §14a EnWG module 3 in
10
+ * Germany) it varies by time of day, weekday and season, and grid operators
11
+ * increasingly publish it as a dated series.
12
+ *
13
+ * A fee registered here is **not** automatically applied to any price. It is
14
+ * published so that energy apps can read it via
15
+ * {@link EnergyAppGridFee.getGridFee} and compose the effective electricity
16
+ * price themselves — see `composeElectricityPrices()`. This is deliberate: some
17
+ * tariff providers already return grid-fee-inclusive prices from their own API
18
+ * and must not add the fee a second time.
19
+ *
20
+ * Constant and time-dependent fees are the same shape: a flat ct/kWh charge is
21
+ * a {@link schedule} with one all-day window. There is no mode to declare and
22
+ * nothing on the tariff side that has to agree with it.
23
+ */
24
+ export interface EnyoDynamicGridFee {
25
+ /** Human-readable name, e.g. `'Netzentgelt HT/NT 2026'`. */
26
+ name: string;
27
+ /** Name of the grid operator (DSO) that publishes this fee. */
28
+ gridOperator: string;
29
+ /** Currency of every amount in {@link schedule}. */
30
+ currency: EnyoCurrencyEnum;
31
+ /**
32
+ * IANA time zone the schedule's wall-clock times are expressed in, e.g.
33
+ * `'Europe/Berlin'`. Required — network charge windows are published in
34
+ * local time and must survive daylight-saving transitions.
35
+ */
36
+ timezone: string;
37
+ /** Whether the fee applies to consumption, feed-in, or both. */
38
+ appliesTo: EnyoPriceAppliesToEnum;
39
+ /** When and how much the fee is. Amounts are positive and **added** to the energy price. */
40
+ schedule: EnyoPriceSchedule;
41
+ /** Optional start of the fee's validity in ISO format (inclusive). */
42
+ validFromIso?: string;
43
+ /** Optional end of the fee's validity in ISO format (exclusive). */
44
+ validUntilIso?: string;
45
+ /**
46
+ * Optional metering point this fee was published for (e.g. a German
47
+ * Marktlokations-ID). Informational only — a site has exactly one grid fee,
48
+ * so this never selects between fees; it records which metering point the
49
+ * grid operator quoted it for.
50
+ */
51
+ meteringPointId?: string;
52
+ /**
53
+ * Fixed charges billed alongside the network charge itself — metering point
54
+ * operation, concession levy and the like — as a **gross** amount in cent
55
+ * per kWh.
56
+ *
57
+ * Kept separate from {@link schedule} rather than folded into it because it
58
+ * is a different kind of number: the schedule varies by time of day, this
59
+ * does not. Consumers decide per call whether to include it — see
60
+ * `getGridFeeValues()`'s `includeAdditionalFees`.
61
+ *
62
+ * Omit when the schedule already accounts for everything the customer pays.
63
+ */
64
+ additionalFeesGrossCentPerKwh?: number;
65
+ /**
66
+ * Marks the fee as a time-variable network charge under §14a EnWG module 3.
67
+ * Purely informational — it does not change how the fee is resolved.
68
+ */
69
+ moduleThreeCompliant?: boolean;
70
+ /** When the fee was last registered or updated, in ISO format. Set by the host. */
71
+ publishedAtIso?: string;
72
+ }
73
+ /**
74
+ * Registration payload for {@link EnergyAppGridFee.registerGridFee}.
75
+ *
76
+ * `publishedAtIso` is assigned by the host and therefore not part of the input.
77
+ * There is no identifier: a site has exactly one grid fee, and registering
78
+ * replaces it.
79
+ */
80
+ export type EnyoDynamicGridFeeRegistration = Omit<EnyoDynamicGridFee, 'publishedAtIso'>;
81
+ /**
82
+ * Whether the grid fee that applies to a site is one number or a time-dependent
83
+ * series.
84
+ */
85
+ export declare enum EnyoGridFeeTypeEnum {
86
+ /** One constant charge that applies around the clock. */
87
+ Static = "static",
88
+ /** The charge varies by time of day, weekday or season (e.g. HT/NT). */
89
+ Dynamic = "dynamic"
90
+ }
91
+ /**
92
+ * The grid fee that applies to a site, in the form most callers actually want:
93
+ * "is it one number or a series, and if it is one number, which?"
94
+ *
95
+ * Returned by `getGridFee()`. Read {@link type} first — it decides which of the
96
+ * two remaining questions is worth asking:
97
+ *
98
+ * - {@link EnyoGridFeeTypeEnum.Static}: {@link grossCentPerKwh} holds the whole
99
+ * answer. No range query needed.
100
+ * - {@link EnyoGridFeeTypeEnum.Dynamic}: {@link grossCentPerKwh} is `undefined`
101
+ * on purpose — there is no single honest value for an HT/NT charge. Fetch the
102
+ * intervals with `getGridFeeValues()`.
103
+ *
104
+ * {@link additionalFeesGrossCentPerKwh} applies to both and is reported
105
+ * separately so a caller can show "network charge" and "other charges" as
106
+ * distinct lines, or add them together.
107
+ *
108
+ * **All amounts here are gross cent per kWh** — VAT included, cent not euro.
109
+ * This differs from {@link EnyoDynamicGridFee.schedule}, whose `amountPerKwh` is
110
+ * in whole currency units, because this shape is what gets displayed and
111
+ * configured while the schedule is what gets registered.
112
+ */
113
+ export interface EnyoGridFeeInfo {
114
+ /** Human-readable name, e.g. `'Netzentgelt HT/NT 2026'`. */
115
+ name: string;
116
+ /** Name of the grid operator (DSO) that publishes this fee. */
117
+ gridOperator: string;
118
+ /** Currency of every amount in this object. */
119
+ currency: EnyoCurrencyEnum;
120
+ /** IANA time zone the underlying schedule is expressed in. */
121
+ timezone: string;
122
+ /** Whether the fee applies to consumption, feed-in, or both. */
123
+ appliesTo: EnyoPriceAppliesToEnum;
124
+ /**
125
+ * Whether the fee is one constant number or a time-dependent series.
126
+ * Derived by the host from the registered schedule: a constant schedule, or
127
+ * one whose windows all carry the same amount and cover the whole day, is
128
+ * {@link EnyoGridFeeTypeEnum.Static}; anything else is
129
+ * {@link EnyoGridFeeTypeEnum.Dynamic}.
130
+ */
131
+ type: EnyoGridFeeTypeEnum;
132
+ /**
133
+ * The network charge as a gross amount in cent per kWh — set when
134
+ * {@link type} is {@link EnyoGridFeeTypeEnum.Static}, `undefined` when it is
135
+ * {@link EnyoGridFeeTypeEnum.Dynamic}.
136
+ *
137
+ * Excludes {@link additionalFeesGrossCentPerKwh}; add them for the total the
138
+ * customer pays per kWh.
139
+ */
140
+ grossCentPerKwh?: number;
141
+ /**
142
+ * Fixed charges billed alongside the network charge — metering point
143
+ * operation, concession levy and the like — as a gross amount in cent per
144
+ * kWh. `undefined` when the fee declares none.
145
+ */
146
+ additionalFeesGrossCentPerKwh?: number;
147
+ /** Metering point the grid operator quoted this fee for, when known. */
148
+ meteringPointId?: string;
149
+ /** Whether the fee is a §14a EnWG module 3 time-variable network charge. */
150
+ moduleThreeCompliant?: boolean;
151
+ /** Start of the fee's validity in ISO format (inclusive), when limited. */
152
+ validFromIso?: string;
153
+ /** End of the fee's validity in ISO format (exclusive), when limited. */
154
+ validUntilIso?: string;
155
+ /** When the fee was last registered or updated, in ISO format. */
156
+ publishedAtIso?: string;
157
+ }
158
+ /**
159
+ * One resolved 15-minute interval of a grid fee.
160
+ */
161
+ export interface EnyoGridFeeEntry {
162
+ /** Start of the 15-minute interval in ISO format. */
163
+ timestampIso: string;
164
+ /**
165
+ * The grid fee for this interval as a **gross amount in cent per kWh**,
166
+ * always `>= 0` and `0` for intervals no window covers.
167
+ *
168
+ * Whether this includes the fee's additional charges depends on the
169
+ * `includeAdditionalFees` flag of the request — see
170
+ * {@link EnyoGridFeeSeries.includesAdditionalFees}, which reports what was
171
+ * actually done rather than what was asked for.
172
+ */
173
+ grossCentPerKwh: number;
174
+ }
175
+ /**
176
+ * A grid fee resolved to a flat 15-minute series over a requested range.
177
+ *
178
+ * The resolution matches {@link EnergyAppEnergyPrices.getPrices}, so entries can
179
+ * be zipped with a price series index-by-index once both cover the same range —
180
+ * but mind the unit: this series is in **gross cent** per kWh while price series
181
+ * are in whole currency units. `fromGridFeeEntries()` converts.
182
+ */
183
+ export interface EnyoGridFeeSeries {
184
+ /** Currency of every amount in {@link entries}. */
185
+ currency: EnyoCurrencyEnum;
186
+ /** Always {@link ForecastResolutionEnum.FifteenMinutes} — present for symmetry with other price APIs. */
187
+ resolution: ForecastResolutionEnum;
188
+ /** IANA time zone the underlying schedule was resolved in. */
189
+ timezone: string;
190
+ /** Direction the fee applies to. */
191
+ appliesTo: EnyoPriceAppliesToEnum;
192
+ /**
193
+ * Whether {@link EnyoGridFeeEntry.grossCentPerKwh} has the fee's additional
194
+ * charges baked in.
195
+ *
196
+ * Reports what happened, not what was requested: asking for additional fees
197
+ * on a grid fee that declares none yields `false`, so a caller never has to
198
+ * guess whether a flat total is missing a component.
199
+ */
200
+ includesAdditionalFees: boolean;
201
+ /** Resolved entries sorted ascending by `timestampIso`, without gaps. */
202
+ entries: EnyoGridFeeEntry[];
203
+ }
204
+ /**
205
+ * The range to resolve the site's grid fee over, and whether the fee's
206
+ * additional charges are folded into the resolved amounts.
207
+ *
208
+ * Carries no selector: a site has exactly one grid fee, belonging to its grid
209
+ * connection rather than to a supplier contract, so there is nothing to choose
210
+ * between.
211
+ */
212
+ export interface EnyoGridFeeValuesFilter {
213
+ /** Start of the requested range in ISO format (inclusive). */
214
+ fromIso: string;
215
+ /** End of the requested range in ISO format (exclusive). */
216
+ untilIso: string;
217
+ /**
218
+ * When `true`, {@link EnyoGridFeeInfo.additionalFeesGrossCentPerKwh} is
219
+ * added to every resolved interval, so each amount is the full gross charge
220
+ * per kWh. Defaults to `false` — the network charge alone.
221
+ *
222
+ * The result reports what was actually applied in
223
+ * {@link EnyoGridFeeSeries.includesAdditionalFees}.
224
+ */
225
+ includeAdditionalFees?: boolean;
226
+ }
227
+ /**
228
+ * What happened to a grid fee registration.
229
+ */
230
+ export declare enum EnyoGridFeeChangeTypeEnum {
231
+ /** A grid fee was registered where the site had none. */
232
+ Registered = "registered",
233
+ /** The site's existing grid fee was replaced. */
234
+ Updated = "updated",
235
+ /** A grid fee was removed. */
236
+ Removed = "removed"
237
+ }
238
+ /**
239
+ * Event delivered to listeners registered via
240
+ * {@link EnergyAppGridFee.onGridFeeChanged}.
241
+ */
242
+ export interface EnyoGridFeeChangeEvent {
243
+ /** What happened. */
244
+ changeType: EnyoGridFeeChangeTypeEnum;
245
+ /** The grid fee after the change, or `null` when it was removed. */
246
+ gridFee: EnyoDynamicGridFee | null;
247
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EnyoPriceComponentOriginEnum = void 0;
4
+ /**
5
+ * Where a price component in a composed entry came from.
6
+ */
7
+ var EnyoPriceComponentOriginEnum;
8
+ (function (EnyoPriceComponentOriginEnum) {
9
+ /** The component was already contained in the energy price series. */
10
+ EnyoPriceComponentOriginEnum["Included"] = "included";
11
+ /** The component was added by the composer on top of the energy price. */
12
+ EnyoPriceComponentOriginEnum["Added"] = "added";
13
+ /** No such component applies to this interval. */
14
+ EnyoPriceComponentOriginEnum["NotApplicable"] = "not-applicable";
15
+ })(EnyoPriceComponentOriginEnum || (exports.EnyoPriceComponentOriginEnum = EnyoPriceComponentOriginEnum = {}));