@zwave-js/config 14.0.0-beta.1 → 14.0.0-beta.4
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/build/{ConfigManager.d.ts → cjs/ConfigManager.d.ts} +2 -2
- package/build/cjs/ConfigManager.js +208 -0
- package/build/cjs/ConfigManager.js.map +7 -0
- package/build/cjs/JsonTemplate.js +198 -0
- package/build/cjs/JsonTemplate.js.map +7 -0
- package/build/{Logger.d.ts → cjs/Logger.d.ts} +1 -1
- package/build/cjs/Logger.js +50 -0
- package/build/cjs/Logger.js.map +7 -0
- package/build/cjs/Logger_safe.js +32 -0
- package/build/cjs/Logger_safe.js.map +7 -0
- package/build/cjs/Logic.js +71 -0
- package/build/cjs/Logic.js.map +7 -0
- package/build/cjs/LogicParser.js +1343 -0
- package/build/cjs/LogicParser.js.map +7 -0
- package/build/cjs/Manufacturers.js +88 -0
- package/build/cjs/Manufacturers.js.map +7 -0
- package/build/cjs/_version.d.ts +2 -0
- package/build/cjs/_version.js +29 -0
- package/build/cjs/_version.js.map +7 -0
- package/build/{devices → cjs/devices}/AssociationConfig.d.ts +2 -2
- package/build/cjs/devices/AssociationConfig.js +93 -0
- package/build/cjs/devices/AssociationConfig.js.map +7 -0
- package/build/{devices → cjs/devices}/CompatConfig.d.ts +2 -2
- package/build/cjs/devices/CompatConfig.js +584 -0
- package/build/cjs/devices/CompatConfig.js.map +7 -0
- package/build/{devices → cjs/devices}/ConditionalItem.d.ts +1 -1
- package/build/cjs/devices/ConditionalItem.js +107 -0
- package/build/cjs/devices/ConditionalItem.js.map +7 -0
- package/build/{devices → cjs/devices}/ConditionalPrimitive.d.ts +2 -2
- package/build/cjs/devices/ConditionalPrimitive.js +59 -0
- package/build/cjs/devices/ConditionalPrimitive.js.map +7 -0
- package/build/{devices → cjs/devices}/DeviceConfig.d.ts +7 -7
- package/build/cjs/devices/DeviceConfig.js +502 -0
- package/build/cjs/devices/DeviceConfig.js.map +7 -0
- package/build/cjs/devices/DeviceConfig.unit._test.js +17 -0
- package/build/cjs/devices/DeviceConfig.unit._test.js.map +7 -0
- package/build/{devices → cjs/devices}/DeviceMetadata.d.ts +3 -3
- package/build/cjs/devices/DeviceMetadata.js +112 -0
- package/build/cjs/devices/DeviceMetadata.js.map +7 -0
- package/build/{devices → cjs/devices}/EndpointConfig.d.ts +5 -5
- package/build/cjs/devices/EndpointConfig.js +87 -0
- package/build/cjs/devices/EndpointConfig.js.map +7 -0
- package/build/{devices → cjs/devices}/ParamInformation.d.ts +3 -3
- package/build/cjs/devices/ParamInformation.js +209 -0
- package/build/cjs/devices/ParamInformation.js.map +7 -0
- package/build/cjs/devices/shared.js +17 -0
- package/build/cjs/devices/shared.js.map +7 -0
- package/build/cjs/index.d.ts +13 -0
- package/build/cjs/index.js +53 -0
- package/build/cjs/index.js.map +7 -0
- package/build/cjs/index_safe.d.ts +3 -0
- package/build/cjs/index_safe.js +32 -0
- package/build/cjs/index_safe.js.map +7 -0
- package/build/cjs/package.json +3 -0
- package/build/{utils.d.ts → cjs/utils.d.ts} +2 -2
- package/build/cjs/utils.js +117 -0
- package/build/cjs/utils.js.map +7 -0
- package/build/cjs/utils_safe.js +57 -0
- package/build/cjs/utils_safe.js.map +7 -0
- package/build/esm/ConfigManager.d.ts +57 -0
- package/build/esm/ConfigManager.d.ts.map +1 -0
- package/build/{ConfigManager.js → esm/ConfigManager.js} +36 -43
- package/build/esm/ConfigManager.js.map +1 -0
- package/build/esm/JsonTemplate.d.ts +4 -0
- package/build/esm/JsonTemplate.d.ts.map +1 -0
- package/build/{JsonTemplate.js → esm/JsonTemplate.js} +30 -60
- package/build/esm/JsonTemplate.js.map +1 -0
- package/build/esm/Logger.d.ts +11 -0
- package/build/esm/Logger.d.ts.map +1 -0
- package/build/esm/Logger.js +23 -0
- package/build/esm/Logger.js.map +1 -0
- package/build/esm/Logger_safe.d.ts +5 -0
- package/build/esm/Logger_safe.d.ts.map +1 -0
- package/build/esm/Logger_safe.js +3 -0
- package/build/esm/Logger_safe.js.map +1 -0
- package/build/esm/Logic.d.ts +4 -0
- package/build/esm/Logic.d.ts.map +1 -0
- package/build/esm/Logic.js +35 -0
- package/build/esm/Logic.js.map +1 -0
- package/build/esm/LogicParser.d.ts +93 -0
- package/build/esm/LogicParser.d.ts.map +1 -0
- package/build/{LogicParser.js → esm/LogicParser.js} +2 -5
- package/build/{LogicParser.js.map → esm/LogicParser.js.map} +1 -1
- package/build/esm/Manufacturers.d.ts +6 -0
- package/build/esm/Manufacturers.d.ts.map +1 -0
- package/build/esm/Manufacturers.js +55 -0
- package/build/esm/Manufacturers.js.map +1 -0
- package/build/esm/_version.d.ts +2 -0
- package/build/esm/_version.d.ts.map +1 -0
- package/build/esm/_version.js +3 -0
- package/build/esm/_version.js.map +1 -0
- package/build/esm/devices/AssociationConfig.d.ts +27 -0
- package/build/esm/devices/AssociationConfig.d.ts.map +1 -0
- package/build/{devices → esm/devices}/AssociationConfig.js +12 -16
- package/build/esm/devices/AssociationConfig.js.map +1 -0
- package/build/esm/devices/CompatConfig.d.ts +112 -0
- package/build/esm/devices/CompatConfig.d.ts.map +1 -0
- package/build/{devices → esm/devices}/CompatConfig.js +112 -119
- package/build/esm/devices/CompatConfig.js.map +1 -0
- package/build/esm/devices/ConditionalItem.d.ts +14 -0
- package/build/esm/devices/ConditionalItem.d.ts.map +1 -0
- package/build/{devices → esm/devices}/ConditionalItem.js +15 -21
- package/build/esm/devices/ConditionalItem.js.map +1 -0
- package/build/esm/devices/ConditionalPrimitive.d.ts +13 -0
- package/build/esm/devices/ConditionalPrimitive.d.ts.map +1 -0
- package/build/esm/devices/ConditionalPrimitive.js +35 -0
- package/build/esm/devices/ConditionalPrimitive.js.map +1 -0
- package/build/esm/devices/DeviceConfig.d.ts +117 -0
- package/build/esm/devices/DeviceConfig.d.ts.map +1 -0
- package/build/{devices → esm/devices}/DeviceConfig.js +96 -108
- package/build/esm/devices/DeviceConfig.js.map +1 -0
- package/build/esm/devices/DeviceConfig.unit._test.d.ts +2 -0
- package/build/esm/devices/DeviceConfig.unit._test.d.ts.map +1 -0
- package/build/{devices → esm/devices}/DeviceConfig.unit._test.js +1 -2
- package/build/esm/devices/DeviceConfig.unit._test.js.map +1 -0
- package/build/esm/devices/DeviceMetadata.d.ts +41 -0
- package/build/esm/devices/DeviceMetadata.d.ts.map +1 -0
- package/build/{devices → esm/devices}/DeviceMetadata.js +16 -21
- package/build/esm/devices/DeviceMetadata.js.map +1 -0
- package/build/esm/devices/EndpointConfig.d.ts +20 -0
- package/build/esm/devices/EndpointConfig.d.ts.map +1 -0
- package/build/esm/devices/EndpointConfig.js +60 -0
- package/build/esm/devices/EndpointConfig.js.map +1 -0
- package/build/esm/devices/ParamInformation.d.ts +50 -0
- package/build/esm/devices/ParamInformation.d.ts.map +1 -0
- package/build/{devices → esm/devices}/ParamInformation.js +38 -44
- package/build/esm/devices/ParamInformation.js.map +1 -0
- package/build/esm/devices/shared.d.ts +11 -0
- package/build/esm/devices/shared.d.ts.map +1 -0
- package/build/esm/devices/shared.js +2 -0
- package/build/{devices → esm/devices}/shared.js.map +1 -1
- package/build/esm/index.d.ts +13 -0
- package/build/esm/index.d.ts.map +1 -0
- package/build/esm/index.js +14 -0
- package/build/esm/index.js.map +1 -0
- package/build/esm/index_safe.d.ts +3 -0
- package/build/esm/index_safe.d.ts.map +1 -0
- package/build/esm/index_safe.js +4 -0
- package/build/esm/index_safe.js.map +1 -0
- package/build/esm/package.json +3 -0
- package/build/esm/utils.d.ts +19 -0
- package/build/esm/utils.d.ts.map +1 -0
- package/build/esm/utils.js +93 -0
- package/build/esm/utils.js.map +1 -0
- package/build/esm/utils_safe.d.ts +7 -0
- package/build/esm/utils_safe.d.ts.map +1 -0
- package/build/esm/utils_safe.js +28 -0
- package/build/esm/utils_safe.js.map +1 -0
- package/package.json +22 -19
- package/build/ConfigManager.d.ts.map +0 -1
- package/build/ConfigManager.js.map +0 -1
- package/build/JsonTemplate.d.ts.map +0 -1
- package/build/JsonTemplate.js.map +0 -1
- package/build/Logger.d.ts.map +0 -1
- package/build/Logger.js +0 -27
- package/build/Logger.js.map +0 -1
- package/build/Logger_safe.d.ts.map +0 -1
- package/build/Logger_safe.js +0 -6
- package/build/Logger_safe.js.map +0 -1
- package/build/Logic.d.ts.map +0 -1
- package/build/Logic.js +0 -60
- package/build/Logic.js.map +0 -1
- package/build/LogicParser.d.ts.map +0 -1
- package/build/Manufacturers.d.ts.map +0 -1
- package/build/Manufacturers.js +0 -62
- package/build/Manufacturers.js.map +0 -1
- package/build/_version.d.ts +0 -2
- package/build/_version.d.ts.map +0 -1
- package/build/_version.js +0 -6
- package/build/_version.js.map +0 -1
- package/build/devices/AssociationConfig.d.ts.map +0 -1
- package/build/devices/AssociationConfig.js.map +0 -1
- package/build/devices/CompatConfig.d.ts.map +0 -1
- package/build/devices/CompatConfig.js.map +0 -1
- package/build/devices/ConditionalItem.d.ts.map +0 -1
- package/build/devices/ConditionalItem.js.map +0 -1
- package/build/devices/ConditionalPrimitive.d.ts.map +0 -1
- package/build/devices/ConditionalPrimitive.js +0 -40
- package/build/devices/ConditionalPrimitive.js.map +0 -1
- package/build/devices/DeviceConfig.d.ts.map +0 -1
- package/build/devices/DeviceConfig.js.map +0 -1
- package/build/devices/DeviceConfig.unit._test.d.ts.map +0 -1
- package/build/devices/DeviceConfig.unit._test.js.map +0 -1
- package/build/devices/DeviceMetadata.d.ts.map +0 -1
- package/build/devices/DeviceMetadata.js.map +0 -1
- package/build/devices/EndpointConfig.d.ts.map +0 -1
- package/build/devices/EndpointConfig.js +0 -64
- package/build/devices/EndpointConfig.js.map +0 -1
- package/build/devices/ParamInformation.d.ts.map +0 -1
- package/build/devices/ParamInformation.js.map +0 -1
- package/build/devices/shared.d.ts.map +0 -1
- package/build/devices/shared.js +0 -3
- package/build/index.d.ts +0 -13
- package/build/index.d.ts.map +0 -1
- package/build/index.js +0 -33
- package/build/index.js.map +0 -1
- package/build/index_safe.d.ts +0 -3
- package/build/index_safe.d.ts.map +0 -1
- package/build/index_safe.js +0 -22
- package/build/index_safe.js.map +0 -1
- package/build/utils.d.ts.map +0 -1
- package/build/utils.js +0 -124
- package/build/utils.js.map +0 -1
- package/build/utils_safe.d.ts.map +0 -1
- package/build/utils_safe.js +0 -33
- package/build/utils_safe.js.map +0 -1
- /package/build/{JsonTemplate.d.ts → cjs/JsonTemplate.d.ts} +0 -0
- /package/build/{Logger_safe.d.ts → cjs/Logger_safe.d.ts} +0 -0
- /package/build/{Logic.d.ts → cjs/Logic.d.ts} +0 -0
- /package/build/{LogicParser.d.ts → cjs/LogicParser.d.ts} +0 -0
- /package/build/{Manufacturers.d.ts → cjs/Manufacturers.d.ts} +0 -0
- /package/build/{devices → cjs/devices}/DeviceConfig.unit._test.d.ts +0 -0
- /package/build/{devices → cjs/devices}/shared.d.ts +0 -0
- /package/build/{utils_safe.d.ts → cjs/utils_safe.d.ts} +0 -0
|
@@ -0,0 +1,584 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var CompatConfig_exports = {};
|
|
20
|
+
__export(CompatConfig_exports, {
|
|
21
|
+
CompatAddCC: () => CompatAddCC,
|
|
22
|
+
CompatMapAlarm: () => CompatMapAlarm,
|
|
23
|
+
CompatOverrideQueries: () => CompatOverrideQueries,
|
|
24
|
+
ConditionalCompatConfig: () => ConditionalCompatConfig
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(CompatConfig_exports);
|
|
27
|
+
var import_safe = require("@zwave-js/core/safe");
|
|
28
|
+
var import_safe2 = require("@zwave-js/shared/safe");
|
|
29
|
+
var import_typeguards = require("alcalzone-shared/typeguards/index.js");
|
|
30
|
+
var import_utils_safe = require("../utils_safe.js");
|
|
31
|
+
var import_ConditionalItem = require("./ConditionalItem.js");
|
|
32
|
+
class ConditionalCompatConfig {
|
|
33
|
+
valueIdRegex = /^\$value\$\[.+\]$/;
|
|
34
|
+
constructor(filename, definition) {
|
|
35
|
+
this.condition = definition.$if;
|
|
36
|
+
if (definition.queryOnWakeup != void 0) {
|
|
37
|
+
if (!(0, import_typeguards.isArray)(definition.queryOnWakeup) || !definition.queryOnWakeup.every((cmd) => (0, import_typeguards.isArray)(cmd) && cmd.length >= 2 && typeof cmd[0] === "string" && typeof cmd[1] === "string" && cmd.slice(2).every((arg) => typeof arg === "string" || typeof arg === "number" || typeof arg === "boolean"))) {
|
|
38
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
39
|
+
error in compat option queryOnWakeup`);
|
|
40
|
+
}
|
|
41
|
+
this.queryOnWakeup = definition.queryOnWakeup.map((cmd) => cmd.map((arg) => {
|
|
42
|
+
if (typeof arg === "string" && this.valueIdRegex.test(arg)) {
|
|
43
|
+
const tuple = JSON.parse(arg.slice("$value$".length));
|
|
44
|
+
return {
|
|
45
|
+
property: tuple[0],
|
|
46
|
+
propertyKey: tuple[1]
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
return arg;
|
|
50
|
+
}));
|
|
51
|
+
}
|
|
52
|
+
if (definition.disableAutoRefresh != void 0) {
|
|
53
|
+
if (definition.disableAutoRefresh !== true) {
|
|
54
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
55
|
+
compat option disableAutoRefresh must be true or omitted`);
|
|
56
|
+
}
|
|
57
|
+
this.disableAutoRefresh = definition.disableAutoRefresh;
|
|
58
|
+
}
|
|
59
|
+
if (definition.disableCallbackFunctionTypeCheck != void 0) {
|
|
60
|
+
if (!(0, import_typeguards.isArray)(definition.disableCallbackFunctionTypeCheck) || !definition.disableCallbackFunctionTypeCheck.every((d) => typeof d === "number" && d % 1 === 0 && d > 0)) {
|
|
61
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
62
|
+
when present, compat option disableCallbackFunctionTypeCheck msut be an array of positive integers`);
|
|
63
|
+
}
|
|
64
|
+
this.disableCallbackFunctionTypeCheck = definition.disableCallbackFunctionTypeCheck;
|
|
65
|
+
}
|
|
66
|
+
if (definition.disableStrictEntryControlDataValidation != void 0) {
|
|
67
|
+
if (definition.disableStrictEntryControlDataValidation !== true) {
|
|
68
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
69
|
+
compat option disableStrictEntryControlDataValidation must be true or omitted`);
|
|
70
|
+
}
|
|
71
|
+
this.disableStrictEntryControlDataValidation = definition.disableStrictEntryControlDataValidation;
|
|
72
|
+
}
|
|
73
|
+
if (definition.disableStrictMeasurementValidation != void 0) {
|
|
74
|
+
if (definition.disableStrictMeasurementValidation !== true) {
|
|
75
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
76
|
+
compat option disableStrictMeasurementValidation must be true or omitted`);
|
|
77
|
+
}
|
|
78
|
+
this.disableStrictMeasurementValidation = definition.disableStrictMeasurementValidation;
|
|
79
|
+
}
|
|
80
|
+
if (definition.encodeCCsUsingTargetVersion != void 0) {
|
|
81
|
+
if (definition.encodeCCsUsingTargetVersion !== true) {
|
|
82
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
83
|
+
compat option encodeCCsUsingTargetVersion must be true or omitted`);
|
|
84
|
+
}
|
|
85
|
+
this.encodeCCsUsingTargetVersion = definition.encodeCCsUsingTargetVersion;
|
|
86
|
+
}
|
|
87
|
+
if (definition.forceNotificationIdleReset != void 0) {
|
|
88
|
+
if (definition.forceNotificationIdleReset !== true) {
|
|
89
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
90
|
+
compat option forceNotificationIdleReset must be true or omitted`);
|
|
91
|
+
}
|
|
92
|
+
this.forceNotificationIdleReset = definition.forceNotificationIdleReset;
|
|
93
|
+
}
|
|
94
|
+
if (definition.forceSceneControllerGroupCount != void 0) {
|
|
95
|
+
if (typeof definition.forceSceneControllerGroupCount !== "number") {
|
|
96
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
97
|
+
compat option forceSceneControllerGroupCount must be a number!`);
|
|
98
|
+
}
|
|
99
|
+
if (definition.forceSceneControllerGroupCount < 0 || definition.forceSceneControllerGroupCount > 255) {
|
|
100
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
101
|
+
compat option forceSceneControllerGroupCount must be between 0 and 255!`);
|
|
102
|
+
}
|
|
103
|
+
this.forceSceneControllerGroupCount = definition.forceSceneControllerGroupCount;
|
|
104
|
+
}
|
|
105
|
+
if (definition.mapBasicReport != void 0) {
|
|
106
|
+
if (!isBasicReportMapping(definition.mapBasicReport)) {
|
|
107
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
108
|
+
compat option mapBasicReport contains an invalid value`);
|
|
109
|
+
}
|
|
110
|
+
this.mapBasicReport = definition.mapBasicReport;
|
|
111
|
+
}
|
|
112
|
+
if (definition.mapBasicSet != void 0) {
|
|
113
|
+
if (!isBasicSetMapping(definition.mapBasicSet)) {
|
|
114
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
115
|
+
compat option mapBasicSet contains an invalid value`);
|
|
116
|
+
}
|
|
117
|
+
this.mapBasicSet = definition.mapBasicSet;
|
|
118
|
+
}
|
|
119
|
+
if (definition.preserveRootApplicationCCValueIDs != void 0) {
|
|
120
|
+
if (definition.preserveRootApplicationCCValueIDs !== true) {
|
|
121
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
122
|
+
error in compat option preserveRootApplicationCCValueIDs`);
|
|
123
|
+
}
|
|
124
|
+
this.preserveRootApplicationCCValueIDs = definition.preserveRootApplicationCCValueIDs;
|
|
125
|
+
}
|
|
126
|
+
if (definition.preserveEndpoints != void 0) {
|
|
127
|
+
if (definition.preserveEndpoints !== "*" && !((0, import_typeguards.isArray)(definition.preserveEndpoints) && definition.preserveEndpoints.every((d) => typeof d === "number" && d % 1 === 0 && d > 0))) {
|
|
128
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
129
|
+
compat option preserveEndpoints must be "*" or an array of positive integers`);
|
|
130
|
+
}
|
|
131
|
+
this.preserveEndpoints = definition.preserveEndpoints;
|
|
132
|
+
}
|
|
133
|
+
if (definition.removeEndpoints != void 0) {
|
|
134
|
+
if (definition.removeEndpoints !== "*" && !((0, import_typeguards.isArray)(definition.removeEndpoints) && definition.removeEndpoints.every((d) => typeof d === "number" && d % 1 === 0 && d > 0))) {
|
|
135
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
136
|
+
compat option removeEndpoints must be "*" or an array of positive integers`);
|
|
137
|
+
}
|
|
138
|
+
this.removeEndpoints = definition.removeEndpoints;
|
|
139
|
+
}
|
|
140
|
+
if (definition.skipConfigurationNameQuery != void 0) {
|
|
141
|
+
if (definition.skipConfigurationNameQuery !== true) {
|
|
142
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
143
|
+
error in compat option skipConfigurationNameQuery`);
|
|
144
|
+
}
|
|
145
|
+
this.skipConfigurationNameQuery = definition.skipConfigurationNameQuery;
|
|
146
|
+
}
|
|
147
|
+
if (definition.skipConfigurationInfoQuery != void 0) {
|
|
148
|
+
if (definition.skipConfigurationInfoQuery !== true) {
|
|
149
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
150
|
+
error in compat option skipConfigurationInfoQuery`);
|
|
151
|
+
}
|
|
152
|
+
this.skipConfigurationInfoQuery = definition.skipConfigurationInfoQuery;
|
|
153
|
+
}
|
|
154
|
+
if (definition.treatMultilevelSwitchSetAsEvent != void 0) {
|
|
155
|
+
if (definition.treatMultilevelSwitchSetAsEvent !== true) {
|
|
156
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
157
|
+
error in compat option treatMultilevelSwitchSetAsEvent`);
|
|
158
|
+
}
|
|
159
|
+
this.treatMultilevelSwitchSetAsEvent = definition.treatMultilevelSwitchSetAsEvent;
|
|
160
|
+
}
|
|
161
|
+
if (definition.treatSetAsReport != void 0) {
|
|
162
|
+
if (!((0, import_typeguards.isArray)(definition.treatSetAsReport) && definition.treatSetAsReport.every((d) => typeof d === "string"))) {
|
|
163
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
164
|
+
compat option treatSetAsReport must be an array of strings`);
|
|
165
|
+
}
|
|
166
|
+
this.treatSetAsReport = new Set(definition.treatSetAsReport);
|
|
167
|
+
}
|
|
168
|
+
if (definition.treatDestinationEndpointAsSource != void 0) {
|
|
169
|
+
if (definition.treatDestinationEndpointAsSource !== true) {
|
|
170
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
171
|
+
error in compat option treatDestinationEndpointAsSource`);
|
|
172
|
+
}
|
|
173
|
+
this.treatDestinationEndpointAsSource = definition.treatDestinationEndpointAsSource;
|
|
174
|
+
}
|
|
175
|
+
if (definition.useUTCInTimeParametersCC != void 0) {
|
|
176
|
+
if (definition.useUTCInTimeParametersCC !== true) {
|
|
177
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
178
|
+
compat option useUTCInTimeParametersCC must be true or omitted`);
|
|
179
|
+
}
|
|
180
|
+
this.useUTCInTimeParametersCC = definition.useUTCInTimeParametersCC;
|
|
181
|
+
}
|
|
182
|
+
if (definition.manualValueRefreshDelayMs != void 0) {
|
|
183
|
+
if (typeof definition.manualValueRefreshDelayMs !== "number") {
|
|
184
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
185
|
+
compat option manualValueRefreshDelayMs must be a number!`);
|
|
186
|
+
}
|
|
187
|
+
if (definition.manualValueRefreshDelayMs % 1 !== 0 || definition.manualValueRefreshDelayMs < 0) {
|
|
188
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
189
|
+
compat option manualValueRefreshDelayMs must be a non-negative integer!`);
|
|
190
|
+
}
|
|
191
|
+
this.manualValueRefreshDelayMs = definition.manualValueRefreshDelayMs;
|
|
192
|
+
}
|
|
193
|
+
if (definition.reportTimeout != void 0) {
|
|
194
|
+
if (typeof definition.reportTimeout !== "number") {
|
|
195
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
196
|
+
compat option reportTimeout must be a number!`);
|
|
197
|
+
}
|
|
198
|
+
if (definition.reportTimeout % 1 !== 0 || definition.reportTimeout < 1e3 || definition.reportTimeout > 1e4) {
|
|
199
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
200
|
+
compat option reportTimeout must be an integer between 1000 and 10000!`);
|
|
201
|
+
}
|
|
202
|
+
this.reportTimeout = definition.reportTimeout;
|
|
203
|
+
}
|
|
204
|
+
if (definition.mapRootReportsToEndpoint != void 0) {
|
|
205
|
+
if (typeof definition.mapRootReportsToEndpoint !== "number") {
|
|
206
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
207
|
+
compat option mapRootReportsToEndpoint must be a number!`);
|
|
208
|
+
}
|
|
209
|
+
if (definition.mapRootReportsToEndpoint % 1 !== 0 || definition.mapRootReportsToEndpoint < 1) {
|
|
210
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
211
|
+
compat option mapRootReportsToEndpoint must be a positive integer!`);
|
|
212
|
+
}
|
|
213
|
+
this.mapRootReportsToEndpoint = definition.mapRootReportsToEndpoint;
|
|
214
|
+
}
|
|
215
|
+
if (definition.overrideFloatEncoding != void 0) {
|
|
216
|
+
if (!(0, import_typeguards.isObject)(definition.overrideFloatEncoding)) {
|
|
217
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
218
|
+
error in compat option overrideFloatEncoding`);
|
|
219
|
+
}
|
|
220
|
+
this.overrideFloatEncoding = {};
|
|
221
|
+
if ("precision" in definition.overrideFloatEncoding) {
|
|
222
|
+
if (typeof definition.overrideFloatEncoding.precision != "number") {
|
|
223
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
224
|
+
compat option overrideFloatEncoding.precision must be a number!`);
|
|
225
|
+
}
|
|
226
|
+
if (definition.overrideFloatEncoding.precision % 1 !== 0 || definition.overrideFloatEncoding.precision < 0) {
|
|
227
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
228
|
+
compat option overrideFloatEncoding.precision must be a positive integer!`);
|
|
229
|
+
}
|
|
230
|
+
this.overrideFloatEncoding.precision = definition.overrideFloatEncoding.precision;
|
|
231
|
+
}
|
|
232
|
+
if ("size" in definition.overrideFloatEncoding) {
|
|
233
|
+
if (typeof definition.overrideFloatEncoding.size != "number") {
|
|
234
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
235
|
+
compat option overrideFloatEncoding.size must be a number!`);
|
|
236
|
+
}
|
|
237
|
+
if (definition.overrideFloatEncoding.size % 1 !== 0 || definition.overrideFloatEncoding.size < 1 || definition.overrideFloatEncoding.size > 4) {
|
|
238
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
239
|
+
compat option overrideFloatEncoding.size must be an integer between 1 and 4!`);
|
|
240
|
+
}
|
|
241
|
+
this.overrideFloatEncoding.size = definition.overrideFloatEncoding.size;
|
|
242
|
+
}
|
|
243
|
+
if (Object.keys(this.overrideFloatEncoding).length === 0) {
|
|
244
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
245
|
+
error in compat option overrideFloatEncoding: size and/or precision must be specified!`);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
if (definition.commandClasses != void 0) {
|
|
249
|
+
if (!(0, import_typeguards.isObject)(definition.commandClasses)) {
|
|
250
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
251
|
+
error in compat option commandClasses`);
|
|
252
|
+
}
|
|
253
|
+
if (definition.commandClasses.add != void 0) {
|
|
254
|
+
if (!(0, import_typeguards.isObject)(definition.commandClasses.add)) {
|
|
255
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
256
|
+
error in compat option commandClasses.add`);
|
|
257
|
+
} else if (!Object.values(definition.commandClasses.add).every((v) => (0, import_typeguards.isObject)(v))) {
|
|
258
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
259
|
+
All values in compat option commandClasses.add must be objects`);
|
|
260
|
+
}
|
|
261
|
+
const addCCs = /* @__PURE__ */ new Map();
|
|
262
|
+
for (const [key, info] of Object.entries(definition.commandClasses.add)) {
|
|
263
|
+
const cc = (0, import_utils_safe.tryParseCCId)(key);
|
|
264
|
+
if (cc == void 0) {
|
|
265
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
266
|
+
Invalid Command Class "${key}" specified in compat option commandClasses.add!`);
|
|
267
|
+
}
|
|
268
|
+
addCCs.set(cc, new CompatAddCC(filename, info));
|
|
269
|
+
}
|
|
270
|
+
this.addCCs = addCCs;
|
|
271
|
+
}
|
|
272
|
+
if (definition.commandClasses.remove != void 0) {
|
|
273
|
+
if (!(0, import_typeguards.isObject)(definition.commandClasses.remove)) {
|
|
274
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
275
|
+
error in compat option commandClasses.remove`);
|
|
276
|
+
}
|
|
277
|
+
const removeCCs = /* @__PURE__ */ new Map();
|
|
278
|
+
for (const [key, info] of Object.entries(definition.commandClasses.remove)) {
|
|
279
|
+
const cc = (0, import_utils_safe.tryParseCCId)(key);
|
|
280
|
+
if (cc == void 0) {
|
|
281
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
282
|
+
Invalid Command Class "${key}" specified in compat option commandClasses.remove!`);
|
|
283
|
+
}
|
|
284
|
+
if ((0, import_typeguards.isObject)(info) && "endpoints" in info) {
|
|
285
|
+
if (info.endpoints === "*" || (0, import_typeguards.isArray)(info.endpoints) && info.endpoints.every((i) => typeof i === "number")) {
|
|
286
|
+
removeCCs.set(cc, info.endpoints);
|
|
287
|
+
} else {
|
|
288
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
289
|
+
Compat option commandClasses.remove has an invalid "endpoints" property. Only "*" and numeric arrays are allowed!`);
|
|
290
|
+
}
|
|
291
|
+
} else {
|
|
292
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
293
|
+
All values in compat option commandClasses.remove must be objects with an "endpoints" property!`);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
this.removeCCs = removeCCs;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
if (definition.alarmMapping != void 0) {
|
|
300
|
+
if (!(0, import_typeguards.isArray)(definition.alarmMapping) || !definition.alarmMapping.every((m) => (0, import_typeguards.isObject)(m))) {
|
|
301
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
302
|
+
compat option alarmMapping must be an array where all items are objects!`);
|
|
303
|
+
}
|
|
304
|
+
this.alarmMapping = definition.alarmMapping.map((m, i) => new CompatMapAlarm(filename, m, i + 1));
|
|
305
|
+
}
|
|
306
|
+
if (definition.overrideQueries != void 0) {
|
|
307
|
+
if (!(0, import_typeguards.isObject)(definition.overrideQueries)) {
|
|
308
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
309
|
+
compat option overrideQueries must be an object!`);
|
|
310
|
+
}
|
|
311
|
+
this.overrideQueries = new CompatOverrideQueries(filename, definition.overrideQueries);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
alarmMapping;
|
|
315
|
+
addCCs;
|
|
316
|
+
removeCCs;
|
|
317
|
+
disableAutoRefresh;
|
|
318
|
+
disableStrictEntryControlDataValidation;
|
|
319
|
+
disableStrictMeasurementValidation;
|
|
320
|
+
disableCallbackFunctionTypeCheck;
|
|
321
|
+
encodeCCsUsingTargetVersion;
|
|
322
|
+
forceNotificationIdleReset;
|
|
323
|
+
forceSceneControllerGroupCount;
|
|
324
|
+
manualValueRefreshDelayMs;
|
|
325
|
+
mapRootReportsToEndpoint;
|
|
326
|
+
mapBasicReport;
|
|
327
|
+
mapBasicSet;
|
|
328
|
+
overrideFloatEncoding;
|
|
329
|
+
overrideQueries;
|
|
330
|
+
preserveRootApplicationCCValueIDs;
|
|
331
|
+
preserveEndpoints;
|
|
332
|
+
removeEndpoints;
|
|
333
|
+
reportTimeout;
|
|
334
|
+
skipConfigurationNameQuery;
|
|
335
|
+
skipConfigurationInfoQuery;
|
|
336
|
+
treatMultilevelSwitchSetAsEvent;
|
|
337
|
+
treatSetAsReport;
|
|
338
|
+
treatDestinationEndpointAsSource;
|
|
339
|
+
useUTCInTimeParametersCC;
|
|
340
|
+
queryOnWakeup;
|
|
341
|
+
condition;
|
|
342
|
+
evaluateCondition(deviceId) {
|
|
343
|
+
if (!(0, import_ConditionalItem.conditionApplies)(this, deviceId))
|
|
344
|
+
return;
|
|
345
|
+
const ret = (0, import_safe2.pick)(this, [
|
|
346
|
+
"alarmMapping",
|
|
347
|
+
"addCCs",
|
|
348
|
+
"removeCCs",
|
|
349
|
+
"disableAutoRefresh",
|
|
350
|
+
"disableCallbackFunctionTypeCheck",
|
|
351
|
+
"disableStrictEntryControlDataValidation",
|
|
352
|
+
"disableStrictMeasurementValidation",
|
|
353
|
+
"encodeCCsUsingTargetVersion",
|
|
354
|
+
"forceNotificationIdleReset",
|
|
355
|
+
"forceSceneControllerGroupCount",
|
|
356
|
+
"manualValueRefreshDelayMs",
|
|
357
|
+
"mapBasicReport",
|
|
358
|
+
"mapBasicSet",
|
|
359
|
+
"mapRootReportsToEndpoint",
|
|
360
|
+
"overrideFloatEncoding",
|
|
361
|
+
"overrideQueries",
|
|
362
|
+
"reportTimeout",
|
|
363
|
+
"preserveRootApplicationCCValueIDs",
|
|
364
|
+
"preserveEndpoints",
|
|
365
|
+
"removeEndpoints",
|
|
366
|
+
"skipConfigurationNameQuery",
|
|
367
|
+
"skipConfigurationInfoQuery",
|
|
368
|
+
"treatMultilevelSwitchSetAsEvent",
|
|
369
|
+
"treatSetAsReport",
|
|
370
|
+
"treatDestinationEndpointAsSource",
|
|
371
|
+
"useUTCInTimeParametersCC",
|
|
372
|
+
"queryOnWakeup"
|
|
373
|
+
]);
|
|
374
|
+
return (0, import_safe.stripUndefined)(ret);
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
class CompatAddCC {
|
|
378
|
+
constructor(filename, definition) {
|
|
379
|
+
const endpoints = /* @__PURE__ */ new Map();
|
|
380
|
+
const parseEndpointInfo = (endpoint, info) => {
|
|
381
|
+
const parsed = {};
|
|
382
|
+
if (info.isSupported != void 0) {
|
|
383
|
+
if (typeof info.isSupported !== "boolean") {
|
|
384
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
385
|
+
Property isSupported in compat option commandClasses.add, endpoint ${endpoint} must be a boolean!`);
|
|
386
|
+
} else {
|
|
387
|
+
parsed.isSupported = info.isSupported;
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
if (info.isControlled != void 0) {
|
|
391
|
+
if (typeof info.isControlled !== "boolean") {
|
|
392
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
393
|
+
Property isControlled in compat option commandClasses.add, endpoint ${endpoint} must be a boolean!`);
|
|
394
|
+
} else {
|
|
395
|
+
parsed.isControlled = info.isControlled;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
if (info.secure != void 0) {
|
|
399
|
+
if (typeof info.secure !== "boolean") {
|
|
400
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
401
|
+
Property secure in compat option commandClasses.add, endpoint ${endpoint} must be a boolean!`);
|
|
402
|
+
} else {
|
|
403
|
+
parsed.secure = info.secure;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
if (info.version != void 0) {
|
|
407
|
+
if (typeof info.version !== "number") {
|
|
408
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
409
|
+
Property version in compat option commandClasses.add, endpoint ${endpoint} must be a number!`);
|
|
410
|
+
} else {
|
|
411
|
+
parsed.version = info.version;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
endpoints.set(endpoint, parsed);
|
|
415
|
+
};
|
|
416
|
+
if (definition.isSupported != void 0 || definition.isControlled != void 0 || definition.version != void 0 || definition.secure != void 0) {
|
|
417
|
+
parseEndpointInfo(0, definition);
|
|
418
|
+
}
|
|
419
|
+
if ((0, import_typeguards.isObject)(definition.endpoints)) {
|
|
420
|
+
if (!Object.keys(definition.endpoints).every((k) => /^\d+$/.test(k))) {
|
|
421
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
422
|
+
invalid endpoint index in compat option commandClasses.add`);
|
|
423
|
+
} else {
|
|
424
|
+
for (const [ep, info] of Object.entries(definition.endpoints)) {
|
|
425
|
+
parseEndpointInfo(parseInt(ep), info);
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
this.endpoints = endpoints;
|
|
430
|
+
}
|
|
431
|
+
endpoints;
|
|
432
|
+
}
|
|
433
|
+
class CompatMapAlarm {
|
|
434
|
+
constructor(filename, definition, index) {
|
|
435
|
+
if (!(0, import_typeguards.isObject)(definition.from)) {
|
|
436
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
437
|
+
error in compat option alarmMapping, mapping #${index}: property "from" must be an object!`);
|
|
438
|
+
} else {
|
|
439
|
+
if (typeof definition.from.alarmType !== "number") {
|
|
440
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
441
|
+
error in compat option alarmMapping, mapping #${index}: property "from.alarmType" must be a number!`);
|
|
442
|
+
}
|
|
443
|
+
if (definition.from.alarmLevel != void 0 && typeof definition.from.alarmLevel !== "number") {
|
|
444
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
445
|
+
error in compat option alarmMapping, mapping #${index}: if property "from.alarmLevel" is given, it must be a number!`);
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
if (!(0, import_typeguards.isObject)(definition.to)) {
|
|
449
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
450
|
+
error in compat option alarmMapping, mapping #${index}: property "to" must be an object!`);
|
|
451
|
+
} else {
|
|
452
|
+
if (typeof definition.to.notificationType !== "number") {
|
|
453
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
454
|
+
error in compat option alarmMapping, mapping #${index}: property "to.notificationType" must be a number!`);
|
|
455
|
+
}
|
|
456
|
+
if (typeof definition.to.notificationEvent !== "number") {
|
|
457
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
458
|
+
error in compat option alarmMapping, mapping #${index}: property "to.notificationEvent" must be a number!`);
|
|
459
|
+
}
|
|
460
|
+
if (definition.to.eventParameters != void 0) {
|
|
461
|
+
if (!(0, import_typeguards.isObject)(definition.to.eventParameters)) {
|
|
462
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
463
|
+
error in compat option alarmMapping, mapping #${index}: property "to.eventParameters" must be an object!`);
|
|
464
|
+
} else {
|
|
465
|
+
for (const [key, val] of Object.entries(definition.to.eventParameters)) {
|
|
466
|
+
if (typeof val !== "number" && val !== "alarmLevel") {
|
|
467
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
468
|
+
error in compat option alarmMapping, mapping #${index}: property "to.eventParameters.${key}" must be a number or the literal "alarmLevel"!`);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
this.from = (0, import_safe2.pick)(definition.from, ["alarmType", "alarmLevel"]);
|
|
475
|
+
this.to = (0, import_safe2.pick)(definition.to, [
|
|
476
|
+
"notificationType",
|
|
477
|
+
"notificationEvent",
|
|
478
|
+
"eventParameters"
|
|
479
|
+
]);
|
|
480
|
+
}
|
|
481
|
+
from;
|
|
482
|
+
to;
|
|
483
|
+
}
|
|
484
|
+
class CompatOverrideQueries {
|
|
485
|
+
constructor(filename, definition) {
|
|
486
|
+
const overrides = /* @__PURE__ */ new Map();
|
|
487
|
+
const parseOverride = (cc, info) => {
|
|
488
|
+
if (typeof info.method !== "string") {
|
|
489
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
490
|
+
Property "method" in compat option overrideQueries, CC ${(0, import_safe.getCCName)(cc)} must be a string!`);
|
|
491
|
+
} else if (info.matchArgs != void 0 && !(0, import_typeguards.isArray)(info.matchArgs)) {
|
|
492
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
493
|
+
Property "matchArgs" in compat option overrideQueries, CC ${(0, import_safe.getCCName)(cc)} must be an array!`);
|
|
494
|
+
} else if (!("result" in info)) {
|
|
495
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
496
|
+
Property "result" is missing in in compat option overrideQueries, CC ${(0, import_safe.getCCName)(cc)}!`);
|
|
497
|
+
} else if (info.endpoint != void 0 && typeof info.endpoint !== "number") {
|
|
498
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
499
|
+
Property "endpoint" in compat option overrideQueries, CC ${(0, import_safe.getCCName)(cc)} must be a number!`);
|
|
500
|
+
} else if (info.persistValues && !(0, import_typeguards.isObject)(info.persistValues)) {
|
|
501
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
502
|
+
Property "persistValues" in compat option overrideQueries, CC ${(0, import_safe.getCCName)(cc)} must be an object!`);
|
|
503
|
+
} else if (info.extendMetadata && !(0, import_typeguards.isObject)(info.extendMetadata)) {
|
|
504
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
505
|
+
Property "extendMetadata" in compat option overrideQueries, CC ${(0, import_safe.getCCName)(cc)} must be an object!`);
|
|
506
|
+
}
|
|
507
|
+
return {
|
|
508
|
+
endpoint: info.endpoint,
|
|
509
|
+
method: info.method,
|
|
510
|
+
matchArgs: info.matchArgs,
|
|
511
|
+
result: info.result,
|
|
512
|
+
persistValues: info.persistValues,
|
|
513
|
+
extendMetadata: info.extendMetadata
|
|
514
|
+
};
|
|
515
|
+
};
|
|
516
|
+
for (const [key, value] of Object.entries(definition)) {
|
|
517
|
+
const cc = (0, import_utils_safe.tryParseCCId)(key);
|
|
518
|
+
if (cc == void 0) {
|
|
519
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
520
|
+
Invalid Command Class "${key}" specified in compat option overrideQueries!`);
|
|
521
|
+
}
|
|
522
|
+
let overrideDefinitions;
|
|
523
|
+
if ((0, import_typeguards.isObject)(value)) {
|
|
524
|
+
overrideDefinitions = [value];
|
|
525
|
+
} else if (!(0, import_typeguards.isArray)(value)) {
|
|
526
|
+
(0, import_utils_safe.throwInvalidConfig)("devices", `config/devices/${filename}:
|
|
527
|
+
Property "${key}" in compat option overrideQueries must be a single override object or an array thereof!`);
|
|
528
|
+
} else {
|
|
529
|
+
overrideDefinitions = value;
|
|
530
|
+
}
|
|
531
|
+
overrides.set(cc, overrideDefinitions.map((info) => parseOverride(cc, info)));
|
|
532
|
+
}
|
|
533
|
+
this.overrides = overrides;
|
|
534
|
+
}
|
|
535
|
+
// CC -> endpoint -> queries
|
|
536
|
+
overrides;
|
|
537
|
+
hasOverride(ccId) {
|
|
538
|
+
return this.overrides.has(ccId);
|
|
539
|
+
}
|
|
540
|
+
matchOverride(cc, endpointIndex, method, args) {
|
|
541
|
+
const queries = this.overrides.get(cc);
|
|
542
|
+
if (!queries)
|
|
543
|
+
return void 0;
|
|
544
|
+
for (const query of queries) {
|
|
545
|
+
if ((query.endpoint ?? 0) !== endpointIndex)
|
|
546
|
+
continue;
|
|
547
|
+
if (query.method !== method)
|
|
548
|
+
continue;
|
|
549
|
+
if (query.matchArgs) {
|
|
550
|
+
if (query.matchArgs.length !== args.length)
|
|
551
|
+
continue;
|
|
552
|
+
if (!query.matchArgs.every((arg, i) => arg === args[i])) {
|
|
553
|
+
continue;
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
return (0, import_safe2.pick)(query, ["result", "persistValues", "extendMetadata"]);
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
const basicReportMappings = [
|
|
561
|
+
false,
|
|
562
|
+
"auto",
|
|
563
|
+
"Binary Sensor"
|
|
564
|
+
];
|
|
565
|
+
function isBasicReportMapping(v) {
|
|
566
|
+
return basicReportMappings.includes(v);
|
|
567
|
+
}
|
|
568
|
+
const basicSetMappings = [
|
|
569
|
+
"event",
|
|
570
|
+
"report",
|
|
571
|
+
"auto",
|
|
572
|
+
"Binary Sensor"
|
|
573
|
+
];
|
|
574
|
+
function isBasicSetMapping(v) {
|
|
575
|
+
return basicSetMappings.includes(v);
|
|
576
|
+
}
|
|
577
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
578
|
+
0 && (module.exports = {
|
|
579
|
+
CompatAddCC,
|
|
580
|
+
CompatMapAlarm,
|
|
581
|
+
CompatOverrideQueries,
|
|
582
|
+
ConditionalCompatConfig
|
|
583
|
+
});
|
|
584
|
+
//# sourceMappingURL=CompatConfig.js.map
|