@enyo-energy/energy-app-sdk 0.0.148 → 0.0.150

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.
@@ -129,6 +129,10 @@ function validateBatterySchedule(entries, resolution) {
129
129
  if (!allowedDirections.has(entry.direction)) {
130
130
  throw new ApplianceCommandForecastValidationError(`relativeSchedule[${i}].direction is invalid: ${entry.direction}.`);
131
131
  }
132
+ if (entry.direction === enyo_appliance_command_forecast_js_1.BatteryCommandForecastDirectionEnum.Idle
133
+ && entry.powerW !== 0) {
134
+ throw new ApplianceCommandForecastValidationError(`relativeSchedule[${i}].powerW must be 0 when direction is '${enyo_appliance_command_forecast_js_1.BatteryCommandForecastDirectionEnum.Idle}'; got ${entry.powerW}.`);
135
+ }
132
136
  }
133
137
  validateFirstEntryStartsAtZero(entries[0].seconds, 'relativeSchedule');
134
138
  validateSecondsMatchResolution(entries.map((e) => e.seconds), stepSeconds, 'relativeSchedule');
@@ -337,8 +337,12 @@ class StorageScheduleHandler {
337
337
  return { ok: false, error: new Error(`relativeSchedule[${i}].powerW must be a non-negative finite number`) };
338
338
  }
339
339
  if (e.direction !== enyo_data_bus_value_js_1.EnyoStorageScheduleDirectionEnum.Charge
340
- && e.direction !== enyo_data_bus_value_js_1.EnyoStorageScheduleDirectionEnum.Discharge) {
341
- return { ok: false, error: new Error(`relativeSchedule[${i}].direction must be 'charge' or 'discharge'`) };
340
+ && e.direction !== enyo_data_bus_value_js_1.EnyoStorageScheduleDirectionEnum.Discharge
341
+ && e.direction !== enyo_data_bus_value_js_1.EnyoStorageScheduleDirectionEnum.Idle) {
342
+ return { ok: false, error: new Error(`relativeSchedule[${i}].direction must be 'charge', 'discharge' or 'idle'`) };
343
+ }
344
+ if (e.direction === enyo_data_bus_value_js_1.EnyoStorageScheduleDirectionEnum.Idle && e.powerW !== 0) {
345
+ return { ok: false, error: new Error(`relativeSchedule[${i}].powerW must be 0 when direction is 'idle' (got ${e.powerW})`) };
342
346
  }
343
347
  previousSeconds = e.seconds;
344
348
  }
@@ -51,15 +51,6 @@ export interface MpcClientOptions {
51
51
  * sluggish but functional — extend rather than disable.
52
52
  */
53
53
  descriptionReadTimeoutMs?: number;
54
- /**
55
- * When the internal description read fails (timeout or
56
- * not-supported), fall back to extracting `scopeType` from each
57
- * inbound notify (`acPowerTotal` → {@link EebusMpcReading.activePowerW},
58
- * `acEnergyConsumed` → {@link EebusMpcReading.totalEnergyConsumedWh})
59
- * so the client keeps emitting readings instead of going silent.
60
- * Defaults to `true`.
61
- */
62
- fallbackToInlineScope?: boolean;
63
54
  }
64
55
  /**
65
56
  * Client for the EEBUS **Monitoring of Power Consumption (MPC)** use case.
@@ -85,13 +85,8 @@ export interface EebusUseCaseRegistry {
85
85
  * known). Without a hint the client picks the first server match the
86
86
  * SDK resolves.
87
87
  *
88
- * The default options enable `fallbackToInlineScope`, so a single
89
- * slow `measurementDescriptionListData` read on a flaky peer no
90
- * longer silences the client — it falls back to extracting scope
91
- * from inbound notifies.
92
- *
93
88
  * @param ski Subject Key Identifier of the remote node
94
- * @param options Optional address/timeout/fallback configuration
89
+ * @param options Optional address/timeout configuration
95
90
  */
96
91
  mpc: (ski: string, options?: MpcClientOptions) => EebusMpcClient;
97
92
  /**
@@ -89,4 +89,10 @@ var BatteryCommandForecastDirectionEnum;
89
89
  BatteryCommandForecastDirectionEnum["Charge"] = "charge";
90
90
  /** Power should flow from the battery into the home / grid (discharging). */
91
91
  BatteryCommandForecastDirectionEnum["Discharge"] = "discharge";
