@enyo-energy/energy-app-sdk 1.21.0 → 1.22.0

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.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EnergyAppPackageFirmwareModeEnum = exports.EnergyAppPackageCategory = void 0;
3
+ exports.EnergyAppPackageFirmwareModeEnum = exports.EnergyAppPackageCompatibilityStatus = exports.EnergyAppPackageCategory = void 0;
4
4
  exports.defineEnergyAppPackage = defineEnergyAppPackage;
5
5
  const version_js_1 = require("./version.cjs");
6
6
  var EnergyAppPackageCategory;
@@ -27,6 +27,24 @@ var EnergyAppPackageCategory;
27
27
  EnergyAppPackageCategory["Vehicle"] = "vehicle";
28
28
  EnergyAppPackageCategory["Other"] = "other";
29
29
  })(EnergyAppPackageCategory || (exports.EnergyAppPackageCategory = EnergyAppPackageCategory = {}));
30
+ /**
31
+ * Whether a declared compatibility entry means "this works" or "this is known
32
+ * not to work".
33
+ *
34
+ * Used by {@link EnergyAppPackageCompatibilityVendor.status} and
35
+ * {@link EnergyAppPackageCompatibilityModel.status} so a package can
36
+ * list a vendor or model it has explicitly tested and found unsupported,
37
+ * instead of silently leaving it out. The enyo Store and onboarding flows can
38
+ * then tell the user "this device is not supported by this app" rather than
39
+ * showing nothing at all.
40
+ */
41
+ var EnergyAppPackageCompatibilityStatus;
42
+ (function (EnergyAppPackageCompatibilityStatus) {
43
+ /** The package supports this vendor or model. */
44
+ EnergyAppPackageCompatibilityStatus["Compatible"] = "compatible";
45
+ /** The package has been verified **not** to work with this vendor or model. */
46
+ EnergyAppPackageCompatibilityStatus["NotCompatible"] = "not-compatible";
47
+ })(EnergyAppPackageCompatibilityStatus || (exports.EnergyAppPackageCompatibilityStatus = EnergyAppPackageCompatibilityStatus = {}));
30
48
  /**
31
49
  * Enum form of {@link EnergyAppPackageFirmwareMode} for use in package
32
50
  * definitions.
@@ -213,6 +213,23 @@ export interface EnergyAppPackagePermission {
213
213
  /** Internal documentation describing what this permission is used for */
214
214
  internalComment: string;
215
215
  }
216
+ /**
217
+ * Whether a declared compatibility entry means "this works" or "this is known
218
+ * not to work".
219
+ *
220
+ * Used by {@link EnergyAppPackageCompatibilityVendor.status} and
221
+ * {@link EnergyAppPackageCompatibilityModel.status} so a package can
222
+ * list a vendor or model it has explicitly tested and found unsupported,
223
+ * instead of silently leaving it out. The enyo Store and onboarding flows can
224
+ * then tell the user "this device is not supported by this app" rather than
225
+ * showing nothing at all.
226
+ */
227
+ export declare enum EnergyAppPackageCompatibilityStatus {
228
+ /** The package supports this vendor or model. */
229
+ Compatible = "compatible",
230
+ /** The package has been verified **not** to work with this vendor or model. */
231
+ NotCompatible = "not-compatible"
232
+ }
216
233
  /**
217
234
  * A specific device model supported by an Energy App package.
218
235
  * the concrete models the package has been verified to work with.
@@ -249,6 +266,16 @@ export interface EnergyAppPackageCompatibilityModel {
249
266
  category?: EnergyAppPackageCategory;
250
267
  /** Optional internal note explaining model-specific caveats or limitations */
251
268
  internalComment?: string;
269
+ /**
270
+ * Whether this model is supported or explicitly unsupported.
271
+ *
272
+ * Defaults to {@link EnergyAppPackageCompatibilityStatus.Compatible} when
273
+ * omitted, so existing definitions keep their meaning. Set it to
274
+ * {@link EnergyAppPackageCompatibilityStatus.NotCompatible} to document a
275
+ * model you have tested and found not to work — use
276
+ * {@link internalComment} to say why.
277
+ */
278
+ status?: EnergyAppPackageCompatibilityStatus;
252
279
  /**
253
280
  * Important capabilities this specific model supports (e.g. charging the
254
281
  * battery from grid, limiting the charge, or forcing a heat pump DHW boost).
@@ -277,6 +304,16 @@ export interface EnergyAppPackageCompatibilityVendor {
277
304
  * worse than listing none.
278
305
  */
