@enyo-energy/energy-app-sdk 0.0.128 → 0.0.130

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 (29) hide show
  1. package/dist/cjs/integrations/storage-integration-energy-app.cjs +6 -0
  2. package/dist/cjs/integrations/storage-integration-energy-app.d.cts +18 -1
  3. package/dist/cjs/packages/energy-app-notification.d.cts +56 -32
  4. package/dist/cjs/types/enyo-appliance.cjs +1 -1
  5. package/dist/cjs/types/enyo-appliance.d.cts +3 -1
  6. package/dist/cjs/types/enyo-battery-appliance.cjs +5 -0
  7. package/dist/cjs/types/enyo-battery-appliance.d.cts +5 -0
  8. package/dist/cjs/types/enyo-data-bus-value.cjs +3 -0
  9. package/dist/cjs/types/enyo-data-bus-value.d.cts +49 -0
  10. package/dist/cjs/types/enyo-heatpump-appliance.cjs +2 -0
  11. package/dist/cjs/types/enyo-heatpump-appliance.d.cts +3 -1
  12. package/dist/cjs/types/enyo-notification.d.cts +122 -27
  13. package/dist/cjs/version.cjs +1 -1
  14. package/dist/cjs/version.d.cts +1 -1
  15. package/dist/integrations/storage-integration-energy-app.d.ts +18 -1
  16. package/dist/integrations/storage-integration-energy-app.js +6 -0
  17. package/dist/packages/energy-app-notification.d.ts +56 -32
  18. package/dist/types/enyo-appliance.d.ts +3 -1
  19. package/dist/types/enyo-appliance.js +1 -1
  20. package/dist/types/enyo-battery-appliance.d.ts +5 -0
  21. package/dist/types/enyo-battery-appliance.js +5 -0
  22. package/dist/types/enyo-data-bus-value.d.ts +49 -0
  23. package/dist/types/enyo-data-bus-value.js +3 -0
  24. package/dist/types/enyo-heatpump-appliance.d.ts +3 -1
  25. package/dist/types/enyo-heatpump-appliance.js +2 -0
  26. package/dist/types/enyo-notification.d.ts +122 -27
  27. package/dist/version.d.ts +1 -1
  28. package/dist/version.js +1 -1
  29. package/package.json +1 -1
@@ -10,7 +10,10 @@ const enyo_data_bus_value_js_1 = require("../types/enyo-data-bus-value.cjs");
10
10
  * Subscribes to:
11
11
  * - `StartStorageGridChargeV1` — start charging the battery from the grid.
12
12
  * - `StopStorageGridChargeV1` — stop grid charging.
13
+ * - `StartStorageGridDischargeV1` — start discharging the battery into the grid.
14
+ * - `StopStorageGridDischargeV1` — stop grid discharging.
13
15
  * - `SetStorageDischargeLimitV1` — set the maximum discharge power.
16
+ * - `SetStorageChargeLimitV1` — set the maximum charge power.
14
17
  * - `GridOperatorPowerLimitationV1` — §14a EnWG broadcast (handled in base).
15
18
  */