92
+ /**
93
+ * No energy flow — the battery holds its current state-of-charge.
94
+ * Use to mark idle periods between charge / discharge entries. The
95
+ * entry's `powerW` must be `0`.
96
+ */
97
+ BatteryCommandForecastDirectionEnum["Idle"] = "idle";
92
98
  })(BatteryCommandForecastDirectionEnum || (exports.BatteryCommandForecastDirectionEnum = BatteryCommandForecastDirectionEnum = {}));
@@ -178,7 +178,13 @@ export declare enum BatteryCommandForecastDirectionEnum {
178
178
  /** Power should flow from PV / home / grid into the battery (charging). */
179
179
  Charge = "charge",
180
180
  /** Power should flow from the battery into the home / grid (discharging). */
181
- Discharge = "discharge"
181
+ Discharge = "discharge",
182
+ /**
183
+ * No energy flow — the battery holds its current state-of-charge.
184
+ * Use to mark idle periods between charge / discharge entries. The
185
+ * entry's `powerW` must be `0`.
186
+ */
187
+ Idle = "idle"
182
188
  }
183
189
  /**
184
190
  * One entry of a battery's relative direction / power schedule.
@@ -198,9 +204,12 @@ export interface BatteryCommandForecastScheduleEntry {
198
204
  direction: BatteryCommandForecastDirectionEnum;
199
205
  /**
200
206
  * Target power in Watts. Always non-negative — direction is carried
201
- * by {@link direction}, never by sign. A `powerW` of `0` means "hold
202
- * at zero in the named direction" (effectively idle until the next
203
- * entry).
207
+ * by {@link direction}, never by sign. A `powerW` of `0` together
208
+ * with a `Charge` or `Discharge` direction means "hold at zero in
209
+ * the named direction" (effectively idle until the next entry);
210
+ * prefer the explicit
211
+ * {@link BatteryCommandForecastDirectionEnum.Idle} direction for
212
+ * unambiguous idle slots, in which case `powerW` must also be `0`.
204
213
  */
205
214
  powerW: number;
206
215
  }
@@ -194,6 +194,10 @@ var EnyoStorageScheduleModeEnum;
194
194
  * to keep schedule entries unambiguous on the wire: `powerW` is always
195
195
  * non-negative, and consumers never have to disambiguate `0` from
196
196
  * "direction-of-zero" or interpret sign conventions per integration.
197
+ *
198
+ * `Idle` is the explicit "no energy flow" marker — use it to insert
199
+ * idle slots between charge / discharge periods. An entry with
200
+ * `direction = Idle` must carry `powerW = 0`.
197
201
  */
198
202
  var EnyoStorageScheduleDirectionEnum;
199
203
  (function (EnyoStorageScheduleDirectionEnum) {
@@ -201,6 +205,12 @@ var EnyoStorageScheduleDirectionEnum;
201
205
  EnyoStorageScheduleDirectionEnum["Charge"] = "charge";
202
206
  /** Power should flow from the battery into the grid / home (discharging). */
203
207
  EnyoStorageScheduleDirectionEnum["Discharge"] = "discharge";
208
+ /**
209
+ * No energy flow — the battery holds its current state-of-charge.
210
+ * Use to mark idle periods between charge / discharge entries. The
211
+ * entry's `powerW` must be `0`.
212
+ */
213
+ EnyoStorageScheduleDirectionEnum["Idle"] = "idle";
204
214
  })(EnyoStorageScheduleDirectionEnum || (exports.EnyoStorageScheduleDirectionEnum = EnyoStorageScheduleDirectionEnum = {}));
205
215
  /**
206
216
  * Possible answers an appliance can give when acknowledging a command.
@@ -1055,12 +1055,22 @@ export declare enum EnyoStorageScheduleModeEnum {
1055
1055
  * to keep schedule entries unambiguous on the wire: `powerW` is always
1056
1056
  * non-negative, and consumers never have to disambiguate `0` from
1057
1057
  * "direction-of-zero" or interpret sign conventions per integration.
1058
+ *
1059
+ * `Idle` is the explicit "no energy flow" marker — use it to insert
1060
+ * idle slots between charge / discharge periods. An entry with
1061
+ * `direction = Idle` must carry `powerW = 0`.
1058
1062
  */