279
306
  models: EnergyAppPackageCompatibilityModel[];
307
+ /**
308
+ * Whether this vendor is supported or explicitly unsupported.
309
+ *
310
+ * Defaults to {@link EnergyAppPackageCompatibilityStatus.Compatible} when
311
+ * omitted. Set it to
312
+ * {@link EnergyAppPackageCompatibilityStatus.NotCompatible} to declare a
313
+ * brand the package is known not to work with; individual models may still
314
+ * override it with their own {@link EnergyAppPackageCompatibilityModel.status}.
315
+ */
316
+ status?: EnergyAppPackageCompatibilityStatus;
280
317
  /**
281
318
  * Marks this package as the default Energy App for the vendor when no
282
319
  * concrete model has been selected.
@@ -24,6 +24,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
24
24
  exports.FirmwareRegistryValidationError = void 0;
25
25
  exports.validateFirmwareRegistry = validateFirmwareRegistry;
26
26
  exports.assertValidFirmwareRegistry = assertValidFirmwareRegistry;
27
+ const energy_app_package_definition_js_1 = require("../../energy-app-package-definition.cjs");
27
28
  const energy_app_permission_type_js_1 = require("../../energy-app-permission.type.cjs");
28
29
  const define_firmware_file_js_1 = require("./define-firmware-file.cjs");
29
30
  /**
@@ -269,11 +270,12 @@ function findDanglingSources(files) {
269
270
  }
270
271
  /**
271
272
  * Reports vendors and models referenced by firmware entries that the package
272
- * does not declare in its `compatibility` list.
273
+ * does not declare in its `compatibility` list, or that it declares as
274
+ * {@link EnergyAppPackageCompatibilityStatus.NotCompatible}.
273
275
  *
274
276
  * @param files - All declared firmware entries.
275
277
  * @param compatibility - The package's declared vendors and models.
276
- * @returns One warning per unknown vendor or model.
278
+ * @returns One warning per unknown or explicitly incompatible vendor or model.
277
279
  */