16
19
  class StorageIntegrationEnergyApp extends integration_energy_app_js_1.IntegrationEnergyApp {
@@ -26,7 +29,10 @@ class StorageIntegrationEnergyApp extends integration_energy_app_js_1.Integratio
26
29
  registerHandlers() {
27
30
  this.registerCommandHandler(enyo_data_bus_value_js_1.EnyoDataBusMessageEnum.StartStorageGridChargeV1, (m) => this.handleStartStorageGridCharge(m));
28
31
  this.registerCommandHandler(enyo_data_bus_value_js_1.EnyoDataBusMessageEnum.StopStorageGridChargeV1, (m) => this.handleStopStorageGridCharge(m));
32
+ this.registerCommandHandler(enyo_data_bus_value_js_1.EnyoDataBusMessageEnum.StartStorageGridDischargeV1, (m) => this.handleStartStorageGridDischarge(m));
33
+ this.registerCommandHandler(enyo_data_bus_value_js_1.EnyoDataBusMessageEnum.StopStorageGridDischargeV1, (m) => this.handleStopStorageGridDischarge(m));
29
34
  this.registerCommandHandler(enyo_data_bus_value_js_1.EnyoDataBusMessageEnum.SetStorageDischargeLimitV1, (m) => this.handleSetStorageDischargeLimit(m));
35
+ this.registerCommandHandler(enyo_data_bus_value_js_1.EnyoDataBusMessageEnum.SetStorageChargeLimitV1, (m) => this.handleSetStorageChargeLimit(m));
30
36
  }
31
37
  /**
32
38
  * Publishes a `BatteryValuesUpdateV1` message with the battery's current
@@ -1,14 +1,17 @@
1
1
  import { IntegrationEnergyApp } from "./integration-energy-app.cjs";
2
2
  import { IntegrationCommandResponse, IntegrationEnergyAppOptions } from "./integration-types.cjs";
3
3
  import { EnyoApplianceTypeEnum } from "../types/enyo-appliance.cjs";
4
- import { EnyoDataBusBatteryValuesUpdateV1, EnyoDataBusGridOperatorPowerLimitationV1, EnyoDataBusSetStorageDischargeLimitV1, EnyoDataBusStartStorageGridChargeV1, EnyoDataBusStopStorageGridChargeV1 } from "../types/enyo-data-bus-value.cjs";
4
+ import { EnyoDataBusBatteryValuesUpdateV1, EnyoDataBusGridOperatorPowerLimitationV1, EnyoDataBusSetStorageChargeLimitV1, EnyoDataBusSetStorageDischargeLimitV1, EnyoDataBusStartStorageGridChargeV1, EnyoDataBusStartStorageGridDischargeV1, EnyoDataBusStopStorageGridChargeV1, EnyoDataBusStopStorageGridDischargeV1 } from "../types/enyo-data-bus-value.cjs";
5
5
  /**
6
6
  * Abstract base class for battery / storage integrations.
7
7
  *
8
8
  * Subscribes to:
9
9
  * - `StartStorageGridChargeV1` — start charging the battery from the grid.
10
10
  * - `StopStorageGridChargeV1` — stop grid charging.
11
+ * - `StartStorageGridDischargeV1` — start discharging the battery into the grid.
12
+ * - `StopStorageGridDischargeV1` — stop grid discharging.
11
13
  * - `SetStorageDischargeLimitV1` — set the maximum discharge power.
14
+ * - `SetStorageChargeLimitV1` — set the maximum charge power.
12
15
  * - `GridOperatorPowerLimitationV1` — §14a EnWG broadcast (handled in base).
13
16
  */
14
17
  export declare abstract class StorageIntegrationEnergyApp extends IntegrationEnergyApp {
@@ -27,11 +30,25 @@ export declare abstract class StorageIntegrationEnergyApp extends IntegrationEne
27
30
  * Handles a `StopStorageGridChargeV1` command — end an active grid charge.
28
31
  */
29
32
  protected abstract handleStopStorageGridCharge(message: EnyoDataBusStopStorageGridChargeV1): Promise<IntegrationCommandResponse>;
33
+ /**
34
+ * Handles a `StartStorageGridDischargeV1` command — start discharging the
35
+ * battery into the grid up to `data.powerLimitW`.
36
+ */
37
+ protected abstract handleStartStorageGridDischarge(message: EnyoDataBusStartStorageGridDischargeV1): Promise<IntegrationCommandResponse>;
38
+ /**
39
+ * Handles a `StopStorageGridDischargeV1` command — end an active grid discharge.
40
+ */
41
+ protected abstract handleStopStorageGridDischarge(message: EnyoDataBusStopStorageGridDischargeV1): Promise<IntegrationCommandResponse>;
30
42
  /**
31
43
  * Handles a `SetStorageDischargeLimitV1` command — set the maximum
32
44
  * discharge power in watts.
33
45
  */
34
46
  protected abstract handleSetStorageDischargeLimit(message: EnyoDataBusSetStorageDischargeLimitV1): Promise<IntegrationCommandResponse>;
47
+ /**
48
+ * Handles a `SetStorageChargeLimitV1` command — set the maximum
49
+ * charge power in watts.
50
+ */
51
+ protected abstract handleSetStorageChargeLimit(message: EnyoDataBusSetStorageChargeLimitV1): Promise<IntegrationCommandResponse>;
35
52
  /**
36
53
  * @inheritDoc
37
54
  */
@@ -1,50 +1,74 @@
1
- import { EnyoNotification, EnyoNotificationOptions, EnyoNotificationTranslation, EnyoNotificationType } from "../types/enyo-notification.cjs";
1
+ import { EnyoNotificationCategory, EnyoNotificationCategoryRegistration, EnyoNotificationOptions, EnyoNotificationTranslation } from "../types/enyo-notification.cjs";
2
2
  /**
3
3
  * Interface for managing user notifications within Energy App packages.
4
- * Provides methods to show, retrieve, and manage notifications with multi-language support.
4
+ *
5
+ * Notifications are grouped by {@link EnyoNotificationCategory}. Every
6
+ * category that a package intends to use must first be registered with the
7
+ * host via {@link registerNotificationCategory}; attempts to send a
8
+ * notification for an unregistered category fail with a `not-registered`
9
+ * error.
10
+ *
11
+ * The host may additionally enforce rate limits per category. When the limit
12
+ * is exceeded, {@link sendNotification} fails with a `rate-limit` error and
13
+ * the caller must back off before retrying.
5
14
  */
6
15
  export interface EnergyAppNotification {
7
16
  /**
8
- * Shows a notification to the user with multi-language support.
9
- * The notification will be displayed according to the specified type and options.
17
+ * Registers a notification category with the host.
18
+ *
19
+ * Categories must be registered before any notification using that
20
+ * category can be sent. Registration is idempotent: calling it again for
21
+ * the same category updates the translated `name` and `description` used
22
+ * by the host UI.
10
23
  *
11
- * @param type - The type of notification (info, warning, error, success) determining visual style
12
- * @param options - Configuration options including permanence, expiration, priority, and appliance association
13
- * @param translations - Array of translated notification messages for different supported languages
14
- * @returns Unique notification ID that can be used for tracking and removal
24
+ * @param registration - Category identifier together with the translated
25
+ * `name` (and optional `description`) shown by the host.
15
26
  *
16
27
  * @example
17
28
  * ```typescript
18
- * const notificationId = showNotification('warning',
19
- * { permanent: true, priority: 'high' },
20
- * [
21
- * { language: 'en', notification: 'Battery level is low' },
22
- * { language: 'de', notification: 'Batteriestand ist niedrig' }
29
+ * registerNotificationCategory({
30
+ * category: 'connection-issue',
31
+ * name: [
32
+ * { language: 'en', name: 'Connection issue' },
33
+ * { language: 'de', name: 'Verbindungsproblem' }
23
34
  * ]
24
- * );
35
+ * });
25
36
  * ```
26
37
  */
27
- showNotification(type: EnyoNotificationType, options: EnyoNotificationOptions, translations: EnyoNotificationTranslation[]): string;
38
+ registerNotificationCategory(registration: EnyoNotificationCategoryRegistration): void;
28
39
  /**
29
- * Retrieves all currently active notifications.
30
- * Returns notifications in chronological order (newest first) unless sorted by priority.
40
+ * Shows a notification to the user with multi-language support.
31
41
  *
32
- * @param applianceId - Optional appliance ID to filter notifications for a specific appliance
33
- * @returns Array of all current notifications with complete metadata
34
- */
35
- getNotifications(applianceId?: string): EnyoNotification[];
36
- /**
37
- * Removes a specific notification from the active notification list.
38
- * If the notification doesn't exist, this method completes silently.
42
+ * The notification's `category` must have been registered first via
43
+ * {@link registerNotificationCategory}. Each translation supplies both a
44
+ * `title` (used for list rows and system banners) and a `body` (used in
45
+ * the expanded detail view). When `options.target` is provided, the host
46
+ * routes the user to that destination on interaction — e.g. an onboarding
47
+ * guide for the `onboarding-required` category.
39
48
  *
40
- * @param notificationId - The unique ID of the notification to remove
41
- */
42
- removeNotification(notificationId: string): void;
43
- /**
44
- * Removes all active notifications.
45
- * This is a convenience method for clearing the entire notification queue.
49
+ * @param type - Visual style of the notification (info, warning, error, success).
50
+ * @param category - Lifecycle category; must be registered beforehand.
51
+ * @param options - Display/behavior options, including optional routing target.
52
+ * @param translations - Per-language `title`/`body` pairs.
53
+ * @returns Unique notification ID that can be used for tracking and removal.
54
+ * @throws {EnyoNotificationSendError} `not-registered` if the supplied
55
+ * category has not been registered with the host.
56
+ * @throws {EnyoNotificationSendError} `rate-limit` if the host's
57
+ * notification rate limit for this category has been exceeded.
46
58
  *
47
- * @param applianceId - Optional appliance ID to clear only notifications for a specific appliance
59
+ * @example
60
+ * ```typescript
61
+ * const notificationId = sendNotification(
62
+ * 'onboarding-required',
63
+ * {
64
+ * target: { type: 'onboarding', onboardingName: 'wallbox-setup' }
65
+ * },
66
+ * [
67
+ * { language: 'en', title: 'Finish setup', body: 'Complete wallbox onboarding to start charging.' },
68
+ * { language: 'de', title: 'Einrichtung abschließen', body: 'Schließe das Wallbox-Onboarding ab, um zu laden.' }
69
+ * ]
70
+ * );
71
+ * ```
48
72
  */
49
- clearAllNotifications(applianceId?: string): void;
73
+ sendNotification(category: EnyoNotificationCategory, options: EnyoNotificationOptions, translations: EnyoNotificationTranslation[]): string;
50
74
  }
@@ -60,7 +60,7 @@ var EnyoApplianceTopologyFeatureEnum;
60
60
  /** If the meter is an Intermediate Meter (like the meter of an Inverter) directly behind the Primary Meter */
61
61
  EnyoApplianceTopologyFeatureEnum["IntermediateOfPrimaryMeter"] = "IntermediateOfPrimaryMeter";
62
62
  /** If the meter is an Intermediate Meter for a single appliance */
63
- EnyoApplianceTopologyFeatureEnum["IntermediateMeter"] = "PrimaryMeter";
63
+ EnyoApplianceTopologyFeatureEnum["IntermediateMeter"] = "IntermediateMeter";
64
64
  /** If the inverter does a direct grid feed in without self consumption */
65
65
  EnyoApplianceTopologyFeatureEnum["InverterFullGridFeedIn"] = "InverterFullGridFeedIn";
66
66
  })(EnyoApplianceTopologyFeatureEnum || (exports.EnyoApplianceTopologyFeatureEnum = EnyoApplianceTopologyFeatureEnum = {}));
@@ -136,7 +136,7 @@ export declare enum EnyoApplianceTopologyFeatureEnum {
136
136
  /** If the meter is an Intermediate Meter (like the meter of an Inverter) directly behind the Primary Meter */
137
137
  IntermediateOfPrimaryMeter = "IntermediateOfPrimaryMeter",
138
138
  /** If the meter is an Intermediate Meter for a single appliance */
139
- IntermediateMeter = "PrimaryMeter",
139
+ IntermediateMeter = "IntermediateMeter",
140
140
  /** If the inverter does a direct grid feed in without self consumption */
141
141
  InverterFullGridFeedIn = "InverterFullGridFeedIn"
142
142
  }
@@ -144,6 +144,8 @@ export interface EnyoApplianceTopology {
144
144
  features: EnyoApplianceTopologyFeatureEnum[];
145
145
  /** Information, behind which meter this appliance is located, for example if the wallbox is behind the primary meter or a submeter. Put the appliance ID of the meter */
146
146
  behindMeterApplianceId?: string;
147
+ /** Information, in front of which appliance this appliance is located (i.e. upstream on the electrical path). Put the appliance ID of the downstream appliance. */
148
+ inFrontOfApplianceId?: string;
147
149
  }