1059
1063
  export declare enum EnyoStorageScheduleDirectionEnum {
1060
1064
  /** Power should flow from the grid into the battery (charging). */
1061
1065
  Charge = "charge",
1062
1066
  /** Power should flow from the battery into the grid / home (discharging). */
1063
- Discharge = "discharge"
1067
+ Discharge = "discharge",
1068
+ /**
1069
+ * No energy flow — the battery holds its current state-of-charge.
1070
+ * Use to mark idle periods between charge / discharge entries. The
1071
+ * entry's `powerW` must be `0`.
1072
+ */
1073
+ Idle = "idle"
1064
1074
  }
1065
1075
  /**
1066
1076
  * A single setpoint within a storage relative schedule. The setpoint
@@ -1079,15 +1089,19 @@ export interface EnyoStorageScheduleEntry {
1079
1089
  seconds: number;
1080
1090
  /**
1081
1091
  * Direction of energy flow for this setpoint
1082
- * ({@link EnyoStorageScheduleDirectionEnum.Charge} or
1083
- * {@link EnyoStorageScheduleDirectionEnum.Discharge}).
1092
+ * ({@link EnyoStorageScheduleDirectionEnum.Charge},
1093
+ * {@link EnyoStorageScheduleDirectionEnum.Discharge}, or
1094
+ * {@link EnyoStorageScheduleDirectionEnum.Idle}).
1084
1095
  */
1085
1096
  direction: EnyoStorageScheduleDirectionEnum;
1086
1097
  /**
1087
1098
  * Target power for this setpoint in Watts. Always non-negative —
1088
1099
  * direction is carried by {@link direction}, never by sign. A
1089
- * `powerW` of `0` means "hold at zero in the named direction"
1090
- * (effectively idle until the next entry).
1100
+ * `powerW` of `0` together with a `Charge` or `Discharge` direction
1101
+ * means "hold at zero in the named direction" (effectively idle
1102
+ * until the next entry); prefer the explicit
1103
+ * {@link EnyoStorageScheduleDirectionEnum.Idle} direction for
1104
+ * unambiguous idle slots, in which case `powerW` must also be `0`.
1091
1105
  */
1092
1106
  powerW: number;
1093
1107
  }
@@ -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.148';
12
+ exports.SDK_VERSION = '0.0.150';
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.148";
8
+ export declare const SDK_VERSION = "0.0.150";
9
9
  /**
10
10
  * Gets the current SDK version.
11
11
  * @returns The semantic version string of the SDK
@@ -118,6 +118,10 @@ export function validateBatterySchedule(entries, resolution) {
118
118
  if (!allowedDirections.has(entry.direction)) {
119
119
  throw new ApplianceCommandForecastValidationError(`relativeSchedule[${i}].direction is invalid: ${entry.direction}.`);
120
120
  }
121
+ if (entry.direction === BatteryCommandForecastDirectionEnum.Idle
122
+ && entry.powerW !== 0) {
123
+ throw new ApplianceCommandForecastValidationError(`relativeSchedule[${i}].powerW must be 0 when direction is '${BatteryCommandForecastDirectionEnum.Idle}'; got ${entry.powerW}.`);
124
+ }
121
125
  }
122
126
  validateFirstEntryStartsAtZero(entries[0].seconds, 'relativeSchedule');
123
127
  validateSecondsMatchResolution(entries.map((e) => e.seconds), stepSeconds, 'relativeSchedule');
@@ -334,8 +334,12 @@ export class StorageScheduleHandler {
334
334
  return { ok: false, error: new Error(`relativeSchedule[${i}].powerW must be a non-negative finite number`) };
335
335
  }
336
336
  if (e.direction !== EnyoStorageScheduleDirectionEnum.Charge
337
- && e.direction !== EnyoStorageScheduleDirectionEnum.Discharge) {
338
- return { ok: false, error: new Error(`relativeSchedule[${i}].direction must be 'charge' or 'discharge'`) };
337
+ && e.direction !== EnyoStorageScheduleDirectionEnum.Discharge
338
+ && e.direction !== EnyoStorageScheduleDirectionEnum.Idle) {
339
+ return { ok: false, error: new Error(`relativeSchedule[${i}].direction must be 'charge', 'discharge' or 'idle'`) };
340
+ }
341
+ if (e.direction === EnyoStorageScheduleDirectionEnum.Idle && e.powerW !== 0) {
342
+ return { ok: false, error: new Error(`relativeSchedule[${i}].powerW must be 0 when direction is 'idle' (got ${e.powerW})`) };
339
343
  }
340
344
  previousSeconds = e.seconds;
341
345
  }
@@ -51,15 +51,6 @@ export interface MpcClientOptions {
51
51
  * sluggish but functional — extend rather than disable.
52
52
  */
