@enyo-energy/energy-app-sdk 0.0.147 → 0.0.148
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 +8 -0
- package/dist/cjs/types/enyo-appliance-command-forecast.cjs +4 -1
- package/dist/cjs/types/enyo-appliance-command-forecast.d.cts +29 -1
- 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 +8 -0
- package/dist/types/enyo-appliance-command-forecast.d.ts +29 -1
- package/dist/types/enyo-appliance-command-forecast.js +4 -1
- 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
|
/**
|
|
@@ -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
|
|
@@ -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}.
|
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.148';
|
|
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
|
/**
|
|
@@ -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}.
|
|
@@ -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
|
package/dist/version.d.ts
CHANGED
package/dist/version.js
CHANGED