@enyo-energy/energy-app-sdk 0.0.100 → 0.0.102

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.
@@ -12,7 +12,7 @@ export interface EnergyAppDiagnostics {
12
12
  * system-level power values, per-appliance snapshots, and derived energy values
13
13
  * @param forecast - The forecast containing time-bucketed predictions for consumption,
14
14
  * production, pricing, and appliance-specific data
15
- * @param controlPlan - The time-slotted control plan with commands for each appliance
15
+ * @param controlPlan - The time-slotted control plan with actions for each appliance
16
16
  * and estimated costs
17
17
  *
18
18
  * @example
@@ -26,23 +26,29 @@ export interface EnergyAppEnergyManager {
26
26
  registerFeatures(features: EnergyManagerFeatureEnum[]): void;
27
27
  /**
28
28
  * Only for Energy Manager Energy Apps: Publishes the energy manager's control plan forecast.
29
- * The control plan contains time-slotted commands for each appliance along with
29
+ * The control plan contains time-slotted actions for each appliance along with
30
30
  * estimated costs and grid power values.
31
31
  *
32
- * @param controlPlan - The time-slotted control plan with commands for each appliance
32
+ * @param controlPlan - The time-slotted control plan with actions for each appliance
33
33
  * and estimated costs
34
34
  *
35
35
  * @example
36
36
  * ```typescript
37
37
  * const energyManager = energyApp.useEnergyManager();
38
38
  * energyManager.publishForecast({
39
- * commands: [
39
+ * actions: [
40
40
  * {
41
+ * action: EnyoDiagnosticsControlActionEnum.BatteryChargeFromGrid,
41
42
  * type: EnyoApplianceTypeEnum.Storage,
42
43
  * applianceId: 'battery-1',
43
- * decision: BatteryDecision.Charge,
44
+ * timestampIso: new Date().toISOString(),
45
+ * isCommand: true,
44
46
  * powerW: 3000,
45
- * durationInMinutes: 60
47
+ * durationInMinutes: 60,
48
+ * reason: {
49
+ * type: EnyoDiagnosticsActionReasonTypeEnum.ElectricityPriceBelowThreshold,
50
+ * electricityPricePerKwh: 0.15,
51
+ * }
46
52
  * }
47
53
  * ],
48
54
  * generatedAtIso: new Date().toISOString(),
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EnyoDiagnosticsPriceTableSourceEnum = void 0;
3
+ exports.EnyoDiagnosticsActionReasonTypeEnum = exports.EnyoDiagnosticsControlActionEnum = exports.EnyoDiagnosticsPriceTableSourceEnum = void 0;
4
4
  // ─── Price table types ────────────────────────────────────
5
5
  /** Energy source type for price table entries. */
6
6
  var EnyoDiagnosticsPriceTableSourceEnum;
@@ -9,3 +9,66 @@ var EnyoDiagnosticsPriceTableSourceEnum;
9
9
  EnyoDiagnosticsPriceTableSourceEnum["Battery"] = "battery";
10
10
  EnyoDiagnosticsPriceTableSourceEnum["Grid"] = "grid";
11
11
  })(EnyoDiagnosticsPriceTableSourceEnum || (exports.EnyoDiagnosticsPriceTableSourceEnum = EnyoDiagnosticsPriceTableSourceEnum = {}));
12
+ // ─── Action-based control plan ──────────────────────────────
13
+ /**
14
+ * Enum of all control plan action types.
15
+ * Each value represents a specific action the energy manager can plan for an appliance.
16
+ */
17
+ var EnyoDiagnosticsControlActionEnum;
18
+ (function (EnyoDiagnosticsControlActionEnum) {
19
+ /** Block the battery from discharging. */
20
+ EnyoDiagnosticsControlActionEnum["BatteryBlockDischarge"] = "battery_block_discharge";
21
+ /** Charge the battery from the grid. */
22
+ EnyoDiagnosticsControlActionEnum["BatteryChargeFromGrid"] = "battery_charge_from_grid";
23
+ /** Force the battery to discharge. */
24
+ EnyoDiagnosticsControlActionEnum["BatteryForceDischarge"] = "battery_force_discharge";
25
+ /** Battery is charging from PV surplus (observational, not a command). */
26
+ EnyoDiagnosticsControlActionEnum["BatteryChargingFromPv"] = "battery_charging_from_pv";
27
+ /** Battery is discharging into the home (observational, not a command). */
28
+ EnyoDiagnosticsControlActionEnum["BatteryDischargingIntoHome"] = "battery_discharging_into_home";
29
+ /** Start charging the EV. */
30
+ EnyoDiagnosticsControlActionEnum["EvStartCharge"] = "ev_start_charge";
31
+ /** Pause charging the EV. */
32
+ EnyoDiagnosticsControlActionEnum["EvPauseCharge"] = "ev_pause_charge";
33
+ /** Boost domestic hot water production via heat pump. */
34
+ EnyoDiagnosticsControlActionEnum["HeatpumpDhwBoost"] = "heatpump_dhw_boost";
35
+ /** Address room overheating via heat pump. */
36
+ EnyoDiagnosticsControlActionEnum["HeatpumpRoomOverheating"] = "heatpump_room_overheating";
37
+ /** Boost buffer tank temperature via heat pump. */
38
+ EnyoDiagnosticsControlActionEnum["HeatpumpBufferTankBoost"] = "heatpump_buffer_tank_boost";
39
+ })(EnyoDiagnosticsControlActionEnum || (exports.EnyoDiagnosticsControlActionEnum = EnyoDiagnosticsControlActionEnum = {}));
40
+ /**
41
+ * Enum of reason types explaining why an action was planned.
42
+ * Used to attach context to actions for logging, debugging, and UI display.
43
+ */
44
+ var EnyoDiagnosticsActionReasonTypeEnum;
45
+ (function (EnyoDiagnosticsActionReasonTypeEnum) {
46
+ /** Action planned because the electricity price is below a configured threshold. */
47
+ EnyoDiagnosticsActionReasonTypeEnum["ElectricityPriceBelowThreshold"] = "electricity-price-below-threshold";
48
+ /** Action planned because the electricity price is above a configured threshold. */
49
+ EnyoDiagnosticsActionReasonTypeEnum["ElectricityPriceAboveThreshold"] = "electricity-price-above-threshold";
50
+ /** Action planned because PV surplus is available. */
51
+ EnyoDiagnosticsActionReasonTypeEnum["PvSurplusAvailable"] = "pv-surplus-available";
52
+ /** Action planned because PV surplus is unavailable. */
53
+ EnyoDiagnosticsActionReasonTypeEnum["PvSurplusUnavailable"] = "pv-surplus-unavailable";
54
+ /** Action planned because battery capacity is available. */
55
+ EnyoDiagnosticsActionReasonTypeEnum["BatteryCapacityAvailable"] = "battery-capacity-available";
56
+ /** Action planned because battery capacity is unavailable. */
57
+ EnyoDiagnosticsActionReasonTypeEnum["BatteryCapacityUnavailable"] = "battery-capacity-unavailable";
58
+ /** Action planned because the battery state of charge is low. */
59
+ EnyoDiagnosticsActionReasonTypeEnum["BatterySoCLow"] = "battery-soc-low";
60
+ /** Action planned because the battery state of charge is high. */
61
+ EnyoDiagnosticsActionReasonTypeEnum["BatterySoCHigh"] = "battery-soc-high";
62
+ /** Action planned based on the EV charging schedule. */
63
+ EnyoDiagnosticsActionReasonTypeEnum["EvChargingSchedule"] = "ev-charging-schedule";
64
+ /** Action planned because of a grid operator power limitation. */
65
+ EnyoDiagnosticsActionReasonTypeEnum["GridOperatorPowerLimitation"] = "grid-operator-power-limitation";
66
+ /** Action planned because the DHW temperature is low. */
67
+ EnyoDiagnosticsActionReasonTypeEnum["DhwTemperatureLow"] = "dhw-temperature-low";
68
+ /** Action planned because the room temperature is high. */
69
+ EnyoDiagnosticsActionReasonTypeEnum["RoomTemperatureHigh"] = "room-temperature-high";
70
+ /** Action planned because the buffer tank temperature is low. */
71
+ EnyoDiagnosticsActionReasonTypeEnum["BufferTankTemperatureLow"] = "buffer-tank-temperature-low";
72
+ /** Action planned because the home consumption is high. */
73
+ EnyoDiagnosticsActionReasonTypeEnum["HomeConsumptionHigh"] = "home-consumption-high";
74
+ })(EnyoDiagnosticsActionReasonTypeEnum || (exports.EnyoDiagnosticsActionReasonTypeEnum = EnyoDiagnosticsActionReasonTypeEnum = {}));
@@ -1,4 +1,5 @@
1
1
  import { EnyoApplianceTypeEnum } from "./enyo-appliance.cjs";