53
53
  descriptionReadTimeoutMs?: number;
54
- /**
55
- * When the internal description read fails (timeout or
56
- * not-supported), fall back to extracting `scopeType` from each
57
- * inbound notify (`acPowerTotal` → {@link EebusMpcReading.activePowerW},
58
- * `acEnergyConsumed` → {@link EebusMpcReading.totalEnergyConsumedWh})
59
- * so the client keeps emitting readings instead of going silent.
60
- * Defaults to `true`.
61
- */
62
- fallbackToInlineScope?: boolean;
63
54
  }
64
55
  /**
65
56
  * Client for the EEBUS **Monitoring of Power Consumption (MPC)** use case.
@@ -85,13 +85,8 @@ export interface EebusUseCaseRegistry {
85
85
  * known). Without a hint the client picks the first server match the
86
86
  * SDK resolves.
87
87
  *
88
- * The default options enable `fallbackToInlineScope`, so a single
89
- * slow `measurementDescriptionListData` read on a flaky peer no
90
- * longer silences the client — it falls back to extracting scope
91
- * from inbound notifies.
92
- *
93
88
  * @param ski Subject Key Identifier of the remote node
94
- * @param options Optional address/timeout/fallback configuration
89
+ * @param options Optional address/timeout configuration
95
90
  */
96
91
  mpc: (ski: string, options?: MpcClientOptions) => EebusMpcClient;
97
92
  /**
@@ -178,7 +178,13 @@ export declare enum BatteryCommandForecastDirectionEnum {
178
178
  /** Power should flow from PV / home / grid into the battery (charging). */
179
179
  Charge = "charge",
180
180
  /** Power should flow from the battery into the home / grid (discharging). */
181
- Discharge = "discharge"
181
+ Discharge = "discharge",
182
+ /**
183
+ * No energy flow — the battery holds its current state-of-charge.
184
+ * Use to mark idle periods between charge / discharge entries. The
185
+ * entry's `powerW` must be `0`.
186
+ */
187
+ Idle = "idle"
182
188
  }
183
189
  /**
184
190
  * One entry of a battery's relative direction / power schedule.
@@ -198,9 +204,12 @@ export interface BatteryCommandForecastScheduleEntry {
198
204
  direction: BatteryCommandForecastDirectionEnum;
199
205
  /**
200
206
  * Target power in Watts. Always non-negative — direction is carried
201
- * by {@link direction}, never by sign. A `powerW` of `0` means "hold
202
- * at zero in the named direction" (effectively idle until the next
203
- * entry).
207
+ * by {@link direction}, never by sign. A `powerW` of `0` together
208
+ * with a `Charge` or `Discharge` direction means "hold at zero in
209
+ * the named direction" (effectively idle until the next entry);
210
+ * prefer the explicit
211
+ * {@link BatteryCommandForecastDirectionEnum.Idle} direction for
212
+ * unambiguous idle slots, in which case `powerW` must also be `0`.
204
213
  */
205
214
  powerW: number;
206
215
  }
@@ -86,4 +86,10 @@ export var BatteryCommandForecastDirectionEnum;
86
86
  BatteryCommandForecastDirectionEnum["Charge"] = "charge";
87
87
  /** Power should flow from the battery into the home / grid (discharging). */
88
88
  BatteryCommandForecastDirectionEnum["Discharge"] = "discharge";
89
+ /**
90
+ * No energy flow — the battery holds its current state-of-charge.
91
+ * Use to mark idle periods between charge / discharge entries. The
92
+ * entry's `powerW` must be `0`.
93
+ */
94
+ BatteryCommandForecastDirectionEnum["Idle"] = "idle";
89
95
  })(BatteryCommandForecastDirectionEnum || (BatteryCommandForecastDirectionEnum = {}));