148
150
  /**
149
151
  * Represents an appliance managed by the enyo system.
@@ -11,9 +11,14 @@ var EnyoBatteryStorageMode;
11
11
  })(EnyoBatteryStorageMode || (exports.EnyoBatteryStorageMode = EnyoBatteryStorageMode = {}));
12
12
  var EnyoBatteryFeature;
13
13
  (function (EnyoBatteryFeature) {
14
+ /** If the battery supports being charged from the grid */
14
15
  EnyoBatteryFeature["GridCharging"] = "grid-charging";
16
+ /** If the battery supports discharging into the grid */
17
+ EnyoBatteryFeature["GridDischarging"] = "grid-discharging";
15
18
  /** If the battery supports discharge power limitation */
16
19
  EnyoBatteryFeature["DischargeLimitation"] = "discharge-limitation";
20
+ /** If the battery supports charge power limitation */
21
+ EnyoBatteryFeature["ChargeLimitation"] = "charge-limitation";
17
22
  /** If the battery is connected between DC strings and the inverter */
18
23
  EnyoBatteryFeature["BetweenDcStringAndInverter"] = "between-dc-string-and-inverter";
19
24
  })(EnyoBatteryFeature || (exports.EnyoBatteryFeature = EnyoBatteryFeature = {}));
@@ -6,9 +6,14 @@ export declare enum EnyoBatteryStorageMode {
6
6
  Unknown = "unknown"
7
7
  }
8
8
  export declare enum EnyoBatteryFeature {
9
+ /** If the battery supports being charged from the grid */
9
10
  GridCharging = "grid-charging",
11
+ /** If the battery supports discharging into the grid */
12
+ GridDischarging = "grid-discharging",
10
13
  /** If the battery supports discharge power limitation */
11
14
  DischargeLimitation = "discharge-limitation",
15
+ /** If the battery supports charge power limitation */
16
+ ChargeLimitation = "charge-limitation",
12
17
  /** If the battery is connected between DC strings and the inverter */
13
18
  BetweenDcStringAndInverter = "between-dc-string-and-inverter"
14
19
  }
@@ -139,7 +139,10 @@ var EnyoDataBusMessageEnum;
139
139
  EnyoDataBusMessageEnum["HeatpumpDhwTemperatureForecastV1"] = "HeatpumpDhwTemperatureForecastV1";
140
140
  EnyoDataBusMessageEnum["StartStorageGridChargeV1"] = "StartStorageGridChargeV1";
141
141
  EnyoDataBusMessageEnum["StopStorageGridChargeV1"] = "StopStorageGridChargeV1";
142
+ EnyoDataBusMessageEnum["StartStorageGridDischargeV1"] = "StartStorageGridDischargeV1";
143
+ EnyoDataBusMessageEnum["StopStorageGridDischargeV1"] = "StopStorageGridDischargeV1";
142
144
  EnyoDataBusMessageEnum["SetStorageDischargeLimitV1"] = "SetStorageDischargeLimitV1";
145
+ EnyoDataBusMessageEnum["SetStorageChargeLimitV1"] = "SetStorageChargeLimitV1";
143
146
  EnyoDataBusMessageEnum["SetInverterFeedInLimitV1"] = "SetInverterFeedInLimitV1";
144
147
  EnyoDataBusMessageEnum["CommandAcknowledgeV1"] = "CommandAcknowledgeV1";
145
148
  EnyoDataBusMessageEnum["TemperatureSensorValuesUpdateV1"] = "TemperatureSensorValuesUpdateV1";
@@ -179,7 +179,10 @@ export declare enum EnyoDataBusMessageEnum {
179
179
  HeatpumpDhwTemperatureForecastV1 = "HeatpumpDhwTemperatureForecastV1",
180
180
  StartStorageGridChargeV1 = "StartStorageGridChargeV1",
181
181
  StopStorageGridChargeV1 = "StopStorageGridChargeV1",
182
+ StartStorageGridDischargeV1 = "StartStorageGridDischargeV1",
183
+ StopStorageGridDischargeV1 = "StopStorageGridDischargeV1",
182
184
  SetStorageDischargeLimitV1 = "SetStorageDischargeLimitV1",
185
+ SetStorageChargeLimitV1 = "SetStorageChargeLimitV1",
183
186
  SetInverterFeedInLimitV1 = "SetInverterFeedInLimitV1",
184
187
  CommandAcknowledgeV1 = "CommandAcknowledgeV1",
185
188
  TemperatureSensorValuesUpdateV1 = "TemperatureSensorValuesUpdateV1",
@@ -921,6 +924,36 @@ export interface EnyoDataBusStopStorageGridChargeV1 extends EnyoDataBusMessage {
921
924
  reason?: EnyoDataBusCommandReason;
922
925
  };
923
926
  }
927
+ /**
928
+ * Command message to start discharging a storage/battery into the grid.
929
+ * Instructs the battery system to begin feeding power into the grid up to the specified limit.
930
+ */
931
+ export interface EnyoDataBusStartStorageGridDischargeV1 extends EnyoDataBusMessage {
932
+ type: 'message';
933
+ message: EnyoDataBusMessageEnum.StartStorageGridDischargeV1;
934
+ /** ID of the battery/storage appliance to discharge */
935
+ applianceId: string;
936
+ data: {
937
+ /** Maximum power in watts for storage-to-grid discharging */
938
+ powerLimitW: number;
939
+ /** Optional reason why this command was issued */
940
+ reason?: EnyoDataBusCommandReason;
941
+ };
942
+ }
943
+ /**
944
+ * Command message to stop discharging a storage/battery into the grid.
945
+ * Instructs the battery system to end storage-to-grid discharging.
946
+ */
947
+ export interface EnyoDataBusStopStorageGridDischargeV1 extends EnyoDataBusMessage {
948
+ type: 'message';
949
+ message: EnyoDataBusMessageEnum.StopStorageGridDischargeV1;
950
+ /** ID of the battery/storage appliance to stop discharging */
951
+ applianceId: string;
952
+ data: {
953
+ /** Optional reason why this command was issued */
954
+ reason?: EnyoDataBusCommandReason;
955
+ };
956
+ }
924
957
  /**
925
958
  * Command message to limit the discharge rate of a storage/battery.
926
959
  * Sets the maximum discharge power as a percentage of the battery's maximum discharge capacity.
@@ -937,6 +970,22 @@ export interface EnyoDataBusSetStorageDischargeLimitV1 extends EnyoDataBusMessag
937
970
  reason?: EnyoDataBusCommandReason;
938
971
  };
939
972
  }
973
+ /**
974
+ * Command message to limit the charge rate of a storage/battery.
975
+ * Sets the maximum charge power in watts that the battery is allowed to draw while charging.
976
+ */
977
+ export interface EnyoDataBusSetStorageChargeLimitV1 extends EnyoDataBusMessage {
978
+ type: 'message';
979
+ message: EnyoDataBusMessageEnum.SetStorageChargeLimitV1;
980
+ /** ID of the battery/storage appliance to limit */
981
+ applianceId: string;
982
+ data: {
983
+ /** Charge limit in W to limit the battery's charge power */
984
+ chargeLimitW: number;
985
+ /** Optional reason why this command was issued */
986
+ reason?: EnyoDataBusCommandReason;
987
+ };
988
+ }
940
989
  /**
941
990
  * Command message to set or reset the inverter's grid feed-in power limit.
942
991
  * When a limit is set, the inverter will not feed more than the specified power into the grid.
@@ -17,6 +17,8 @@ var EnyoHeatpumpApplianceAvailableFeaturesEnum;
17
17
  EnyoHeatpumpApplianceAvailableFeaturesEnum["AvailablePowerAnnouncement"] = "AvailablePowerAnnouncement";
18
18
  /** If the heatpump reports power values (e.g. electrical power consumption in watts) */