278
280
  function findUnknownCompatibility(files, compatibility) {
279
281
  const warnings = [];
@@ -281,15 +283,27 @@ function findUnknownCompatibility(files, compatibility) {
281
283
  return warnings;
282
284
  const vendors = new Set(compatibility.map(vendor => vendor.vendorName));
283
285
  const models = new Set(compatibility.flatMap(vendor => vendor.models.map(model => model.modelName)));
286
+ const incompatibleVendors = new Set(compatibility
287
+ .filter(vendor => vendor.status === energy_app_package_definition_js_1.EnergyAppPackageCompatibilityStatus.NotCompatible)
288
+ .map(vendor => vendor.vendorName));
289
+ const incompatibleModels = new Set(compatibility.flatMap(vendor => vendor.models
290
+ .filter(model => model.status === energy_app_package_definition_js_1.EnergyAppPackageCompatibilityStatus.NotCompatible)
291
+ .map(model => model.modelName)));
284
292
  for (const [index, file] of files.entries()) {
285
293
  const at = describe(file, index);
286
294
  if (file.vendorName && !vendors.has(file.vendorName)) {
287
295
  warnings.push(`${at}: vendorName "${file.vendorName}" is not listed in compatibility.`);
288
296
  }
297
+ else if (file.vendorName && incompatibleVendors.has(file.vendorName)) {
298
+ warnings.push(`${at}: vendorName "${file.vendorName}" is declared as not-compatible.`);
299
+ }
289
300
  for (const model of file.modelNames ?? []) {
290
301
  if (!models.has(model)) {
291
302
  warnings.push(`${at}: modelName "${model}" is not listed in compatibility.`);
292
303
  }
304
+ else if (incompatibleModels.has(model)) {
305
+ warnings.push(`${at}: modelName "${model}" is declared as not-compatible.`);
306
+ }
293
307
  }
294
308
  }
295
309
  return warnings;
@@ -28,6 +28,21 @@ export interface ModbusRtuOptions {
28
28
  */
29
29
  waitBetweenMessagesMs?: number;
30
30
  }
31
+ /**
32
+ * Which register bank an RTU read addresses, and therefore which Modbus
33
+ * function code goes on the wire.
34
+ *
35
+ * Holding and input registers are two separate address spaces: a device may
36
+ * answer register 30001 as an input register and hold something entirely
37
+ * different — or nothing at all — at the same address in the holding bank.
38
+ * Reading the wrong bank yields an illegal-data-address exception, not a
39
+ * timeout, so this is a correctness knob rather than a recovery one.
40
+ */
41
+ export type ModbusRtuRegisterType =
42
+ /** Holding registers, read with function code 3 (`mbpoll -t 4`). */
43
+ 'holding'
44
+ /** Input registers, read with function code 4 (`mbpoll -t 3`). */
45
+ | 'input';
31
46
  /**
32
47
  * Request parameters for reading Modbus RTU registers.
33
48
  */
@@ -38,6 +53,14 @@ export interface ModbusRtuReadRegistersRequest {
38
53
  startRegister: number;
39
54
  /** Number of consecutive registers to read */
40
55
  count: number;
56
+ /**
57
+ * Which register bank to read from.
58
+ *
59
+ * `'holding'` issues function code 3 and `'input'` issues function code 4.
60
+ * Defaults to `'holding'` when omitted, which is what every existing caller
61
+ * gets today.
62
+ */
63
+ registerType?: ModbusRtuRegisterType;
41
64
  }
42
65
  /**
43
66
  * Response containing register values read from a Modbus RTU device.
@@ -63,9 +86,15 @@ export interface ModbusRtuWriteRegistersRequest {
63
86
  * Provides methods for reading and writing registers over a serial connection.
64
87
  */
65
88
  export interface EnergyAppModbusRtuInstance {
66
- /** Read register values from the connected Modbus RTU device */
89
+ /**
90
+ * Read register values from the connected Modbus RTU device.
91
+ *
92
+ * Reads holding registers (function code 3) unless the request sets
93
+ * {@link ModbusRtuReadRegistersRequest.registerType} to `'input'`, which
94
+ * reads input registers with function code 4 instead.
95
+ */
67
96
  readRegisters: (request: ModbusRtuReadRegistersRequest) => Promise<ModbusRtuReadRegistersResponse>;
68
- /** Write register values to the connected Modbus RTU device */
97
+ /** Write register values to the connected Modbus RTU device (holding registers only) */
69
98
  writeRegisters: (request: ModbusRtuWriteRegistersRequest) => Promise<void>;
70
99
  }
71
100
  /**
@@ -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 = '1.21.0';
12
+ exports.SDK_VERSION = '1.22.0';
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 = "1.21.0";
8
+ export declare const SDK_VERSION = "1.22.0";
9
9
  /**
10
10
  * Gets the current SDK version.
11
11
  * @returns The semantic version string of the SDK
@@ -213,6 +213,23 @@ export interface EnergyAppPackagePermission {
213
213
  /** Internal documentation describing what this permission is used for */
214
214
  internalComment: string;
215
215
  }
216
+ /**
217
+ * Whether a declared compatibility entry means "this works" or "this is known
218
+ * not to work".
219
+ *
220
+ * Used by {@link EnergyAppPackageCompatibilityVendor.status} and
221
+ * {@link EnergyAppPackageCompatibilityModel.status} so a package can
222
+ * list a vendor or model it has explicitly tested and found unsupported,
223
+ * instead of silently leaving it out. The enyo Store and onboarding flows can
224
+ * then tell the user "this device is not supported by this app" rather than
225
+ * showing nothing at all.
226
+ */
227
+ export declare enum EnergyAppPackageCompatibilityStatus {
228
+ /** The package supports this vendor or model. */
229
+ Compatible = "compatible",
230
+ /** The package has been verified **not** to work with this vendor or model. */
231
+ NotCompatible = "not-compatible"
232
+ }
216
233
  /**
217
234
  * A specific device model supported by an Energy App package.
218
235
  * the concrete models the package has been verified to work with.
@@ -249,6 +266,16 @@ export interface EnergyAppPackageCompatibilityModel {
249
266
  category?: EnergyAppPackageCategory;
250
267
  /** Optional internal note explaining model-specific caveats or limitations */
251
268
  internalComment?: string;
269
+ /**
270
+ * Whether this model is supported or explicitly unsupported.
271
+ *
272
+ * Defaults to {@link EnergyAppPackageCompatibilityStatus.Compatible} when
273
+ * omitted, so existing definitions keep their meaning. Set it to
274
+ * {@link EnergyAppPackageCompatibilityStatus.NotCompatible} to document a
275
+ * model you have tested and found not to work — use
276
+ * {@link internalComment} to say why.
277
+ */
278
+ status?: EnergyAppPackageCompatibilityStatus;
252
279
  /**
253
280
  * Important capabilities this specific model supports (e.g. charging the
254
281
  * battery from grid, limiting the charge, or forcing a heat pump DHW boost).
@@ -277,6 +304,16 @@ export interface EnergyAppPackageCompatibilityVendor {
277
304
  * worse than listing none.
278
305
  */
279
306
  models: EnergyAppPackageCompatibilityModel[];
307
+ /**
308
+ * Whether this vendor is supported or explicitly unsupported.
309
+ *
310
+ * Defaults to {@link EnergyAppPackageCompatibilityStatus.Compatible} when
311
+ * omitted. Set it to
312
+ * {@link EnergyAppPackageCompatibilityStatus.NotCompatible} to declare a
313
+ * brand the package is known not to work with; individual models may still
314
+ * override it with their own {@link EnergyAppPackageCompatibilityModel.status}.
315
+ */
316
+ status?: EnergyAppPackageCompatibilityStatus;
280
317
  /**
281
318
  * Marks this package as the default Energy App for the vendor when no
282
319
  * concrete model has been selected.
@@ -23,6 +23,24 @@ export var EnergyAppPackageCategory;
23
23
  EnergyAppPackageCategory["Vehicle"] = "vehicle";
24
24
  EnergyAppPackageCategory["Other"] = "other";
25
25
  })(EnergyAppPackageCategory || (EnergyAppPackageCategory = {}));
26
+ /**
27
+ * Whether a declared compatibility entry means "this works" or "this is known
28
+ * not to work".
29
+ *
30
+ * Used by {@link EnergyAppPackageCompatibilityVendor.status} and
31
+ * {@link EnergyAppPackageCompatibilityModel.status} so a package can
32
+ * list a vendor or model it has explicitly tested and found unsupported,
33
+ * instead of silently leaving it out. The enyo Store and onboarding flows can
34
+ * then tell the user "this device is not supported by this app" rather than
35
+ * showing nothing at all.
36
+ */
37
+ export var EnergyAppPackageCompatibilityStatus;
38
+ (function (EnergyAppPackageCompatibilityStatus) {
39
+ /** The package supports this vendor or model. */
40
+ EnergyAppPackageCompatibilityStatus["Compatible"] = "compatible";
41
+ /** The package has been verified **not** to work with this vendor or model. */
42
+ EnergyAppPackageCompatibilityStatus["NotCompatible"] = "not-compatible";
43
+ })(EnergyAppPackageCompatibilityStatus || (EnergyAppPackageCompatibilityStatus = {}));
26
44
  /**
27
45
  * Enum form of {@link EnergyAppPackageFirmwareMode} for use in package
28
46
  * definitions.
@@ -19,6 +19,7 @@
19
19
  * Use {@link validateFirmwareRegistry} for the non-throwing result, or
20
20
  * {@link assertValidFirmwareRegistry} to throw on failure.
21
21
  */
22
+ import { EnergyAppPackageCompatibilityStatus } from '../../energy-app-package-definition.js';
22
23
  import { EnergyAppPermissionTypeEnum } from '../../energy-app-permission.type.js';
23
24
  import { resolveNextFirmware } from './define-firmware-file.js';
24
25
  /**
@@ -263,11 +264,12 @@ function findDanglingSources(files) {
263
264
  }
264
265
  /**
265
266
  * Reports vendors and models referenced by firmware entries that the package
266
- * does not declare in its `compatibility` list.
267
+ * does not declare in its `compatibility` list, or that it declares as
268
+ * {@link EnergyAppPackageCompatibilityStatus.NotCompatible}.
267
269
  *
268
270
  * @param files - All declared firmware entries.
269
271
  * @param compatibility - The package's declared vendors and models.
270
- * @returns One warning per unknown vendor or model.
272
+ * @returns One warning per unknown or explicitly incompatible vendor or model.
271
273
  */
272
274
  function findUnknownCompatibility(files, compatibility) {
273
275
  const warnings = [];
@@ -275,15 +277,27 @@ function findUnknownCompatibility(files, compatibility) {
275
277
  return warnings;
276
278
  const vendors = new Set(compatibility.map(vendor => vendor.vendorName));
277
279
  const models = new Set(compatibility.flatMap(vendor => vendor.models.map(model => model.modelName)));
280
+ const incompatibleVendors = new Set(compatibility
281
+ .filter(vendor => vendor.status === EnergyAppPackageCompatibilityStatus.NotCompatible)
282
+ .map(vendor => vendor.vendorName));
283
+ const incompatibleModels = new Set(compatibility.flatMap(vendor => vendor.models
284
+ .filter(model => model.status === EnergyAppPackageCompatibilityStatus.NotCompatible)
285
+ .map(model => model.modelName)));
278
286
  for (const [index, file] of files.entries()) {
279
287
  const at = describe(file, index);
280
288
  if (file.vendorName && !vendors.has(file.vendorName)) {
281
289
  warnings.push(`${at}: vendorName "${file.vendorName}" is not listed in compatibility.`);
282
290
  }
291
+ else if (file.vendorName && incompatibleVendors.has(file.vendorName)) {
292
+ warnings.push(`${at}: vendorName "${file.vendorName}" is declared as not-compatible.`);
293
+ }
283
294
  for (const model of file.modelNames ?? []) {
284
295
  if (!models.has(model)) {
285
296
  warnings.push(`${at}: modelName "${model}" is not listed in compatibility.`);
286
297
  }
298
+ else if (incompatibleModels.has(model)) {
299
+ warnings.push(`${at}: modelName "${model}" is declared as not-compatible.`);
300
+ }
287
301
  }
288
302
  }
289
303
  return warnings;
@@ -28,6 +28,21 @@ export interface ModbusRtuOptions {
28
28
  */
29
29
  waitBetweenMessagesMs?: number;
30
30
  }
31
+ /**
32
+ * Which register bank an RTU read addresses, and therefore which Modbus
33
+ * function code goes on the wire.
34
+ *
35
+ * Holding and input registers are two separate address spaces: a device may
36
+ * answer register 30001 as an input register and hold something entirely
37
+ * different — or nothing at all — at the same address in the holding bank.
38
+ * Reading the wrong bank yields an illegal-data-address exception, not a
39
+ * timeout, so this is a correctness knob rather than a recovery one.
40
+ */
41
+ export type ModbusRtuRegisterType =
42
+ /** Holding registers, read with function code 3 (`mbpoll -t 4`). */
43
+ 'holding'
44
+ /** Input registers, read with function code 4 (`mbpoll -t 3`). */
45
+ | 'input';
31
46
  /**
32
47
  * Request parameters for reading Modbus RTU registers.
33
48
  */
@@ -38,6 +53,14 @@ export interface ModbusRtuReadRegistersRequest {
38
53
  startRegister: number;
39
54
  /** Number of consecutive registers to read */
40
55
  count: number;
56
+ /**
57
+ * Which register bank to read from.
58
+ *
59
+ * `'holding'` issues function code 3 and `'input'` issues function code 4.
60
+ * Defaults to `'holding'` when omitted, which is what every existing caller
61
+ * gets today.
62
+ */
63
+ registerType?: ModbusRtuRegisterType;
41
64
  }
42
65
  /**
43
66
  * Response containing register values read from a Modbus RTU device.
@@ -63,9 +86,15 @@ export interface ModbusRtuWriteRegistersRequest {
63
86
  * Provides methods for reading and writing registers over a serial connection.
64
87
  */
65
88
  export interface EnergyAppModbusRtuInstance {
66
- /** Read register values from the connected Modbus RTU device */
89
+ /**
90
+ * Read register values from the connected Modbus RTU device.
91
+ *
92
+ * Reads holding registers (function code 3) unless the request sets
93
+ * {@link ModbusRtuReadRegistersRequest.registerType} to `'input'`, which
94
+ * reads input registers with function code 4 instead.
95
+ */
67
96
  readRegisters: (request: ModbusRtuReadRegistersRequest) => Promise<ModbusRtuReadRegistersResponse>;
68
- /** Write register values to the connected Modbus RTU device */
97
+ /** Write register values to the connected Modbus RTU device (holding registers only) */
69
98
  writeRegisters: (request: ModbusRtuWriteRegistersRequest) => Promise<void>;
70
99
  }
71
100
  /**
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 = "1.21.0";
8
+ export declare const SDK_VERSION = "1.22.0";
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 = '1.21.0';
8
+ export const SDK_VERSION = '1.22.0';
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": "1.21.0",
3
+ "version": "1.22.0",
4
4
  "description": "enyo Energy App SDK",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",