2
+ import { EnyoCurrencyEnum } from "./enyo-currency.cjs";
2
3
  import { EnyoChargeModeEnum } from "./enyo-data-bus-value.cjs";
3
4
  /** Energy source type for price table entries. */
4
5
  export declare enum EnyoDiagnosticsPriceTableSourceEnum {
@@ -19,12 +20,6 @@ export interface EnyoDiagnosticsPriceTableEntry {
19
20
  export type DhwState = "charging" | "discharging" | "idle";
20
21
  /** Heating circuit state. */
21
22
  export type HeatingState = "active" | "idle";
22
- /** Battery control decision issued by the energy manager. */
23
- export type BatteryDecision = "block_discharge" | "charge_from_grid" | "force_discharge";
24
- /** EV charging control decision issued by the energy manager. */
25
- export type EvDecision = "charging_pv" | "charging_grid" | "charging_mixed";
26
- /** Heat pump control decision issued by the energy manager. */
27
- export type HeatpumpDecision = "dhw_boost" | "room_overheating" | "buffer_tank_boost";
28
23
  export interface EnyoDiagnosticsForecastInverterAppliance {
29
24
  type: EnyoApplianceTypeEnum.Inverter;
30
25
  applianceId: string;
@@ -154,60 +149,220 @@ export interface EnyoDiagnosticsForecast {
154
149
  /** Total estimated grid export in kWh. */
155
150
  totalGridExportKwh: number;
156
151
  }
157
- /** Battery control command for a specific appliance. */
158
- export interface EnyoDiagnosticsStorageControlCommand {
159
- type: EnyoApplianceTypeEnum.Storage;
152
+ /**
153
+ * Enum of all control plan action types.
154
+ * Each value represents a specific action the energy manager can plan for an appliance.
155
+ */
156
+ export declare enum EnyoDiagnosticsControlActionEnum {
157
+ /** Block the battery from discharging. */
158
+ BatteryBlockDischarge = "battery_block_discharge",
159
+ /** Charge the battery from the grid. */
160
+ BatteryChargeFromGrid = "battery_charge_from_grid",
161
+ /** Force the battery to discharge. */
162
+ BatteryForceDischarge = "battery_force_discharge",
163
+ /** Battery is charging from PV surplus (observational, not a command). */
164
+ BatteryChargingFromPv = "battery_charging_from_pv",
165
+ /** Battery is discharging into the home (observational, not a command). */
166
+ BatteryDischargingIntoHome = "battery_discharging_into_home",
167
+ /** Start charging the EV. */
168
+ EvStartCharge = "ev_start_charge",
169
+ /** Pause charging the EV. */
170
+ EvPauseCharge = "ev_pause_charge",
171
+ /** Boost domestic hot water production via heat pump. */
172
+ HeatpumpDhwBoost = "heatpump_dhw_boost",
173
+ /** Address room overheating via heat pump. */
174
+ HeatpumpRoomOverheating = "heatpump_room_overheating",
175
+ /** Boost buffer tank temperature via heat pump. */
176
+ HeatpumpBufferTankBoost = "heatpump_buffer_tank_boost"
177
+ }
178
+ /**
179
+ * Enum of reason types explaining why an action was planned.
180
+ * Used to attach context to actions for logging, debugging, and UI display.
181
+ */
182
+ export declare enum EnyoDiagnosticsActionReasonTypeEnum {
183
+ /** Action planned because the electricity price is below a configured threshold. */
184
+ ElectricityPriceBelowThreshold = "electricity-price-below-threshold",
185
+ /** Action planned because the electricity price is above a configured threshold. */
186
+ ElectricityPriceAboveThreshold = "electricity-price-above-threshold",
187
+ /** Action planned because PV surplus is available. */
188
+ PvSurplusAvailable = "pv-surplus-available",
189
+ /** Action planned because PV surplus is unavailable. */
190
+ PvSurplusUnavailable = "pv-surplus-unavailable",
191
+ /** Action planned because battery capacity is available. */
192
+ BatteryCapacityAvailable = "battery-capacity-available",
193
+ /** Action planned because battery capacity is unavailable. */
194
+ BatteryCapacityUnavailable = "battery-capacity-unavailable",
195
+ /** Action planned because the battery state of charge is low. */
196
+ BatterySoCLow = "battery-soc-low",
197
+ /** Action planned because the battery state of charge is high. */
198
+ BatterySoCHigh = "battery-soc-high",
199
+ /** Action planned based on the EV charging schedule. */
200
+ EvChargingSchedule = "ev-charging-schedule",
201
+ /** Action planned because of a grid operator power limitation. */
202
+ GridOperatorPowerLimitation = "grid-operator-power-limitation",
203
+ /** Action planned because the DHW temperature is low. */
204
+ DhwTemperatureLow = "dhw-temperature-low",
205
+ /** Action planned because the room temperature is high. */
206
+ RoomTemperatureHigh = "room-temperature-high",
207
+ /** Action planned because the buffer tank temperature is low. */
208
+ BufferTankTemperatureLow = "buffer-tank-temperature-low",
209
+ /** Action planned because the home consumption is high. */
210
+ HomeConsumptionHigh = "home-consumption-high"
211
+ }
212
+ /**
213
+ * Structured reason explaining why an action was planned.
214
+ * Provides context such as pricing information, capacity, power, or temperature values.
215
+ */
216
+ export interface EnyoDiagnosticsActionReason {
217
+ /** The reason type indicating why this action was planned. */
218
+ type: EnyoDiagnosticsActionReasonTypeEnum;
219
+ /** Electricity price per kWh that influenced this action. */
220
+ electricityPricePerKwh?: number;
221
+ /** Currency of the electricity price. */
222
+ currency?: EnyoCurrencyEnum;
223
+ /** Relevant capacity in kWh. */
224
+ capacityKwh?: number;
225
+ /** Relevant power in Watts. */
226
+ powerW?: number;
227
+ /** Relevant temperature in Celsius. */
228
+ temperatureC?: number;
229
+ /** Relevant state of charge as a percentage. */
230
+ socPercent?: number;
231
+ }
232
+ /**
233
+ * Base interface for all control plan actions.
234
+ * Each specific action interface extends this with narrowed discriminant fields.
235
+ */
236
+ export interface EnyoDiagnosticsControlActionBase {
237
+ /** Discriminant identifying the specific action type. */
238
+ action: EnyoDiagnosticsControlActionEnum;
239
+ /** Appliance type this action applies to. */
240
+ type: EnyoApplianceTypeEnum;
160
241
  /** Target appliance ID. */
161
242
  applianceId: string;
162
- /** ISO 8601 timestamp when this command starts. */
243
+ /** ISO 8601 timestamp when this action starts. */
163
244
  timestampIso: string;
164
- /** Control decision for the battery. */
165
- decision: BatteryDecision;
245
+ /** Duration of this action in minutes. */
246
+ durationInMinutes: number;
247
+ /** Whether this action sends a command to hardware ({@code true}) or is observational ({@code false}). */
248
+ isCommand: boolean;
249
+ /** Reason why this action was planned. */
250
+ reason: EnyoDiagnosticsActionReason;
251
+ }
252
+ /** Battery action: block the battery from discharging. */
253
+ export interface EnyoDiagnosticsStorageBlockDischargeAction extends EnyoDiagnosticsControlActionBase {
254
+ action: EnyoDiagnosticsControlActionEnum.BatteryBlockDischarge;
255
+ type: EnyoApplianceTypeEnum.Storage;
256
+ isCommand: true;
257
+ /** Target power in Watts. */
258
+ powerW: number;
259
+ /** Optional target state of charge as a percentage. */
260
+ targetSoCPercent?: number;
261
+ }
262
+ /** Battery action: charge the battery from the grid. */
263
+ export interface EnyoDiagnosticsStorageChargeFromGridAction extends EnyoDiagnosticsControlActionBase {
264
+ action: EnyoDiagnosticsControlActionEnum.BatteryChargeFromGrid;
265
+ type: EnyoApplianceTypeEnum.Storage;
266
+ isCommand: true;
267
+ /** Target power in Watts. */
268
+ powerW: number;
269
+ /** Optional target state of charge as a percentage. */
270
+ targetSoCPercent?: number;
271
+ }
272
+ /** Battery action: force the battery to discharge. */
273
+ export interface EnyoDiagnosticsStorageForceDischargeAction extends EnyoDiagnosticsControlActionBase {
274
+ action: EnyoDiagnosticsControlActionEnum.BatteryForceDischarge;
275
+ type: EnyoApplianceTypeEnum.Storage;
276
+ isCommand: true;
166
277
  /** Target power in Watts. */
167
278
  powerW: number;
168
- /** Duration of this command in minutes. */
169
- durationInMinutes: number;
170
279
  /** Optional target state of charge as a percentage. */
171
280
  targetSoCPercent?: number;
172
281
  }
173
- /** EV charger control command for a specific appliance. */
174
- export interface EnyoDiagnosticsChargerControlCommand {
282
+ /** Battery action: battery is charging from PV surplus (observational, not a command). */
283
+ export interface EnyoDiagnosticsStorageChargingFromPvAction extends EnyoDiagnosticsControlActionBase {
284
+ action: EnyoDiagnosticsControlActionEnum.BatteryChargingFromPv;
285
+ type: EnyoApplianceTypeEnum.Storage;
286
+ isCommand: false;
287
+ /** Power in Watts being charged from PV. */
288
+ powerW: number;
289
+ /** Current state of charge as a percentage. */
290
+ socPercent?: number;
291
+ }
292
+ /** Battery action: battery is discharging into the home (observational, not a command). */
293
+ export interface EnyoDiagnosticsStorageDischargingIntoHomeAction extends EnyoDiagnosticsControlActionBase {
294
+ action: EnyoDiagnosticsControlActionEnum.BatteryDischargingIntoHome;
295
+ type: EnyoApplianceTypeEnum.Storage;
296
+ isCommand: false;
297
+ /** Power in Watts being discharged into the home. */
298
+ powerW: number;
299
+ /** Current state of charge as a percentage. */
300
+ socPercent?: number;
301
+ }
302
+ /** EV charger action: start charging the EV. */
303
+ export interface EnyoDiagnosticsChargerStartChargeAction extends EnyoDiagnosticsControlActionBase {
304
+ action: EnyoDiagnosticsControlActionEnum.EvStartCharge;
175
305
  type: EnyoApplianceTypeEnum.Charger;
176
- /** Target appliance ID. */
177
- applianceId: string;
178
- /** ISO 8601 timestamp when this command starts. */
179
- timestampIso: string;
180
- /** Control decision for the EV charger. */
181
- decision: EvDecision;
306
+ isCommand: true;
182
307
  /** Charging power in Watts. */
183
308
  chargingPowerW: number;
184
- /** Duration of this command in minutes. */
185
- durationInMinutes: number;
186
309
  /** Optional charging limit in kW. */
187
310
  chargingLimitKw?: number;
188
311
  }
189
- /** Heat pump control command for a specific appliance. */
190
- export interface EnyoDiagnosticsHeatpumpControlCommand {
312
+ /** EV charger action: pause charging the EV. */
313
+ export interface EnyoDiagnosticsChargerPauseChargeAction extends EnyoDiagnosticsControlActionBase {
314
+ action: EnyoDiagnosticsControlActionEnum.EvPauseCharge;
315
+ type: EnyoApplianceTypeEnum.Charger;
316
+ isCommand: true;
317
+ }
318
+ /** Heatpump action: boost domestic hot water production. */
319
+ export interface EnyoDiagnosticsHeatpumpDhwBoostAction extends EnyoDiagnosticsControlActionBase {
320
+ action: EnyoDiagnosticsControlActionEnum.HeatpumpDhwBoost;
191
321
  type: EnyoApplianceTypeEnum.Heatpump;
192
- /** Target appliance ID. */
193
- applianceId: string;
194
- /** ISO 8601 timestamp when this command starts. */
195
- timestampIso: string;
196
- /** Control decision for the heat pump. */
197
- decision: HeatpumpDecision;
322
+ isCommand: true;
198
323
  /** Target power in Watts. */
199
324
  powerW: number;
200
- /** Duration of this command in minutes. */
201
- durationInMinutes: number;
202
325
  /** Optional target temperature in Celsius. */
203
326
  targetTempC?: number;
327
+ /** Optional current domestic hot water temperature in Celsius. */
328
+ currentTemperatureC?: number;
329
+ /** Optional current outdoor temperature in Celsius. */
330
+ outdoorTemperatureC?: number;
331
+ }
332
+ /** Heatpump action: address room overheating. */
333
+ export interface EnyoDiagnosticsHeatpumpRoomOverheatingAction extends EnyoDiagnosticsControlActionBase {
334
+ action: EnyoDiagnosticsControlActionEnum.HeatpumpRoomOverheating;
335
+ type: EnyoApplianceTypeEnum.Heatpump;
336
+ isCommand: true;
337
+ /** Target power in Watts. */
338
+ powerW: number;
339
+ /** Optional target temperature in Celsius. */
340
+ targetTempC?: number;
341
+ /** Optional current room temperature in Celsius. */
342
+ currentTemperatureC?: number;
343
+ /** Optional current outdoor temperature in Celsius. */
344
+ outdoorTemperatureC?: number;
345
+ }
346
+ /** Heatpump action: boost buffer tank temperature. */
347
+ export interface EnyoDiagnosticsHeatpumpBufferTankBoostAction extends EnyoDiagnosticsControlActionBase {
348
+ action: EnyoDiagnosticsControlActionEnum.HeatpumpBufferTankBoost;
349
+ type: EnyoApplianceTypeEnum.Heatpump;
350
+ isCommand: true;
351
+ /** Target power in Watts. */
352
+ powerW: number;
353
+ /** Optional target temperature in Celsius. */
354
+ targetTempC?: number;
355
+ /** Optional current room temperature in Celsius. */
356
+ currentTemperatureC?: number;
357
+ /** Optional current outdoor temperature in Celsius. */
358
+ outdoorTemperatureC?: number;
204
359
  }
205
- /** Union of all appliance control command types. */
206
- export type EnyoDiagnosticsApplianceControlCommand = EnyoDiagnosticsStorageControlCommand | EnyoDiagnosticsChargerControlCommand | EnyoDiagnosticsHeatpumpControlCommand;
207
- /** Complete control plan with duration-based commands and cost estimates. */
360
+ /** Union of all control plan action types. */
361
+ export type EnyoDiagnosticsControlAction = EnyoDiagnosticsStorageBlockDischargeAction | EnyoDiagnosticsStorageChargeFromGridAction | EnyoDiagnosticsStorageForceDischargeAction | EnyoDiagnosticsStorageChargingFromPvAction | EnyoDiagnosticsStorageDischargingIntoHomeAction | EnyoDiagnosticsChargerStartChargeAction | EnyoDiagnosticsChargerPauseChargeAction | EnyoDiagnosticsHeatpumpDhwBoostAction | EnyoDiagnosticsHeatpumpRoomOverheatingAction | EnyoDiagnosticsHeatpumpBufferTankBoostAction;
362
+ /** Complete control plan with duration-based actions and cost estimates. */
208
363
  export interface EnyoDiagnosticsControlPlan {
209
- /** Sequence of appliance control commands, each with its own duration. */
210
- commands: EnyoDiagnosticsApplianceControlCommand[];
364
+ /** Sequence of planned actions, each with its own duration. */
365
+ actions: EnyoDiagnosticsControlAction[];
211
366
  /** ISO 8601 timestamp when this plan was generated. */
212
367
  generatedAtIso: string;
213
368
  /** Total estimated cost in EUR. */
@@ -9,7 +9,7 @@ exports.getSdkVersion = getSdkVersion;
9
9
  /**
10
10
  * Current version of the enyo Energy App SDK.
11
11
  */
12
- exports.SDK_VERSION = '0.0.100';
12
+ exports.SDK_VERSION = '0.0.102';
13
13
  /**
14
14
  * Gets the current SDK version.
15
15
  * @returns The semantic version string of the SDK
@@ -5,7 +5,7 @@
5
5
  /**
6
6
  * Current version of the enyo Energy App SDK.
7
7
  */
8
- export declare const SDK_VERSION = "0.0.100";
8
+ export declare const SDK_VERSION = "0.0.102";
9
9
  /**
10
10
  * Gets the current SDK version.
11
11
  * @returns The semantic version string of the SDK
@@ -12,7 +12,7 @@ export interface EnergyAppDiagnostics {
12
12
  * system-level power values, per-appliance snapshots, and derived energy values
13
13
  * @param forecast - The forecast containing time-bucketed predictions for consumption,
14
14
  * production, pricing, and appliance-specific data
15
- * @param controlPlan - The time-slotted control plan with commands for each appliance
15
+ * @param controlPlan - The time-slotted control plan with actions for each appliance
16
16
  * and estimated costs
17
17
  *
18
18
  * @example
@@ -26,23 +26,29 @@ export interface EnergyAppEnergyManager {
26
26
  registerFeatures(features: EnergyManagerFeatureEnum[]): void;
27
27
  /**
28
28
  * Only for Energy Manager Energy Apps: Publishes the energy manager's control plan forecast.
29
- * The control plan contains time-slotted commands for each appliance along with
29
+ * The control plan contains time-slotted actions for each appliance along with
30
30
  * estimated costs and grid power values.
31
31
  *
32
- * @param controlPlan - The time-slotted control plan with commands for each appliance
32
+ * @param controlPlan - The time-slotted control plan with actions for each appliance
33
33
  * and estimated costs
34
34
  *
35
35
  * @example
36
36
  * ```typescript
37
37
  * const energyManager = energyApp.useEnergyManager();
38
38
  * energyManager.publishForecast({
39
- * commands: [
39
+ * actions: [
40
40
  * {
41
+ * action: EnyoDiagnosticsControlActionEnum.BatteryChargeFromGrid,
41
42
  * type: EnyoApplianceTypeEnum.Storage,
42
43
  * applianceId: 'battery-1',
43
- * decision: BatteryDecision.Charge,
44
+ * timestampIso: new Date().toISOString(),
45
+ * isCommand: true,
44
46
  * powerW: 3000,
45
- * durationInMinutes: 60
47
+ * durationInMinutes: 60,
48
+ * reason: {
49
+ * type: EnyoDiagnosticsActionReasonTypeEnum.ElectricityPriceBelowThreshold,
50
+ * electricityPricePerKwh: 0.15,
51
+ * }
46
52
  * }
47
53
  * ],
48
54
  * generatedAtIso: new Date().toISOString(),
@@ -1,4 +1,5 @@
1
1
  import { EnyoApplianceTypeEnum } from "./enyo-appliance.js";
2
+ import { EnyoCurrencyEnum } from "./enyo-currency.js";
2
3
  import { EnyoChargeModeEnum } from "./enyo-data-bus-value.js";
3
4
  /** Energy source type for price table entries. */
4
5
  export declare enum EnyoDiagnosticsPriceTableSourceEnum {
@@ -19,12 +20,6 @@ export interface EnyoDiagnosticsPriceTableEntry {
19
20
  export type DhwState = "charging" | "discharging" | "idle";
20
21
  /** Heating circuit state. */
21
22
  export type HeatingState = "active" | "idle";
22
- /** Battery control decision issued by the energy manager. */
23
- export type BatteryDecision = "block_discharge" | "charge_from_grid" | "force_discharge";
24
- /** EV charging control decision issued by the energy manager. */
25
- export type EvDecision = "charging_pv" | "charging_grid" | "charging_mixed";
26
- /** Heat pump control decision issued by the energy manager. */
27
- export type HeatpumpDecision = "dhw_boost" | "room_overheating" | "buffer_tank_boost";
28
23
  export interface EnyoDiagnosticsForecastInverterAppliance {
29
24
  type: EnyoApplianceTypeEnum.Inverter;
30
25
  applianceId: string;
@@ -154,60 +149,220 @@ export interface EnyoDiagnosticsForecast {
154
149
  /** Total estimated grid export in kWh. */
155
150
  totalGridExportKwh: number;
156
151
  }
157
- /** Battery control command for a specific appliance. */
158
- export interface EnyoDiagnosticsStorageControlCommand {
159
- type: EnyoApplianceTypeEnum.Storage;
152
+ /**
153
+ * Enum of all control plan action types.
154
+ * Each value represents a specific action the energy manager can plan for an appliance.
155
+ */
156
+ export declare enum EnyoDiagnosticsControlActionEnum {
157
+ /** Block the battery from discharging. */
158
+ BatteryBlockDischarge = "battery_block_discharge",
159
+ /** Charge the battery from the grid. */
160
+ BatteryChargeFromGrid = "battery_charge_from_grid",
161
+ /** Force the battery to discharge. */
162
+ BatteryForceDischarge = "battery_force_discharge",
163
+ /** Battery is charging from PV surplus (observational, not a command). */
164
+ BatteryChargingFromPv = "battery_charging_from_pv",
165
+ /** Battery is discharging into the home (observational, not a command). */
166
+ BatteryDischargingIntoHome = "battery_discharging_into_home",
167
+ /** Start charging the EV. */
168
+ EvStartCharge = "ev_start_charge",
169
+ /** Pause charging the EV. */
170
+ EvPauseCharge = "ev_pause_charge",
171
+ /** Boost domestic hot water production via heat pump. */
172
+ HeatpumpDhwBoost = "heatpump_dhw_boost",
173
+ /** Address room overheating via heat pump. */
174
+ HeatpumpRoomOverheating = "heatpump_room_overheating",
175
+ /** Boost buffer tank temperature via heat pump. */
176
+ HeatpumpBufferTankBoost = "heatpump_buffer_tank_boost"
177
+ }
178
+ /**
179
+ * Enum of reason types explaining why an action was planned.
180
+ * Used to attach context to actions for logging, debugging, and UI display.
181
+ */
182
+ export declare enum EnyoDiagnosticsActionReasonTypeEnum {
183
+ /** Action planned because the electricity price is below a configured threshold. */
184
+ ElectricityPriceBelowThreshold = "electricity-price-below-threshold",
185
+ /** Action planned because the electricity price is above a configured threshold. */
186
+ ElectricityPriceAboveThreshold = "electricity-price-above-threshold",
187
+ /** Action planned because PV surplus is available. */
188
+ PvSurplusAvailable = "pv-surplus-available",
189
+ /** Action planned because PV surplus is unavailable. */
190
+ PvSurplusUnavailable = "pv-surplus-unavailable",
191
+ /** Action planned because battery capacity is available. */
192
+ BatteryCapacityAvailable = "battery-capacity-available",
193
+ /** Action planned because battery capacity is unavailable. */
194
+ BatteryCapacityUnavailable = "battery-capacity-unavailable",
195
+ /** Action planned because the battery state of charge is low. */
196
+ BatterySoCLow = "battery-soc-low",
197
+ /** Action planned because the battery state of charge is high. */
198
+ BatterySoCHigh = "battery-soc-high",
199
+ /** Action planned based on the EV charging schedule. */
200
+ EvChargingSchedule = "ev-charging-schedule",
201
+ /** Action planned because of a grid operator power limitation. */
202
+ GridOperatorPowerLimitation = "grid-operator-power-limitation",
203
+ /** Action planned because the DHW temperature is low. */
204
+ DhwTemperatureLow = "dhw-temperature-low",
205
+ /** Action planned because the room temperature is high. */
206
+ RoomTemperatureHigh = "room-temperature-high",
207
+ /** Action planned because the buffer tank temperature is low. */
208
+ BufferTankTemperatureLow = "buffer-tank-temperature-low",
209
+ /** Action planned because the home consumption is high. */
210
+ HomeConsumptionHigh = "home-consumption-high"
211
+ }
212
+ /**
213
+ * Structured reason explaining why an action was planned.
214
+ * Provides context such as pricing information, capacity, power, or temperature values.
215
+ */
216
+ export interface EnyoDiagnosticsActionReason {
217
+ /** The reason type indicating why this action was planned. */
218
+ type: EnyoDiagnosticsActionReasonTypeEnum;
219
+ /** Electricity price per kWh that influenced this action. */
220
+ electricityPricePerKwh?: number;
221
+ /** Currency of the electricity price. */
222
+ currency?: EnyoCurrencyEnum;
223
+ /** Relevant capacity in kWh. */
224
+ capacityKwh?: number;
225
+ /** Relevant power in Watts. */
226
+ powerW?: number;
227
+ /** Relevant temperature in Celsius. */
228
+ temperatureC?: number;
229
+ /** Relevant state of charge as a percentage. */
230
+ socPercent?: number;
231
+ }
232
+ /**
233
+ * Base interface for all control plan actions.
234
+ * Each specific action interface extends this with narrowed discriminant fields.
235
+ */
236
+ export interface EnyoDiagnosticsControlActionBase {
237
+ /** Discriminant identifying the specific action type. */
238
+ action: EnyoDiagnosticsControlActionEnum;
239
+ /** Appliance type this action applies to. */
240
+ type: EnyoApplianceTypeEnum;
160
241
  /** Target appliance ID. */
161
242
  applianceId: string;
162
- /** ISO 8601 timestamp when this command starts. */
243
+ /** ISO 8601 timestamp when this action starts. */
163
244
  timestampIso: string;
164
- /** Control decision for the battery. */
165
- decision: BatteryDecision;
245
+ /** Duration of this action in minutes. */
246
+ durationInMinutes: number;
247
+ /** Whether this action sends a command to hardware ({@code true}) or is observational ({@code false}). */
248
+ isCommand: boolean;
249
+ /** Reason why this action was planned. */
250
+ reason: EnyoDiagnosticsActionReason;
251
+ }
252
+ /** Battery action: block the battery from discharging. */
253
+ export interface EnyoDiagnosticsStorageBlockDischargeAction extends EnyoDiagnosticsControlActionBase {
254
+ action: EnyoDiagnosticsControlActionEnum.BatteryBlockDischarge;
255
+ type: EnyoApplianceTypeEnum.Storage;
256
+ isCommand: true;
257
+ /** Target power in Watts. */
258
+ powerW: number;
259
+ /** Optional target state of charge as a percentage. */
260
+ targetSoCPercent?: number;
261
+ }
262
+ /** Battery action: charge the battery from the grid. */
263
+ export interface EnyoDiagnosticsStorageChargeFromGridAction extends EnyoDiagnosticsControlActionBase {
264
+ action: EnyoDiagnosticsControlActionEnum.BatteryChargeFromGrid;
265
+ type: EnyoApplianceTypeEnum.Storage;
266
+ isCommand: true;
267
+ /** Target power in Watts. */
268
+ powerW: number;
269
+ /** Optional target state of charge as a percentage. */
270
+ targetSoCPercent?: number;
271
+ }
272
+ /** Battery action: force the battery to discharge. */
273
+ export interface EnyoDiagnosticsStorageForceDischargeAction extends EnyoDiagnosticsControlActionBase {
274
+ action: EnyoDiagnosticsControlActionEnum.BatteryForceDischarge;
275
+ type: EnyoApplianceTypeEnum.Storage;
276
+ isCommand: true;
166
277
  /** Target power in Watts. */
167
278
  powerW: number;
168
- /** Duration of this command in minutes. */
169
- durationInMinutes: number;
170
279
  /** Optional target state of charge as a percentage. */
171
280
  targetSoCPercent?: number;
172
281
  }
173
- /** EV charger control command for a specific appliance. */
174
- export interface EnyoDiagnosticsChargerControlCommand {
282
+ /** Battery action: battery is charging from PV surplus (observational, not a command). */
283
+ export interface EnyoDiagnosticsStorageChargingFromPvAction extends EnyoDiagnosticsControlActionBase {
284
+ action: EnyoDiagnosticsControlActionEnum.BatteryChargingFromPv;
285
+ type: EnyoApplianceTypeEnum.Storage;
286
+ isCommand: false;
287
+ /** Power in Watts being charged from PV. */
288
+ powerW: number;
289
+ /** Current state of charge as a percentage. */
290
+ socPercent?: number;
291
+ }
292
+ /** Battery action: battery is discharging into the home (observational, not a command). */
293
+ export interface EnyoDiagnosticsStorageDischargingIntoHomeAction extends EnyoDiagnosticsControlActionBase {
294
+ action: EnyoDiagnosticsControlActionEnum.BatteryDischargingIntoHome;
295
+ type: EnyoApplianceTypeEnum.Storage;
296
+ isCommand: false;
297
+ /** Power in Watts being discharged into the home. */
298
+ powerW: number;
299
+ /** Current state of charge as a percentage. */
300
+ socPercent?: number;
301
+ }
302
+ /** EV charger action: start charging the EV. */
303
+ export interface EnyoDiagnosticsChargerStartChargeAction extends EnyoDiagnosticsControlActionBase {
304
+ action: EnyoDiagnosticsControlActionEnum.EvStartCharge;
175
305
  type: EnyoApplianceTypeEnum.Charger;
176
- /** Target appliance ID. */
177
- applianceId: string;
178
- /** ISO 8601 timestamp when this command starts. */
179
- timestampIso: string;
180
- /** Control decision for the EV charger. */
181
- decision: EvDecision;
306
+ isCommand: true;
182
307
  /** Charging power in Watts. */
183
308
  chargingPowerW: number;
184
- /** Duration of this command in minutes. */
185
- durationInMinutes: number;
186
309
  /** Optional charging limit in kW. */
187
310
  chargingLimitKw?: number;
188
311
  }
189
- /** Heat pump control command for a specific appliance. */
190
- export interface EnyoDiagnosticsHeatpumpControlCommand {
312
+ /** EV charger action: pause charging the EV. */
313
+ export interface EnyoDiagnosticsChargerPauseChargeAction extends EnyoDiagnosticsControlActionBase {
314
+ action: EnyoDiagnosticsControlActionEnum.EvPauseCharge;
315
+ type: EnyoApplianceTypeEnum.Charger;
316
+ isCommand: true;
317
+ }
318
+ /** Heatpump action: boost domestic hot water production. */
319
+ export interface EnyoDiagnosticsHeatpumpDhwBoostAction extends EnyoDiagnosticsControlActionBase {
320
+ action: EnyoDiagnosticsControlActionEnum.HeatpumpDhwBoost;
191
321
  type: EnyoApplianceTypeEnum.Heatpump;
192
- /** Target appliance ID. */
193
- applianceId: string;
194
- /** ISO 8601 timestamp when this command starts. */
195
- timestampIso: string;
196
- /** Control decision for the heat pump. */
197
- decision: HeatpumpDecision;
322
+ isCommand: true;
198
323
  /** Target power in Watts. */
199
324
  powerW: number;
200
- /** Duration of this command in minutes. */
201
- durationInMinutes: number;
202
325
  /** Optional target temperature in Celsius. */
203
326
  targetTempC?: number;
327
+ /** Optional current domestic hot water temperature in Celsius. */
328
+ currentTemperatureC?: number;
329
+ /** Optional current outdoor temperature in Celsius. */
330
+ outdoorTemperatureC?: number;
331
+ }
332
+ /** Heatpump action: address room overheating. */
333
+ export interface EnyoDiagnosticsHeatpumpRoomOverheatingAction extends EnyoDiagnosticsControlActionBase {
334
+ action: EnyoDiagnosticsControlActionEnum.HeatpumpRoomOverheating;
335
+ type: EnyoApplianceTypeEnum.Heatpump;
336
+ isCommand: true;
337
+ /** Target power in Watts. */
338
+ powerW: number;
339
+ /** Optional target temperature in Celsius. */
340
+ targetTempC?: number;
341
+ /** Optional current room temperature in Celsius. */
342
+ currentTemperatureC?: number;
343
+ /** Optional current outdoor temperature in Celsius. */
344
+ outdoorTemperatureC?: number;
345
+ }
346
+ /** Heatpump action: boost buffer tank temperature. */
347
+ export interface EnyoDiagnosticsHeatpumpBufferTankBoostAction extends EnyoDiagnosticsControlActionBase {
348
+ action: EnyoDiagnosticsControlActionEnum.HeatpumpBufferTankBoost;
349
+ type: EnyoApplianceTypeEnum.Heatpump;
350
+ isCommand: true;
351
+ /** Target power in Watts. */
352
+ powerW: number;
353
+ /** Optional target temperature in Celsius. */
354
+ targetTempC?: number;
355
+ /** Optional current room temperature in Celsius. */
356
+ currentTemperatureC?: number;
357
+ /** Optional current outdoor temperature in Celsius. */
358
+ outdoorTemperatureC?: number;
204
359
  }
205
- /** Union of all appliance control command types. */
206
- export type EnyoDiagnosticsApplianceControlCommand = EnyoDiagnosticsStorageControlCommand | EnyoDiagnosticsChargerControlCommand | EnyoDiagnosticsHeatpumpControlCommand;
207
- /** Complete control plan with duration-based commands and cost estimates. */
360
+ /** Union of all control plan action types. */
361
+ export type EnyoDiagnosticsControlAction = EnyoDiagnosticsStorageBlockDischargeAction | EnyoDiagnosticsStorageChargeFromGridAction | EnyoDiagnosticsStorageForceDischargeAction | EnyoDiagnosticsStorageChargingFromPvAction | EnyoDiagnosticsStorageDischargingIntoHomeAction | EnyoDiagnosticsChargerStartChargeAction | EnyoDiagnosticsChargerPauseChargeAction | EnyoDiagnosticsHeatpumpDhwBoostAction | EnyoDiagnosticsHeatpumpRoomOverheatingAction | EnyoDiagnosticsHeatpumpBufferTankBoostAction;
362
+ /** Complete control plan with duration-based actions and cost estimates. */
208
363
  export interface EnyoDiagnosticsControlPlan {
209
- /** Sequence of appliance control commands, each with its own duration. */
210
- commands: EnyoDiagnosticsApplianceControlCommand[];
364
+ /** Sequence of planned actions, each with its own duration. */
365
+ actions: EnyoDiagnosticsControlAction[];
211
366
  /** ISO 8601 timestamp when this plan was generated. */
212
367
  generatedAtIso: string;
213
368
  /** Total estimated cost in EUR. */
@@ -6,3 +6,66 @@ export var EnyoDiagnosticsPriceTableSourceEnum;
6
6
  EnyoDiagnosticsPriceTableSourceEnum["Battery"] = "battery";
7
7
  EnyoDiagnosticsPriceTableSourceEnum["Grid"] = "grid";
8
8
  })(EnyoDiagnosticsPriceTableSourceEnum || (EnyoDiagnosticsPriceTableSourceEnum = {}));
9
+ // ─── Action-based control plan ──────────────────────────────
10
+ /**
11
+ * Enum of all control plan action types.
12
+ * Each value represents a specific action the energy manager can plan for an appliance.
13
+ */
14
+ export var EnyoDiagnosticsControlActionEnum;
15
+ (function (EnyoDiagnosticsControlActionEnum) {
16
+ /** Block the battery from discharging. */
17
+ EnyoDiagnosticsControlActionEnum["BatteryBlockDischarge"] = "battery_block_discharge";
18
+ /** Charge the battery from the grid. */
19
+ EnyoDiagnosticsControlActionEnum["BatteryChargeFromGrid"] = "battery_charge_from_grid";
20
+ /** Force the battery to discharge. */
21
+ EnyoDiagnosticsControlActionEnum["BatteryForceDischarge"] = "battery_force_discharge";
22
+ /** Battery is charging from PV surplus (observational, not a command). */
23
+ EnyoDiagnosticsControlActionEnum["BatteryChargingFromPv"] = "battery_charging_from_pv";
24
+ /** Battery is discharging into the home (observational, not a command). */
25
+ EnyoDiagnosticsControlActionEnum["BatteryDischargingIntoHome"] = "battery_discharging_into_home";
26
+ /** Start charging the EV. */
27
+ EnyoDiagnosticsControlActionEnum["EvStartCharge"] = "ev_start_charge";
28
+ /** Pause charging the EV. */
29
+ EnyoDiagnosticsControlActionEnum["EvPauseCharge"] = "ev_pause_charge";
30
+ /** Boost domestic hot water production via heat pump. */
31
+ EnyoDiagnosticsControlActionEnum["HeatpumpDhwBoost"] = "heatpump_dhw_boost";
32
+ /** Address room overheating via heat pump. */
33
+ EnyoDiagnosticsControlActionEnum["HeatpumpRoomOverheating"] = "heatpump_room_overheating";
34
+ /** Boost buffer tank temperature via heat pump. */
35
+ EnyoDiagnosticsControlActionEnum["HeatpumpBufferTankBoost"] = "heatpump_buffer_tank_boost";
36
+ })(EnyoDiagnosticsControlActionEnum || (EnyoDiagnosticsControlActionEnum = {}));
37
+ /**
38
+ * Enum of reason types explaining why an action was planned.
39
+ * Used to attach context to actions for logging, debugging, and UI display.
40
+ */
41
+ export var EnyoDiagnosticsActionReasonTypeEnum;
42
+ (function (EnyoDiagnosticsActionReasonTypeEnum) {
43
+ /** Action planned because the electricity price is below a configured threshold. */
44
+ EnyoDiagnosticsActionReasonTypeEnum["ElectricityPriceBelowThreshold"] = "electricity-price-below-threshold";
45
+ /** Action planned because the electricity price is above a configured threshold. */
46
+ EnyoDiagnosticsActionReasonTypeEnum["ElectricityPriceAboveThreshold"] = "electricity-price-above-threshold";
47
+ /** Action planned because PV surplus is available. */
48
+ EnyoDiagnosticsActionReasonTypeEnum["PvSurplusAvailable"] = "pv-surplus-available";
49
+ /** Action planned because PV surplus is unavailable. */
50
+ EnyoDiagnosticsActionReasonTypeEnum["PvSurplusUnavailable"] = "pv-surplus-unavailable";
51
+ /** Action planned because battery capacity is available. */
52
+ EnyoDiagnosticsActionReasonTypeEnum["BatteryCapacityAvailable"] = "battery-capacity-available";
53
+ /** Action planned because battery capacity is unavailable. */
54
+ EnyoDiagnosticsActionReasonTypeEnum["BatteryCapacityUnavailable"] = "battery-capacity-unavailable";
55
+ /** Action planned because the battery state of charge is low. */
56
+ EnyoDiagnosticsActionReasonTypeEnum["BatterySoCLow"] = "battery-soc-low";
57
+ /** Action planned because the battery state of charge is high. */
58
+ EnyoDiagnosticsActionReasonTypeEnum["BatterySoCHigh"] = "battery-soc-high";
59
+ /** Action planned based on the EV charging schedule. */
60
+ EnyoDiagnosticsActionReasonTypeEnum["EvChargingSchedule"] = "ev-charging-schedule";
61
+ /** Action planned because of a grid operator power limitation. */
62
+ EnyoDiagnosticsActionReasonTypeEnum["GridOperatorPowerLimitation"] = "grid-operator-power-limitation";
63
+ /** Action planned because the DHW temperature is low. */
64
+ EnyoDiagnosticsActionReasonTypeEnum["DhwTemperatureLow"] = "dhw-temperature-low";
65
+ /** Action planned because the room temperature is high. */
66
+ EnyoDiagnosticsActionReasonTypeEnum["RoomTemperatureHigh"] = "room-temperature-high";
67
+ /** Action planned because the buffer tank temperature is low. */
68
+ EnyoDiagnosticsActionReasonTypeEnum["BufferTankTemperatureLow"] = "buffer-tank-temperature-low";
69
+ /** Action planned because the home consumption is high. */
70
+ EnyoDiagnosticsActionReasonTypeEnum["HomeConsumptionHigh"] = "home-consumption-high";
71
+ })(EnyoDiagnosticsActionReasonTypeEnum || (EnyoDiagnosticsActionReasonTypeEnum = {}));
package/dist/version.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  /**
6
6
  * Current version of the enyo Energy App SDK.
7
7
  */
8
- export declare const SDK_VERSION = "0.0.100";
8
+ export declare const SDK_VERSION = "0.0.102";
9
9
  /**
10
10
  * Gets the current SDK version.
11
11
  * @returns The semantic version string of the SDK
package/dist/version.js CHANGED
@@ -5,7 +5,7 @@
5
5
  /**
6
6
  * Current version of the enyo Energy App SDK.
7
7
  */
8
- export const SDK_VERSION = '0.0.100';
8
+ export const SDK_VERSION = '0.0.102';
9
9
  /**
10
10
  * Gets the current SDK version.
11
11
  * @returns The semantic version string of the SDK
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enyo-energy/energy-app-sdk",
3
- "version": "0.0.100",
3
+ "version": "0.0.102",
4
4
  "description": "enyo Energy App SDK",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",