@enyo-energy/energy-app-sdk 0.0.147 → 0.0.149
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/implementations/appliance-command-forecast/appliance-command-forecast-validators.cjs +12 -0
- package/dist/cjs/implementations/storage/storage-schedule-handler.cjs +6 -2
- package/dist/cjs/types/enyo-appliance-command-forecast.cjs +10 -1
- package/dist/cjs/types/enyo-appliance-command-forecast.d.cts +42 -5
- package/dist/cjs/types/enyo-data-bus-value.cjs +10 -0
- package/dist/cjs/types/enyo-data-bus-value.d.cts +19 -5
- package/dist/cjs/version.cjs +1 -1
- package/dist/cjs/version.d.cts +1 -1
- package/dist/implementations/appliance-command-forecast/appliance-command-forecast-validators.js +12 -0
- package/dist/implementations/storage/storage-schedule-handler.js +6 -2
- package/dist/types/enyo-appliance-command-forecast.d.ts +42 -5
- package/dist/types/enyo-appliance-command-forecast.js +10 -1
- package/dist/types/enyo-data-bus-value.d.ts +19 -5
- package/dist/types/enyo-data-bus-value.js +10 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -9,6 +9,7 @@ exports.validateBatterySchedule = validateBatterySchedule;
|
|
|
9
9
|
exports.validateHeatpumpSchedule = validateHeatpumpSchedule;
|
|
10
10
|
exports.validateHeatpumpScheduleEntry = validateHeatpumpScheduleEntry;
|
|
11
11
|
const enyo_appliance_command_forecast_js_1 = require("../../types/enyo-appliance-command-forecast.cjs");
|
|
12
|
+
const enyo_data_bus_value_js_1 = require("../../types/enyo-data-bus-value.cjs");
|
|
12
13
|
/**
|
|
13
14
|
* Thrown when a forecast payload passed to one of the validators (or to
|
|
14
15
|
* {@link EnergyAppApplianceEnergyManagerForecast.publishChargerForecast}
|
|
@@ -39,6 +40,13 @@ function validateChargerForecast(forecast) {
|
|
|
39
40
|
throw new ApplianceCommandForecastValidationError('ChargerForecast must be an object.');
|
|
40
41
|
}
|
|
41
42
|
validateMetadata(forecast);
|
|
43
|
+
if (forecast.chargeMode !== undefined) {
|
|
44
|
+
const allowedModes = new Set(Object.values(enyo_data_bus_value_js_1.EnyoChargeModeEnum));
|
|
45
|
+
if (!allowedModes.has(forecast.chargeMode)) {
|
|
46
|
+
throw new ApplianceCommandForecastValidationError(`ChargerForecast.chargeMode is invalid: ${forecast.chargeMode}. Allowed values: ${Object.values(enyo_data_bus_value_js_1.EnyoChargeModeEnum).join(', ')}.`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
validateBooleanField(forecast.chargeActive, 'ChargerForecast.chargeActive');
|
|
42
50
|
validateChargerSchedule(forecast.relativeSchedule, forecast.resolution);
|
|
43
51
|
}
|
|
44
52
|
/**
|
|
@@ -121,6 +129,10 @@ function validateBatterySchedule(entries, resolution) {
|
|
|
121
129
|
if (!allowedDirections.has(entry.direction)) {
|
|
122
130
|
throw new ApplianceCommandForecastValidationError(`relativeSchedule[${i}].direction is invalid: ${entry.direction}.`);
|
|
123
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
|
+
}
|
|
124
136
|
}
|
|
125
137
|
validateFirstEntryStartsAtZero(entries[0].seconds, 'relativeSchedule');
|
|
126
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
|
-
|
|
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
|
}
|
|
@@ -6,7 +6,10 @@
|
|
|
6
6
|
* apply to its appliances over the upcoming horizon.
|
|
7
7
|
*
|
|
8
8
|
* Three appliance families are supported today:
|
|
9
|
-
* - **Chargers** — {@link ChargerForecast}: relative phase / power schedule
|
|
9
|
+
* - **Chargers** — {@link ChargerForecast}: relative phase / power schedule
|
|
10
|
+
* plus optional {@link ChargerForecast.chargeMode} and
|
|
11
|
+
* {@link ChargerForecast.chargeActive} flags describing the strategy the
|
|
12
|
+
* plan was built for and whether a charging session is running.
|
|
10
13
|
* - **Batteries** — {@link BatteryCommandForecast}: either a relative
|
|
11
14
|
* direction / power schedule, or an explicit "auto" release that hands
|
|
12
15
|
* control back to the appliance's own logic. Mirrors the
|
|
@@ -86,4 +89,10 @@ var BatteryCommandForecastDirectionEnum;
|
|
|
86
89
|
BatteryCommandForecastDirectionEnum["Charge"] = "charge";
|
|
87
90
|
/** Power should flow from the battery into the home / grid (discharging). */
|
|
88
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";
|
|
89
98
|
})(BatteryCommandForecastDirectionEnum || (exports.BatteryCommandForecastDirectionEnum = BatteryCommandForecastDirectionEnum = {}));
|
|
@@ -5,7 +5,10 @@
|
|
|
5
5
|
* apply to its appliances over the upcoming horizon.
|
|
6
6
|
*
|
|
7
7
|
* Three appliance families are supported today:
|
|
8
|
-
* - **Chargers** — {@link ChargerForecast}: relative phase / power schedule
|
|
8
|
+
* - **Chargers** — {@link ChargerForecast}: relative phase / power schedule
|
|
9
|
+
* plus optional {@link ChargerForecast.chargeMode} and
|
|
10
|
+
* {@link ChargerForecast.chargeActive} flags describing the strategy the
|
|
11
|
+
* plan was built for and whether a charging session is running.
|
|
9
12
|
* - **Batteries** — {@link BatteryCommandForecast}: either a relative
|
|
10
13
|
* direction / power schedule, or an explicit "auto" release that hands
|
|
11
14
|
* control back to the appliance's own logic. Mirrors the
|
|
@@ -25,6 +28,7 @@
|
|
|
25
28
|
* The transport / fan-out is an internal detail of the runtime SDK and
|
|
26
29
|
* not exposed to apps.
|
|
27
30
|
*/
|
|
31
|
+
import { EnyoChargeModeEnum } from './enyo-data-bus-value.cjs';
|
|
28
32
|
/**
|
|
29
33
|
* Optional metadata describing the estimated savings of a forecasted
|
|
30
34
|
* command plan compared to an unmanaged baseline.
|
|
@@ -116,6 +120,30 @@ export interface ChargerForecast extends ApplianceForecastMetadata {
|
|
|
116
120
|
* starting at `seconds = 0`. Must contain at least one entry.
|
|
117
121
|
*/
|
|
118
122
|
relativeSchedule: ChargerForecastScheduleEntry[];
|
|
123
|
+
/**
|
|
124
|
+
* Charging strategy the plan was built for — `immediate`,
|
|
125
|
+
* `cost-optimized` or `price-limit`. Uses the same enum as
|
|
126
|
+
* {@link EnyoCharge.chargeMode} and the command-side
|
|
127
|
+
* {@link EnyoDataBusStartChargeV1} so the forecasted plan can be
|
|
128
|
+
* compared 1:1 with the command that will eventually be issued.
|
|
129
|
+
*
|
|
130
|
+
* Omit when the publisher does not declare a mode (e.g. an unmanaged
|
|
131
|
+
* baseline forecast); consumers should not infer a default.
|
|
132
|
+
*/
|
|
133
|
+
chargeMode?: EnyoChargeModeEnum;
|
|
134
|
+
/**
|
|
135
|
+
* Whether a charging session is currently active on the appliance at
|
|
136
|
+
* the moment this forecast is published.
|
|
137
|
+
*
|
|
138
|
+
* - `true` — a session is running; subsequent `powerW = 0` entries
|
|
139
|
+
* should be read as "pause while staying connected", not "stop".
|
|
140
|
+
* - `false` — no session is running; the schedule describes the plan
|
|
141
|
+
* the publisher intends to apply once a session starts (or what
|
|
142
|
+
* would have been applied had one been running).
|
|
143
|
+
* - omitted — the publisher cannot determine the session state;
|
|
144
|
+
* consumers must not infer one.
|
|
145
|
+
*/
|
|
146
|
+
chargeActive?: boolean;
|
|
119
147
|
}
|
|
120
148
|
/**
|
|
121
149
|
* Top-level control mode carried by {@link BatteryCommandForecast}.
|
|
@@ -150,7 +178,13 @@ export declare enum BatteryCommandForecastDirectionEnum {
|
|
|
150
178
|
/** Power should flow from PV / home / grid into the battery (charging). */
|
|
151
179
|
Charge = "charge",
|
|
152
180
|
/** Power should flow from the battery into the home / grid (discharging). */
|
|
153
|
-
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"
|
|
154
188
|
}
|
|
155
189
|
/**
|
|
156
190
|
* One entry of a battery's relative direction / power schedule.
|
|
@@ -170,9 +204,12 @@ export interface BatteryCommandForecastScheduleEntry {
|
|
|
170
204
|
direction: BatteryCommandForecastDirectionEnum;
|
|
171
205
|
/**
|
|
172
206
|
* Target power in Watts. Always non-negative — direction is carried
|
|
173
|
-
* by {@link direction}, never by sign. A `powerW` of `0`
|
|
174
|
-
*
|
|
175
|
-
* 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`.
|
|
176
213
|
*/
|
|
177
214
|
powerW: number;
|
|
178
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}
|
|
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`
|
|
1090
|
-
*
|
|
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
|
}
|
package/dist/cjs/version.cjs
CHANGED
|
@@ -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.
|
|
12
|
+
exports.SDK_VERSION = '0.0.149';
|
|
13
13
|
/**
|
|
14
14
|
* Gets the current SDK version.
|
|
15
15
|
* @returns The semantic version string of the SDK
|
package/dist/cjs/version.d.cts
CHANGED
package/dist/implementations/appliance-command-forecast/appliance-command-forecast-validators.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ApplianceForecastResolutionEnum, BatteryCommandForecastDirectionEnum, BatteryCommandForecastModeEnum, } from '../../types/enyo-appliance-command-forecast.js';
|
|
2
|
+
import { EnyoChargeModeEnum } from '../../types/enyo-data-bus-value.js';
|
|
2
3
|
/**
|
|
3
4
|
* Thrown when a forecast payload passed to one of the validators (or to
|
|
4
5
|
* {@link EnergyAppApplianceEnergyManagerForecast.publishChargerForecast}
|
|
@@ -28,6 +29,13 @@ export function validateChargerForecast(forecast) {
|
|
|
28
29
|
throw new ApplianceCommandForecastValidationError('ChargerForecast must be an object.');
|
|
29
30
|
}
|
|
30
31
|
validateMetadata(forecast);
|
|
32
|
+
if (forecast.chargeMode !== undefined) {
|
|
33
|
+
const allowedModes = new Set(Object.values(EnyoChargeModeEnum));
|
|
34
|
+
if (!allowedModes.has(forecast.chargeMode)) {
|
|
35
|
+
throw new ApplianceCommandForecastValidationError(`ChargerForecast.chargeMode is invalid: ${forecast.chargeMode}. Allowed values: ${Object.values(EnyoChargeModeEnum).join(', ')}.`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
validateBooleanField(forecast.chargeActive, 'ChargerForecast.chargeActive');
|
|
31
39
|
validateChargerSchedule(forecast.relativeSchedule, forecast.resolution);
|
|
32
40
|
}
|
|
33
41
|
/**
|
|
@@ -110,6 +118,10 @@ export function validateBatterySchedule(entries, resolution) {
|
|
|
110
118
|
if (!allowedDirections.has(entry.direction)) {
|
|
111
119
|
throw new ApplianceCommandForecastValidationError(`relativeSchedule[${i}].direction is invalid: ${entry.direction}.`);
|
|
112
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
|
+
}
|
|
113
125
|
}
|
|
114
126
|
validateFirstEntryStartsAtZero(entries[0].seconds, 'relativeSchedule');
|
|
115
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
|
-
|
|
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
|
}
|
|
@@ -5,7 +5,10 @@
|
|
|
5
5
|
* apply to its appliances over the upcoming horizon.
|
|
6
6
|
*
|
|
7
7
|
* Three appliance families are supported today:
|
|
8
|
-
* - **Chargers** — {@link ChargerForecast}: relative phase / power schedule
|
|
8
|
+
* - **Chargers** — {@link ChargerForecast}: relative phase / power schedule
|
|
9
|
+
* plus optional {@link ChargerForecast.chargeMode} and
|
|
10
|
+
* {@link ChargerForecast.chargeActive} flags describing the strategy the
|
|
11
|
+
* plan was built for and whether a charging session is running.
|
|
9
12
|
* - **Batteries** — {@link BatteryCommandForecast}: either a relative
|
|
10
13
|
* direction / power schedule, or an explicit "auto" release that hands
|
|
11
14
|
* control back to the appliance's own logic. Mirrors the
|
|
@@ -25,6 +28,7 @@
|
|
|
25
28
|
* The transport / fan-out is an internal detail of the runtime SDK and
|
|
26
29
|
* not exposed to apps.
|
|
27
30
|
*/
|
|
31
|
+
import { EnyoChargeModeEnum } from './enyo-data-bus-value.js';
|
|
28
32
|
/**
|
|
29
33
|
* Optional metadata describing the estimated savings of a forecasted
|
|
30
34
|
* command plan compared to an unmanaged baseline.
|
|
@@ -116,6 +120,30 @@ export interface ChargerForecast extends ApplianceForecastMetadata {
|
|
|
116
120
|
* starting at `seconds = 0`. Must contain at least one entry.
|
|
117
121
|
*/
|
|
118
122
|
relativeSchedule: ChargerForecastScheduleEntry[];
|
|
123
|
+
/**
|
|
124
|
+
* Charging strategy the plan was built for — `immediate`,
|
|
125
|
+
* `cost-optimized` or `price-limit`. Uses the same enum as
|
|
126
|
+
* {@link EnyoCharge.chargeMode} and the command-side
|
|
127
|
+
* {@link EnyoDataBusStartChargeV1} so the forecasted plan can be
|
|
128
|
+
* compared 1:1 with the command that will eventually be issued.
|
|
129
|
+
*
|
|
130
|
+
* Omit when the publisher does not declare a mode (e.g. an unmanaged
|
|
131
|
+
* baseline forecast); consumers should not infer a default.
|
|
132
|
+
*/
|
|
133
|
+
chargeMode?: EnyoChargeModeEnum;
|
|
134
|
+
/**
|
|
135
|
+
* Whether a charging session is currently active on the appliance at
|
|
136
|
+
* the moment this forecast is published.
|
|
137
|
+
*
|
|
138
|
+
* - `true` — a session is running; subsequent `powerW = 0` entries
|
|
139
|
+
* should be read as "pause while staying connected", not "stop".
|
|
140
|
+
* - `false` — no session is running; the schedule describes the plan
|
|
141
|
+
* the publisher intends to apply once a session starts (or what
|
|
142
|
+
* would have been applied had one been running).
|
|
143
|
+
* - omitted — the publisher cannot determine the session state;
|
|
144
|
+
* consumers must not infer one.
|
|
145
|
+
*/
|
|
146
|
+
chargeActive?: boolean;
|
|
119
147
|
}
|
|
120
148
|
/**
|
|
121
149
|
* Top-level control mode carried by {@link BatteryCommandForecast}.
|
|
@@ -150,7 +178,13 @@ export declare enum BatteryCommandForecastDirectionEnum {
|
|
|
150
178
|
/** Power should flow from PV / home / grid into the battery (charging). */
|
|
151
179
|
Charge = "charge",
|
|
152
180
|
/** Power should flow from the battery into the home / grid (discharging). */
|
|
153
|
-
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"
|
|
154
188
|
}
|
|
155
189
|
/**
|
|
156
190
|
* One entry of a battery's relative direction / power schedule.
|
|
@@ -170,9 +204,12 @@ export interface BatteryCommandForecastScheduleEntry {
|
|
|
170
204
|
direction: BatteryCommandForecastDirectionEnum;
|
|
171
205
|
/**
|
|
172
206
|
* Target power in Watts. Always non-negative — direction is carried
|
|
173
|
-
* by {@link direction}, never by sign. A `powerW` of `0`
|
|
174
|
-
*
|
|
175
|
-
* 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`.
|
|
176
213
|
*/
|
|
177
214
|
powerW: number;
|
|
178
215
|
}
|
|
@@ -5,7 +5,10 @@
|
|
|
5
5
|
* apply to its appliances over the upcoming horizon.
|
|
6
6
|
*
|
|
7
7
|
* Three appliance families are supported today:
|
|
8
|
-
* - **Chargers** — {@link ChargerForecast}: relative phase / power schedule
|
|
8
|
+
* - **Chargers** — {@link ChargerForecast}: relative phase / power schedule
|
|
9
|
+
* plus optional {@link ChargerForecast.chargeMode} and
|
|
10
|
+
* {@link ChargerForecast.chargeActive} flags describing the strategy the
|
|
11
|
+
* plan was built for and whether a charging session is running.
|
|
9
12
|
* - **Batteries** — {@link BatteryCommandForecast}: either a relative
|
|
10
13
|
* direction / power schedule, or an explicit "auto" release that hands
|
|
11
14
|
* control back to the appliance's own logic. Mirrors the
|
|
@@ -83,4 +86,10 @@ export var BatteryCommandForecastDirectionEnum;
|
|
|
83
86
|
BatteryCommandForecastDirectionEnum["Charge"] = "charge";
|
|
84
87
|
/** Power should flow from the battery into the home / grid (discharging). */
|
|
85
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";
|
|
86
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}
|
|
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`
|
|
1090
|
-
*
|
|
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
package/dist/version.js
CHANGED