19
19
  EnyoHeatpumpApplianceAvailableFeaturesEnum["Power"] = "Power";
20
+ /** If the heatpump is ready for calibration (i.e. has all prerequisites in place to start a calibration run) */
21
+ EnyoHeatpumpApplianceAvailableFeaturesEnum["ReadyForCalibration"] = "ReadyForCalibration";
20
22
  })(EnyoHeatpumpApplianceAvailableFeaturesEnum || (exports.EnyoHeatpumpApplianceAvailableFeaturesEnum = EnyoHeatpumpApplianceAvailableFeaturesEnum = {}));
21
23
  var EnyoHeatpumpApplianceModeEnum;
22
24
  (function (EnyoHeatpumpApplianceModeEnum) {
@@ -12,7 +12,9 @@ export declare enum EnyoHeatpumpApplianceAvailableFeaturesEnum {
12
12
  /** If the heatpump supports available power announcements */
13
13
  AvailablePowerAnnouncement = "AvailablePowerAnnouncement",
14
14
  /** If the heatpump reports power values (e.g. electrical power consumption in watts) */
15
- Power = "Power"
15
+ Power = "Power",
16
+ /** If the heatpump is ready for calibration (i.e. has all prerequisites in place to start a calibration run) */
17
+ ReadyForCalibration = "ReadyForCalibration"
16
18
  }
17
19
  export declare enum EnyoHeatpumpApplianceModeEnum {
18
20
  Idle = "Idle",
@@ -1,48 +1,143 @@
1
1
  import { EnergyAppPackageLanguage } from "../energy-app-package-definition.cjs";
2
2
  /**
3
- * Types of notifications that can be displayed to users
3
+ * Lifecycle category of a notification.
4
+ *
5
+ * Categories must be registered with the host (via
6
+ * {@link EnergyAppNotification.registerNotificationCategory}) before any
7
+ * notification using that category can be sent. This allows the host to
8
+ * pre-allocate UI surfaces (badges, sections, inbox tabs) and to enforce
9
+ * per-category rate limits.
10
+ *
11
+ * - `connection-issue`: The package has detected a connectivity problem with
12
+ * an appliance, gateway, or upstream service that requires user attention.
13
+ * - `onboarding-required`: The package needs the user to complete (or revisit)
14
+ * an onboarding flow before it can continue operating normally.
4
15
  */
5
- export type EnyoNotificationType = 'info' | 'warning' | 'error' | 'success';
16
+ export type EnyoNotificationCategory = 'connection-issue' | 'onboarding-required';
6
17
  /**
7
- * Priority levels for notifications affecting display order and importance
18
+ * Registration payload describing a notification category to the host.
19
+ *
20
+ * The host uses the translated `name` and optional `description` to render
21
+ * the category in user-facing surfaces (settings screens, inbox filters,
22
+ * etc.) without the package needing to ship per-host UI strings.
8
23
  */
9
- export type EnyoNotificationPriority = 'low' | 'normal' | 'high';
24
+ export interface EnyoNotificationCategoryRegistration {
25
+ /** Category identifier this registration applies to. */
26
+ category: EnyoNotificationCategory;
27
+ /** Translated, human-readable name of the category. */
28
+ name: EnyoNotificationCategoryTranslation[];
29
+ /** Optional translated description shown alongside the category name. */
30
+ description?: EnyoNotificationCategoryTranslation[];
31
+ }
32
+ /**
33
+ * Translated label for a notification category, used during registration.
34
+ */
35
+ export interface EnyoNotificationCategoryTranslation {
36
+ /** Language code for this translation. */
37
+ language: EnergyAppPackageLanguage;
38
+ /** Display name of the category in the given language. */
39
+ name: string;
40
+ /** Optional description of the category in the given language. */
41
+ description?: string;
42
+ }
10
43
  /**
11
- * Configuration options for notification display and behavior
44
+ * Target object describing an in-app destination the user is routed to when
45
+ * they interact with a notification. Discriminated by the `type` field so
46
+ * additional target kinds can be added without breaking existing consumers.
47
+ */
48
+ export type EnyoNotificationTarget = EnyoNotificationOnboardingTarget | EnyoNotificationEnergyAppSettingsTarget | EnyoNotificationApplianceSettingsTarget;
49
+ /**
50
+ * Target that opens an onboarding guide previously registered with the host.
51
+ *
52
+ * Use this for notifications whose category is `onboarding-required` (or any
53
+ * other case where the resolution is "walk the user through onboarding").
54
+ */
55
+ export interface EnyoNotificationOnboardingTarget {
56
+ /** Discriminator identifying this as an onboarding target. */
57
+ type: 'onboarding';
58
+ /**
59
+ * Name of the onboarding guide to open. Must match the `guideName` of a
60
+ * guide previously registered via the onboarding package.
61
+ */
62
+ onboardingName: string;
63
+ }
64
+ /**
65
+ * Target that opens the settings screen for the energy app package itself
66
+ * (package-wide settings registered via the settings package, not scoped to
67
+ * a specific appliance).
68
+ */
69
+ export interface EnyoNotificationEnergyAppSettingsTarget {
70
+ /** Discriminator identifying this as an energy app settings target. */
71
+ type: 'energy-app-settings';
72
+ }
73
+ /**
74
+ * Target that opens the settings screen for a specific appliance managed by
75
+ * the energy app package.
76
+ */
77
+ export interface EnyoNotificationApplianceSettingsTarget {
78
+ /** Discriminator identifying this as an appliance settings target. */
79
+ type: 'appliance-settings';
80
+ /**
81
+ * Identifier of the appliance whose settings should be opened. Must match
82
+ * an appliance id known to the host.
83
+ */
84
+ applianceId: string;
85
+ }
86
+ /**
87
+ * Configuration options for notification display and behavior.
12
88
  */
13
89
  export interface EnyoNotificationOptions {
14
- /** Whether the notification persists until manually dismissed by the user */
15
- permanent?: boolean;
16
- /** Optional expiration time in ISO format for auto-dismissal */
17
- expiresAtIso?: string;
18
- /** Priority level affecting display order and visual emphasis */
19
- priority?: EnyoNotificationPriority;
20
- /** Optional appliance ID if notification is specific to an appliance */
90
+ /** Optional appliance ID if notification is specific to an appliance. */
21
91
  applianceId?: string;
92
+ /**
93
+ * Optional in-app destination the user is routed to when they interact
94
+ * with the notification.
95
+ */
96
+ target?: EnyoNotificationTarget;
22
97
  }
23
98
  /**
24
- * Translated notification content for multi-language support
99
+ * Translated notification content for multi-language support.
100
+ *
101
+ * Each translation provides both a short `title` (shown in lists, headers
102
+ * and system notifications) and a longer `body` (shown in the expanded
103
+ * detail view).
25
104
  */
26
105
  export interface EnyoNotificationTranslation {
27
- /** Language code for this translation */
106
+ /** Language code for this translation. */
28
107
  language: EnergyAppPackageLanguage;
29
- /** Notification message content in the specified language */
30
- notification: string;
108
+ /** Short headline shown in notification lists and system banners. */
109
+ title: string;
110
+ /** Longer message body shown when the notification is expanded. */
111
+ body: string;
112
+ }
113
+ /**
114
+ * Error reasons returned by {@link EnergyAppNotification.sendNotification}
115
+ * when a notification cannot be delivered.
116
+ *
117
+ * - `not-registered`: The supplied category has not been registered with the
118
+ * host via {@link EnergyAppNotification.registerNotificationCategory}.
119
+ * - `rate-limit`: The package has exceeded the host's notification rate
120
+ * limit for the supplied category and must back off before retrying.
121
+ */
122
+ export type EnyoNotificationSendErrorType = 'not-registered' | 'rate-limit';
123
+ /**
124
+ * Error thrown or returned by {@link EnergyAppNotification.sendNotification}
125
+ * when a notification cannot be delivered.
126
+ */
127
+ export interface EnyoNotificationSendError {
128
+ /** Machine-readable error reason. */
129
+ type: EnyoNotificationSendErrorType;
130
+ /** Optional human-readable detail describing the error. */
131
+ message?: string;
31
132
  }
32
133
  /**
33
- * Complete notification object containing all notification data
134
+ * Complete notification object containing all notification data.
34
135
  */
35
136
  export interface EnyoNotification {
36
- /** Unique identifier for this notification */
37
- id: string;
38
- /** Type of notification determining visual style and urgency */
39
- type: EnyoNotificationType;
40
- /** Configuration options for display and behavior */
137
+ /** Category of the notification; must be registered before sending. */
138
+ category: EnyoNotificationCategory;
139
+ /** Configuration options for display and behavior. */
41
140
  options: EnyoNotificationOptions;
42
- /** Array of translated notification messages for different languages */
141
+ /** Array of translated notification messages for different languages. */
43
142
  translations: EnyoNotificationTranslation[];
44
- /** ISO timestamp when the notification was created */
45
- createdAtIso: string;
46
- /** Optional ISO timestamp when the notification was last updated */
47
- updatedAtIso?: string;
48
143
  }
@@ -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.128';
12
+ exports.SDK_VERSION = '0.0.130';
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.128";
8
+ export declare const SDK_VERSION = "0.0.130";
9
9
  /**
10
10
  * Gets the current SDK version.
11
11
  * @returns The semantic version string of the SDK
@@ -1,14 +1,17 @@
1
1
  import { IntegrationEnergyApp } from "./integration-energy-app.js";
2
2
  import { IntegrationCommandResponse, IntegrationEnergyAppOptions } from "./integration-types.js";
3
3
  import { EnyoApplianceTypeEnum } from "../types/enyo-appliance.js";
4
- import { EnyoDataBusBatteryValuesUpdateV1, EnyoDataBusGridOperatorPowerLimitationV1, EnyoDataBusSetStorageDischargeLimitV1, EnyoDataBusStartStorageGridChargeV1, EnyoDataBusStopStorageGridChargeV1 } from "../types/enyo-data-bus-value.js";
4
+ import { EnyoDataBusBatteryValuesUpdateV1, EnyoDataBusGridOperatorPowerLimitationV1, EnyoDataBusSetStorageChargeLimitV1, EnyoDataBusSetStorageDischargeLimitV1, EnyoDataBusStartStorageGridChargeV1, EnyoDataBusStartStorageGridDischargeV1, EnyoDataBusStopStorageGridChargeV1, EnyoDataBusStopStorageGridDischargeV1 } from "../types/enyo-data-bus-value.js";
5
5
  /**
6
6
  * Abstract base class for battery / storage integrations.
7
7
  *
8
8
  * Subscribes to:
9
9
  * - `StartStorageGridChargeV1` — start charging the battery from the grid.
10
10
  * - `StopStorageGridChargeV1` — stop grid charging.
11
+ * - `StartStorageGridDischargeV1` — start discharging the battery into the grid.
12
+ * - `StopStorageGridDischargeV1` — stop grid discharging.
11
13
  * - `SetStorageDischargeLimitV1` — set the maximum discharge power.
14
+ * - `SetStorageChargeLimitV1` — set the maximum charge power.
12
15
  * - `GridOperatorPowerLimitationV1` — §14a EnWG broadcast (handled in base).
13
16
  */
14
17
  export declare abstract class StorageIntegrationEnergyApp extends IntegrationEnergyApp {
@@ -27,11 +30,25 @@ export declare abstract class StorageIntegrationEnergyApp extends IntegrationEne
27
30
  * Handles a `StopStorageGridChargeV1` command — end an active grid charge.
28
31
  */
29
32
  protected abstract handleStopStorageGridCharge(message: EnyoDataBusStopStorageGridChargeV1): Promise<IntegrationCommandResponse>;
33
+ /**
34
+ * Handles a `StartStorageGridDischargeV1` command — start discharging the
35
+ * battery into the grid up to `data.powerLimitW`.
36
+ */
37
+ protected abstract handleStartStorageGridDischarge(message: EnyoDataBusStartStorageGridDischargeV1): Promise<IntegrationCommandResponse>;
38
+ /**
39
+ * Handles a `StopStorageGridDischargeV1` command — end an active grid discharge.
40
+ */
41
+ protected abstract handleStopStorageGridDischarge(message: EnyoDataBusStopStorageGridDischargeV1): Promise<IntegrationCommandResponse>;
30
42
  /**
31
43
  * Handles a `SetStorageDischargeLimitV1` command — set the maximum
32
44
  * discharge power in watts.
33
45
  */
34
46
  protected abstract handleSetStorageDischargeLimit(message: EnyoDataBusSetStorageDischargeLimitV1): Promise<IntegrationCommandResponse>;
47
+ /**
48
+ * Handles a `SetStorageChargeLimitV1` command — set the maximum
49
+ * charge power in watts.
50
+ */
51
+ protected abstract handleSetStorageChargeLimit(message: EnyoDataBusSetStorageChargeLimitV1): Promise<IntegrationCommandResponse>;
35
52
  /**
36
53
  * @inheritDoc
37
54
  */
@@ -7,7 +7,10 @@ import { EnyoDataBusMessageEnum } from "../types/enyo-data-bus-value.js";
7
7
  * Subscribes to:
8
8
  * - `StartStorageGridChargeV1` — start charging the battery from the grid.
9
9
  * - `StopStorageGridChargeV1` — stop grid charging.
10
+ * - `StartStorageGridDischargeV1` — start discharging the battery into the grid.
11
+ * - `StopStorageGridDischargeV1` — stop grid discharging.
10
12
  * - `SetStorageDischargeLimitV1` — set the maximum discharge power.
13
+ * - `SetStorageChargeLimitV1` — set the maximum charge power.
11
14
  * - `GridOperatorPowerLimitationV1` — §14a EnWG broadcast (handled in base).
12
15
  */
13
16
  export class StorageIntegrationEnergyApp extends IntegrationEnergyApp {
@@ -23,7 +26,10 @@ export class StorageIntegrationEnergyApp extends IntegrationEnergyApp {
23
26
  registerHandlers() {
24
27
  this.registerCommandHandler(EnyoDataBusMessageEnum.StartStorageGridChargeV1, (m) => this.handleStartStorageGridCharge(m));
25
28
  this.registerCommandHandler(EnyoDataBusMessageEnum.StopStorageGridChargeV1, (m) => this.handleStopStorageGridCharge(m));
29
+ this.registerCommandHandler(EnyoDataBusMessageEnum.StartStorageGridDischargeV1, (m) => this.handleStartStorageGridDischarge(m));
30
+ this.registerCommandHandler(EnyoDataBusMessageEnum.StopStorageGridDischargeV1, (m) => this.handleStopStorageGridDischarge(m));
26
31
  this.registerCommandHandler(EnyoDataBusMessageEnum.SetStorageDischargeLimitV1, (m) => this.handleSetStorageDischargeLimit(m));
32
+ this.registerCommandHandler(EnyoDataBusMessageEnum.SetStorageChargeLimitV1, (m) => this.handleSetStorageChargeLimit(m));
27
33
  }
28
34
  /**
29
35
  * Publishes a `BatteryValuesUpdateV1` message with the battery's current
@@ -1,50 +1,74 @@
1
- import { EnyoNotification, EnyoNotificationOptions, EnyoNotificationTranslation, EnyoNotificationType } from "../types/enyo-notification.js";
1
+ import { EnyoNotificationCategory, EnyoNotificationCategoryRegistration, EnyoNotificationOptions, EnyoNotificationTranslation } from "../types/enyo-notification.js";
2
2
  /**
3
3
  * Interface for managing user notifications within Energy App packages.
4
- * Provides methods to show, retrieve, and manage notifications with multi-language support.
4
+ *
5
+ * Notifications are grouped by {@link EnyoNotificationCategory}. Every
6
+ * category that a package intends to use must first be registered with the
7
+ * host via {@link registerNotificationCategory}; attempts to send a
8
+ * notification for an unregistered category fail with a `not-registered`
9
+ * error.
10
+ *
11
+ * The host may additionally enforce rate limits per category. When the limit
12
+ * is exceeded, {@link sendNotification} fails with a `rate-limit` error and
13
+ * the caller must back off before retrying.
5
14
  */
6
15
  export interface EnergyAppNotification {
7
16
  /**
8
- * Shows a notification to the user with multi-language support.
9
- * The notification will be displayed according to the specified type and options.
17
+ * Registers a notification category with the host.
18
+ *
19
+ * Categories must be registered before any notification using that
20
+ * category can be sent. Registration is idempotent: calling it again for
21
+ * the same category updates the translated `name` and `description` used
22
+ * by the host UI.
10
23
  *
11
- * @param type - The type of notification (info, warning, error, success) determining visual style
12
- * @param options - Configuration options including permanence, expiration, priority, and appliance association
13
- * @param translations - Array of translated notification messages for different supported languages
14
- * @returns Unique notification ID that can be used for tracking and removal
24
+ * @param registration - Category identifier together with the translated
25
+ * `name` (and optional `description`) shown by the host.
15
26
  *
16
27
  * @example
17
28
  * ```typescript
18
- * const notificationId = showNotification('warning',
19
- * { permanent: true, priority: 'high' },
20
- * [
21
- * { language: 'en', notification: 'Battery level is low' },
22
- * { language: 'de', notification: 'Batteriestand ist niedrig' }
29
+ * registerNotificationCategory({
30
+ * category: 'connection-issue',
31
+ * name: [
32
+ * { language: 'en', name: 'Connection issue' },
33
+ * { language: 'de', name: 'Verbindungsproblem' }
23
34
  * ]
24
- * );
35
+ * });
25
36
  * ```
26
37
  */
27
- showNotification(type: EnyoNotificationType, options: EnyoNotificationOptions, translations: EnyoNotificationTranslation[]): string;
38
+ registerNotificationCategory(registration: EnyoNotificationCategoryRegistration): void;
28
39
  /**
29
- * Retrieves all currently active notifications.
30
- * Returns notifications in chronological order (newest first) unless sorted by priority.
40
+ * Shows a notification to the user with multi-language support.
31
41
  *
32
- * @param applianceId - Optional appliance ID to filter notifications for a specific appliance
33
- * @returns Array of all current notifications with complete metadata
34
- */
35
- getNotifications(applianceId?: string): EnyoNotification[];
36
- /**
37
- * Removes a specific notification from the active notification list.
38
- * If the notification doesn't exist, this method completes silently.
42
+ * The notification's `category` must have been registered first via
43
+ * {@link registerNotificationCategory}. Each translation supplies both a
44
+ * `title` (used for list rows and system banners) and a `body` (used in
45
+ * the expanded detail view). When `options.target` is provided, the host
46
+ * routes the user to that destination on interaction — e.g. an onboarding
47
+ * guide for the `onboarding-required` category.
39
48
  *
40
- * @param notificationId - The unique ID of the notification to remove
41
- */
42
- removeNotification(notificationId: string): void;
43
- /**
44
- * Removes all active notifications.
45
- * This is a convenience method for clearing the entire notification queue.
49
+ * @param type - Visual style of the notification (info, warning, error, success).
50
+ * @param category - Lifecycle category; must be registered beforehand.
51
+ * @param options - Display/behavior options, including optional routing target.
52
+ * @param translations - Per-language `title`/`body` pairs.
53
+ * @returns Unique notification ID that can be used for tracking and removal.
54
+ * @throws {EnyoNotificationSendError} `not-registered` if the supplied
55
+ * category has not been registered with the host.
56
+ * @throws {EnyoNotificationSendError} `rate-limit` if the host's
57
+ * notification rate limit for this category has been exceeded.
46
58
  *
47
- * @param applianceId - Optional appliance ID to clear only notifications for a specific appliance
59
+ * @example
60
+ * ```typescript
61
+ * const notificationId = sendNotification(
62
+ * 'onboarding-required',
63
+ * {
64
+ * target: { type: 'onboarding', onboardingName: 'wallbox-setup' }
65
+ * },
66
+ * [
67
+ * { language: 'en', title: 'Finish setup', body: 'Complete wallbox onboarding to start charging.' },
68
+ * { language: 'de', title: 'Einrichtung abschließen', body: 'Schließe das Wallbox-Onboarding ab, um zu laden.' }
69
+ * ]
70
+ * );
71
+ * ```
48
72
  */
49
- clearAllNotifications(applianceId?: string): void;
73
+ sendNotification(category: EnyoNotificationCategory, options: EnyoNotificationOptions, translations: EnyoNotificationTranslation[]): string;
50
74
  }
@@ -136,7 +136,7 @@ export declare enum EnyoApplianceTopologyFeatureEnum {
136
136
  /** If the meter is an Intermediate Meter (like the meter of an Inverter) directly behind the Primary Meter */
137
137
  IntermediateOfPrimaryMeter = "IntermediateOfPrimaryMeter",
138
138
  /** If the meter is an Intermediate Meter for a single appliance */
139
- IntermediateMeter = "PrimaryMeter",
139
+ IntermediateMeter = "IntermediateMeter",
140
140
  /** If the inverter does a direct grid feed in without self consumption */
141
141
  InverterFullGridFeedIn = "InverterFullGridFeedIn"
142
142
  }
@@ -144,6 +144,8 @@ export interface EnyoApplianceTopology {
144
144
  features: EnyoApplianceTopologyFeatureEnum[];
145
145
  /** Information, behind which meter this appliance is located, for example if the wallbox is behind the primary meter or a submeter. Put the appliance ID of the meter */
146
146
  behindMeterApplianceId?: string;
147
+ /** Information, in front of which appliance this appliance is located (i.e. upstream on the electrical path). Put the appliance ID of the downstream appliance. */
148
+ inFrontOfApplianceId?: string;
147
149
  }
148
150
  /**
149
151
  * Represents an appliance managed by the enyo system.
@@ -57,7 +57,7 @@ export var EnyoApplianceTopologyFeatureEnum;
57
57
  /** If the meter is an Intermediate Meter (like the meter of an Inverter) directly behind the Primary Meter */
58
58
  EnyoApplianceTopologyFeatureEnum["IntermediateOfPrimaryMeter"] = "IntermediateOfPrimaryMeter";
59
59
  /** If the meter is an Intermediate Meter for a single appliance */
60
- EnyoApplianceTopologyFeatureEnum["IntermediateMeter"] = "PrimaryMeter";
60
+ EnyoApplianceTopologyFeatureEnum["IntermediateMeter"] = "IntermediateMeter";
61
61
  /** If the inverter does a direct grid feed in without self consumption */
62
62
  EnyoApplianceTopologyFeatureEnum["InverterFullGridFeedIn"] = "InverterFullGridFeedIn";
63
63
  })(EnyoApplianceTopologyFeatureEnum || (EnyoApplianceTopologyFeatureEnum = {}));
@@ -6,9 +6,14 @@ export declare enum EnyoBatteryStorageMode {
6
6
  Unknown = "unknown"
7
7
  }
8
8
  export declare enum EnyoBatteryFeature {
9
+ /** If the battery supports being charged from the grid */
9
10
  GridCharging = "grid-charging",
11
+ /** If the battery supports discharging into the grid */
12
+ GridDischarging = "grid-discharging",
10
13
  /** If the battery supports discharge power limitation */
11
14
  DischargeLimitation = "discharge-limitation",
15
+ /** If the battery supports charge power limitation */
16
+ ChargeLimitation = "charge-limitation",
12
17
  /** If the battery is connected between DC strings and the inverter */
13
18
  BetweenDcStringAndInverter = "between-dc-string-and-inverter"
14
19
  }
@@ -8,9 +8,14 @@ export var EnyoBatteryStorageMode;
8
8
  })(EnyoBatteryStorageMode || (EnyoBatteryStorageMode = {}));
9
9
  export var EnyoBatteryFeature;
10
10
  (function (EnyoBatteryFeature) {
11
+ /** If the battery supports being charged from the grid */
11
12
  EnyoBatteryFeature["GridCharging"] = "grid-charging";
13
+ /** If the battery supports discharging into the grid */
14
+ EnyoBatteryFeature["GridDischarging"] = "grid-discharging";
12
15
  /** If the battery supports discharge power limitation */
13
16
  EnyoBatteryFeature["DischargeLimitation"] = "discharge-limitation";
17
+ /** If the battery supports charge power limitation */
18
+ EnyoBatteryFeature["ChargeLimitation"] = "charge-limitation";
14
19
  /** If the battery is connected between DC strings and the inverter */
15
20
  EnyoBatteryFeature["BetweenDcStringAndInverter"] = "between-dc-string-and-inverter";
16
21
  })(EnyoBatteryFeature || (EnyoBatteryFeature = {}));
@@ -179,7 +179,10 @@ export declare enum EnyoDataBusMessageEnum {
179
179
  HeatpumpDhwTemperatureForecastV1 = "HeatpumpDhwTemperatureForecastV1",
180
180
  StartStorageGridChargeV1 = "StartStorageGridChargeV1",
181
181
  StopStorageGridChargeV1 = "StopStorageGridChargeV1",
182
+ StartStorageGridDischargeV1 = "StartStorageGridDischargeV1",
183
+ StopStorageGridDischargeV1 = "StopStorageGridDischargeV1",
182
184
  SetStorageDischargeLimitV1 = "SetStorageDischargeLimitV1",
185
+ SetStorageChargeLimitV1 = "SetStorageChargeLimitV1",
183
186
  SetInverterFeedInLimitV1 = "SetInverterFeedInLimitV1",
184
187
  CommandAcknowledgeV1 = "CommandAcknowledgeV1",
185
188
  TemperatureSensorValuesUpdateV1 = "TemperatureSensorValuesUpdateV1",
@@ -921,6 +924,36 @@ export interface EnyoDataBusStopStorageGridChargeV1 extends EnyoDataBusMessage {
921
924
  reason?: EnyoDataBusCommandReason;
922
925
  };
923
926
  }
927
+ /**
928
+ * Command message to start discharging a storage/battery into the grid.
929
+ * Instructs the battery system to begin feeding power into the grid up to the specified limit.
930
+ */
931
+ export interface EnyoDataBusStartStorageGridDischargeV1 extends EnyoDataBusMessage {
932
+ type: 'message';
933
+ message: EnyoDataBusMessageEnum.StartStorageGridDischargeV1;
934
+ /** ID of the battery/storage appliance to discharge */
935
+ applianceId: string;
936
+ data: {
937
+ /** Maximum power in watts for storage-to-grid discharging */
938
+ powerLimitW: number;
939
+ /** Optional reason why this command was issued */
940
+ reason?: EnyoDataBusCommandReason;
941
+ };
942
+ }
943
+ /**
944
+ * Command message to stop discharging a storage/battery into the grid.
945
+ * Instructs the battery system to end storage-to-grid discharging.
946
+ */
947
+ export interface EnyoDataBusStopStorageGridDischargeV1 extends EnyoDataBusMessage {
948
+ type: 'message';
949
+ message: EnyoDataBusMessageEnum.StopStorageGridDischargeV1;
950
+ /** ID of the battery/storage appliance to stop discharging */
951
+ applianceId: string;
952
+ data: {
953
+ /** Optional reason why this command was issued */
954
+ reason?: EnyoDataBusCommandReason;
955
+ };
956
+ }
924
957
  /**
925
958
  * Command message to limit the discharge rate of a storage/battery.
926
959
  * Sets the maximum discharge power as a percentage of the battery's maximum discharge capacity.
@@ -937,6 +970,22 @@ export interface EnyoDataBusSetStorageDischargeLimitV1 extends EnyoDataBusMessag
937
970
  reason?: EnyoDataBusCommandReason;
938
971
  };
939
972
  }
973
+ /**
974
+ * Command message to limit the charge rate of a storage/battery.
975
+ * Sets the maximum charge power in watts that the battery is allowed to draw while charging.
976
+ */
977
+ export interface EnyoDataBusSetStorageChargeLimitV1 extends EnyoDataBusMessage {
978
+ type: 'message';
979
+ message: EnyoDataBusMessageEnum.SetStorageChargeLimitV1;
980
+ /** ID of the battery/storage appliance to limit */
981
+ applianceId: string;
982
+ data: {
983
+ /** Charge limit in W to limit the battery's charge power */
984
+ chargeLimitW: number;
985
+ /** Optional reason why this command was issued */
986
+ reason?: EnyoDataBusCommandReason;
987
+ };
988
+ }
940
989
  /**
941
990
  * Command message to set or reset the inverter's grid feed-in power limit.
942
991
  * When a limit is set, the inverter will not feed more than the specified power into the grid.
@@ -136,7 +136,10 @@ export var EnyoDataBusMessageEnum;
136
136
  EnyoDataBusMessageEnum["HeatpumpDhwTemperatureForecastV1"] = "HeatpumpDhwTemperatureForecastV1";
137
137
  EnyoDataBusMessageEnum["StartStorageGridChargeV1"] = "StartStorageGridChargeV1";
138
138
  EnyoDataBusMessageEnum["StopStorageGridChargeV1"] = "StopStorageGridChargeV1";
139
+ EnyoDataBusMessageEnum["StartStorageGridDischargeV1"] = "StartStorageGridDischargeV1";
140
+ EnyoDataBusMessageEnum["StopStorageGridDischargeV1"] = "StopStorageGridDischargeV1";
139
141
  EnyoDataBusMessageEnum["SetStorageDischargeLimitV1"] = "SetStorageDischargeLimitV1";
142
+ EnyoDataBusMessageEnum["SetStorageChargeLimitV1"] = "SetStorageChargeLimitV1";
140
143
  EnyoDataBusMessageEnum["SetInverterFeedInLimitV1"] = "SetInverterFeedInLimitV1";
141
144
  EnyoDataBusMessageEnum["CommandAcknowledgeV1"] = "CommandAcknowledgeV1";
142
145
  EnyoDataBusMessageEnum["TemperatureSensorValuesUpdateV1"] = "TemperatureSensorValuesUpdateV1";
@@ -12,7 +12,9 @@ export declare enum EnyoHeatpumpApplianceAvailableFeaturesEnum {
12
12
  /** If the heatpump supports available power announcements */
13
13
  AvailablePowerAnnouncement = "AvailablePowerAnnouncement",
14
14
  /** If the heatpump reports power values (e.g. electrical power consumption in watts) */
15
- Power = "Power"
15
+ Power = "Power",
16
+ /** If the heatpump is ready for calibration (i.e. has all prerequisites in place to start a calibration run) */
17
+ ReadyForCalibration = "ReadyForCalibration"
16
18
  }
17
19
  export declare enum EnyoHeatpumpApplianceModeEnum {
18
20
  Idle = "Idle",
@@ -14,6 +14,8 @@ export var EnyoHeatpumpApplianceAvailableFeaturesEnum;
14
14
  EnyoHeatpumpApplianceAvailableFeaturesEnum["AvailablePowerAnnouncement"] = "AvailablePowerAnnouncement";
15
15
  /** If the heatpump reports power values (e.g. electrical power consumption in watts) */
16
16
  EnyoHeatpumpApplianceAvailableFeaturesEnum["Power"] = "Power";
17
+ /** If the heatpump is ready for calibration (i.e. has all prerequisites in place to start a calibration run) */
18
+ EnyoHeatpumpApplianceAvailableFeaturesEnum["ReadyForCalibration"] = "ReadyForCalibration";
17
19
  })(EnyoHeatpumpApplianceAvailableFeaturesEnum || (EnyoHeatpumpApplianceAvailableFeaturesEnum = {}));