@@ -1055,12 +1055,22 @@ export declare enum EnyoStorageScheduleModeEnum {
1055
1055
  * to keep schedule entries unambiguous on the wire: `powerW` is always
1056
1056
  * non-negative, and consumers never have to disambiguate `0` from
1057
1057
  * "direction-of-zero" or interpret sign conventions per integration.
1058
+ *
1059
+ * `Idle` is the explicit "no energy flow" marker — use it to insert
1060
+ * idle slots between charge / discharge periods. An entry with
1061
+ * `direction = Idle` must carry `powerW = 0`.
1058
1062
  */
1059
1063
  export declare enum EnyoStorageScheduleDirectionEnum {
1060
1064
  /** Power should flow from the grid into the battery (charging). */
1061
1065
  Charge = "charge",
1062
1066
  /** Power should flow from the battery into the grid / home (discharging). */
1063
- Discharge = "discharge"
1067
+ Discharge = "discharge",
1068
+ /**
1069
+ * No energy flow — the battery holds its current state-of-charge.
1070
+ * Use to mark idle periods between charge / discharge entries. The
1071
+ * entry's `powerW` must be `0`.
1072
+ */
1073
+ Idle = "idle"
1064
1074
  }
1065
1075
  /**
1066
1076
  * A single setpoint within a storage relative schedule. The setpoint
@@ -1079,15 +1089,19 @@ export interface EnyoStorageScheduleEntry {
1079
1089
  seconds: number;
1080
1090
  /**
1081
1091
  * Direction of energy flow for this setpoint
1082
- * ({@link EnyoStorageScheduleDirectionEnum.Charge} or
1083
- * {@link EnyoStorageScheduleDirectionEnum.Discharge}).
1092
+ * ({@link EnyoStorageScheduleDirectionEnum.Charge},
1093
+ * {@link EnyoStorageScheduleDirectionEnum.Discharge}, or
1094
+ * {@link EnyoStorageScheduleDirectionEnum.Idle}).
1084
1095
  */
1085
1096
  direction: EnyoStorageScheduleDirectionEnum;
1086
1097
  /**
1087
1098
  * Target power for this setpoint in Watts. Always non-negative —
1088
1099
  * direction is carried by {@link direction}, never by sign. A
1089
- * `powerW` of `0` means "hold at zero in the named direction"
1090
- * (effectively idle until the next entry).
1100
+ * `powerW` of `0` together with a `Charge` or `Discharge` direction
1101
+ * means "hold at zero in the named direction" (effectively idle
1102
+ * until the next entry); prefer the explicit
1103
+ * {@link EnyoStorageScheduleDirectionEnum.Idle} direction for
1104
+ * unambiguous idle slots, in which case `powerW` must also be `0`.
1091
1105
  */
1092
1106
  powerW: number;
1093
1107
  }
@@ -191,6 +191,10 @@ export var EnyoStorageScheduleModeEnum;
191
191
  * to keep schedule entries unambiguous on the wire: `powerW` is always
192
192
  * non-negative, and consumers never have to disambiguate `0` from
193
193
  * "direction-of-zero" or interpret sign conventions per integration.
194
+ *
195
+ * `Idle` is the explicit "no energy flow" marker — use it to insert
196
+ * idle slots between charge / discharge periods. An entry with
197
+ * `direction = Idle` must carry `powerW = 0`.
194
198
  */
195
199
  export var EnyoStorageScheduleDirectionEnum;
196
200
  (function (EnyoStorageScheduleDirectionEnum) {
@@ -198,6 +202,12 @@ export var EnyoStorageScheduleDirectionEnum;
198
202
  EnyoStorageScheduleDirectionEnum["Charge"] = "charge";
199
203
  /** Power should flow from the battery into the grid / home (discharging). */
200
204
  EnyoStorageScheduleDirectionEnum["Discharge"] = "discharge";
205
+ /**
206
+ * No energy flow — the battery holds its current state-of-charge.
207
+ * Use to mark idle periods between charge / discharge entries. The
208
+ * entry's `powerW` must be `0`.
209
+ */
210
+ EnyoStorageScheduleDirectionEnum["Idle"] = "idle";
201
211
  })(EnyoStorageScheduleDirectionEnum || (EnyoStorageScheduleDirectionEnum = {}));
202
212
  /**
203
213
  * Possible answers an appliance can give when acknowledging a command.
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.148";
8
+ export declare const SDK_VERSION = "0.0.150";
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.148';
8
+ export const SDK_VERSION = '0.0.150';
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.148",
3
+ "version": "0.0.150",
4
4
  "description": "enyo Energy App SDK",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",