18
20
  export var EnyoHeatpumpApplianceModeEnum;
19
21
  (function (EnyoHeatpumpApplianceModeEnum) {
@@ -1,48 +1,143 @@
1
1
  import { EnergyAppPackageLanguage } from "../energy-app-package-definition.js";
2
2
  /**
3
- * Types of notifications that can be displayed to users
3
+ * Lifecycle category of a notification.
4
+ *
5
+ * Categories must be registered with the host (via
6
+ * {@link EnergyAppNotification.registerNotificationCategory}) before any
7
+ * notification using that category can be sent. This allows the host to
8
+ * pre-allocate UI surfaces (badges, sections, inbox tabs) and to enforce
9
+ * per-category rate limits.
10
+ *
11
+ * - `connection-issue`: The package has detected a connectivity problem with
12
+ * an appliance, gateway, or upstream service that requires user attention.
13
+ * - `onboarding-required`: The package needs the user to complete (or revisit)
14
+ * an onboarding flow before it can continue operating normally.
4
15
  */
5
- export type EnyoNotificationType = 'info' | 'warning' | 'error' | 'success';
16
+ export type EnyoNotificationCategory = 'connection-issue' | 'onboarding-required';
6
17
  /**
7
- * Priority levels for notifications affecting display order and importance
18
+ * Registration payload describing a notification category to the host.
19
+ *
20
+ * The host uses the translated `name` and optional `description` to render
21
+ * the category in user-facing surfaces (settings screens, inbox filters,
22
+ * etc.) without the package needing to ship per-host UI strings.
8
23
  */
9
- export type EnyoNotificationPriority = 'low' | 'normal' | 'high';
24
+ export interface EnyoNotificationCategoryRegistration {
25
+ /** Category identifier this registration applies to. */
26
+ category: EnyoNotificationCategory;
27
+ /** Translated, human-readable name of the category. */
28
+ name: EnyoNotificationCategoryTranslation[];
29
+ /** Optional translated description shown alongside the category name. */
30
+ description?: EnyoNotificationCategoryTranslation[];
31
+ }
32
+ /**
33
+ * Translated label for a notification category, used during registration.
34
+ */
35
+ export interface EnyoNotificationCategoryTranslation {
36
+ /** Language code for this translation. */
37
+ language: EnergyAppPackageLanguage;
38
+ /** Display name of the category in the given language. */
39
+ name: string;
40
+ /** Optional description of the category in the given language. */
41
+ description?: string;
42
+ }
10
43
  /**
11
- * Configuration options for notification display and behavior
44
+ * Target object describing an in-app destination the user is routed to when
45
+ * they interact with a notification. Discriminated by the `type` field so
46
+ * additional target kinds can be added without breaking existing consumers.
47
+ */
48
+ export type EnyoNotificationTarget = EnyoNotificationOnboardingTarget | EnyoNotificationEnergyAppSettingsTarget | EnyoNotificationApplianceSettingsTarget;
49
+ /**
50
+ * Target that opens an onboarding guide previously registered with the host.
51
+ *
52
+ * Use this for notifications whose category is `onboarding-required` (or any
53
+ * other case where the resolution is "walk the user through onboarding").
54
+ */
55
+ export interface EnyoNotificationOnboardingTarget {
56
+ /** Discriminator identifying this as an onboarding target. */
57
+ type: 'onboarding';
58
+ /**
59
+ * Name of the onboarding guide to open. Must match the `guideName` of a
60
+ * guide previously registered via the onboarding package.
61
+ */
62
+ onboardingName: string;
63
+ }
64
+ /**
65
+ * Target that opens the settings screen for the energy app package itself
66
+ * (package-wide settings registered via the settings package, not scoped to
67
+ * a specific appliance).
68
+ */
69
+ export interface EnyoNotificationEnergyAppSettingsTarget {
70
+ /** Discriminator identifying this as an energy app settings target. */
71
+ type: 'energy-app-settings';
72
+ }
73
+ /**
74
+ * Target that opens the settings screen for a specific appliance managed by
75
+ * the energy app package.
76
+ */
77
+ export interface EnyoNotificationApplianceSettingsTarget {
78
+ /** Discriminator identifying this as an appliance settings target. */
79
+ type: 'appliance-settings';
80
+ /**
81
+ * Identifier of the appliance whose settings should be opened. Must match
82
+ * an appliance id known to the host.
83
+ */
84
+ applianceId: string;
85
+ }
86
+ /**
87
+ * Configuration options for notification display and behavior.
12
88
  */
13
89
  export interface EnyoNotificationOptions {
14
- /** Whether the notification persists until manually dismissed by the user */
15
- permanent?: boolean;
16
- /** Optional expiration time in ISO format for auto-dismissal */
17
- expiresAtIso?: string;
18
- /** Priority level affecting display order and visual emphasis */
19
- priority?: EnyoNotificationPriority;
20
- /** Optional appliance ID if notification is specific to an appliance */
90
+ /** Optional appliance ID if notification is specific to an appliance. */
21
91
  applianceId?: string;
92
+ /**
93
+ * Optional in-app destination the user is routed to when they interact
94
+ * with the notification.
95
+ */
96
+ target?: EnyoNotificationTarget;
22
97
  }
23
98
  /**
24
- * Translated notification content for multi-language support
99
+ * Translated notification content for multi-language support.
100
+ *
101
+ * Each translation provides both a short `title` (shown in lists, headers
102
+ * and system notifications) and a longer `body` (shown in the expanded
103
+ * detail view).
25
104
  */
26
105
  export interface EnyoNotificationTranslation {
27
- /** Language code for this translation */
106
+ /** Language code for this translation. */
28
107
  language: EnergyAppPackageLanguage;
29
- /** Notification message content in the specified language */
30
- notification: string;
108
+ /** Short headline shown in notification lists and system banners. */
109
+ title: string;
110
+ /** Longer message body shown when the notification is expanded. */
111
+ body: string;
112
+ }
113
+ /**
114
+ * Error reasons returned by {@link EnergyAppNotification.sendNotification}
115
+ * when a notification cannot be delivered.
116
+ *
117
+ * - `not-registered`: The supplied category has not been registered with the
118
+ * host via {@link EnergyAppNotification.registerNotificationCategory}.
119
+ * - `rate-limit`: The package has exceeded the host's notification rate
120
+ * limit for the supplied category and must back off before retrying.
121
+ */
122
+ export type EnyoNotificationSendErrorType = 'not-registered' | 'rate-limit';
123
+ /**
124
+ * Error thrown or returned by {@link EnergyAppNotification.sendNotification}
125
+ * when a notification cannot be delivered.
126
+ */
127
+ export interface EnyoNotificationSendError {
128
+ /** Machine-readable error reason. */
129
+ type: EnyoNotificationSendErrorType;
130
+ /** Optional human-readable detail describing the error. */
131
+ message?: string;
31
132
  }
32
133
  /**
33
- * Complete notification object containing all notification data
134
+ * Complete notification object containing all notification data.
34
135
  */
35
136
  export interface EnyoNotification {
36
- /** Unique identifier for this notification */
37
- id: string;
38
- /** Type of notification determining visual style and urgency */
39
- type: EnyoNotificationType;
40
- /** Configuration options for display and behavior */
137
+ /** Category of the notification; must be registered before sending. */
138
+ category: EnyoNotificationCategory;
139
+ /** Configuration options for display and behavior. */
41
140
  options: EnyoNotificationOptions;
42
- /** Array of translated notification messages for different languages */
141
+ /** Array of translated notification messages for different languages. */
43
142
  translations: EnyoNotificationTranslation[];
44
- /** ISO timestamp when the notification was created */
45
- createdAtIso: string;
46
- /** Optional ISO timestamp when the notification was last updated */
47
- updatedAtIso?: string;
48
143
  }
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.128";
8
+ export declare const SDK_VERSION = "0.0.130";
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.128';
8
+ export const SDK_VERSION = '0.0.130';
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.128",
3
+ "version": "0.0.130",
4
4
  "description": "enyo Energy App SDK",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",