@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
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const utils_safe_1 = require("../utils_safe");
|
|
8
|
-
const ConditionalItem_1 = require("./ConditionalItem");
|
|
9
|
-
class ConditionalCompatConfig {
|
|
1
|
+
import { getCCName, stripUndefined, } from "@zwave-js/core/safe";
|
|
2
|
+
import { pick } from "@zwave-js/shared/safe";
|
|
3
|
+
import { isArray, isObject } from "alcalzone-shared/typeguards/index.js";
|
|
4
|
+
import { throwInvalidConfig, tryParseCCId } from "../utils_safe.js";
|
|
5
|
+
import { conditionApplies } from "./ConditionalItem.js";
|
|
6
|
+
export class ConditionalCompatConfig {
|
|
10
7
|
valueIdRegex = /^\$value\$\[.+\]$/;
|
|
11
8
|
constructor(filename, definition) {
|
|
12
9
|
this.condition = definition.$if;
|
|
13
10
|
if (definition.queryOnWakeup != undefined) {
|
|
14
|
-
if (!
|
|
15
|
-
|| !definition.queryOnWakeup.every((cmd) =>
|
|
11
|
+
if (!isArray(definition.queryOnWakeup)
|
|
12
|
+
|| !definition.queryOnWakeup.every((cmd) => isArray(cmd)
|
|
16
13
|
&& cmd.length >= 2
|
|
17
14
|
&& typeof cmd[0] === "string"
|
|
18
15
|
&& typeof cmd[1] === "string"
|
|
@@ -21,7 +18,7 @@ class ConditionalCompatConfig {
|
|
|
21
18
|
.every((arg) => typeof arg === "string"
|
|
22
19
|
|| typeof arg === "number"
|
|
23
20
|
|| typeof arg === "boolean"))) {
|
|
24
|
-
|
|
21
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
25
22
|
error in compat option queryOnWakeup`);
|
|
26
23
|
}
|
|
27
24
|
// Parse "smart" values into partial Value IDs
|
|
@@ -39,15 +36,15 @@ error in compat option queryOnWakeup`);
|
|
|
39
36
|
}
|
|
40
37
|
if (definition.disableAutoRefresh != undefined) {
|
|
41
38
|
if (definition.disableAutoRefresh !== true) {
|
|
42
|
-
|
|
39
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
43
40
|
compat option disableAutoRefresh must be true or omitted`);
|
|
44
41
|
}
|
|
45
42
|
this.disableAutoRefresh = definition.disableAutoRefresh;
|
|
46
43
|
}
|
|
47
44
|
if (definition.disableCallbackFunctionTypeCheck != undefined) {
|
|
48
|
-
if (!
|
|
45
|
+
if (!isArray(definition.disableCallbackFunctionTypeCheck)
|
|
49
46
|
|| !definition.disableCallbackFunctionTypeCheck.every((d) => typeof d === "number" && d % 1 === 0 && d > 0)) {
|
|
50
|
-
|
|
47
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
51
48
|
when present, compat option disableCallbackFunctionTypeCheck msut be an array of positive integers`);
|
|
52
49
|
}
|
|
53
50
|
this.disableCallbackFunctionTypeCheck =
|
|
@@ -55,7 +52,7 @@ when present, compat option disableCallbackFunctionTypeCheck msut be an array of
|
|
|
55
52
|
}
|
|
56
53
|
if (definition.disableStrictEntryControlDataValidation != undefined) {
|
|
57
54
|
if (definition.disableStrictEntryControlDataValidation !== true) {
|
|
58
|
-
|
|
55
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
59
56
|
compat option disableStrictEntryControlDataValidation must be true or omitted`);
|
|
60
57
|
}
|
|
61
58
|
this.disableStrictEntryControlDataValidation =
|
|
@@ -63,7 +60,7 @@ compat option disableStrictEntryControlDataValidation must be true or omitted`);
|
|
|
63
60
|
}
|
|
64
61
|
if (definition.disableStrictMeasurementValidation != undefined) {
|
|
65
62
|
if (definition.disableStrictMeasurementValidation !== true) {
|
|
66
|
-
|
|
63
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
67
64
|
compat option disableStrictMeasurementValidation must be true or omitted`);
|
|
68
65
|
}
|
|
69
66
|
this.disableStrictMeasurementValidation =
|
|
@@ -71,7 +68,7 @@ compat option disableStrictMeasurementValidation must be true or omitted`);
|
|
|
71
68
|
}
|
|
72
69
|
if (definition.encodeCCsUsingTargetVersion != undefined) {
|
|
73
70
|
if (definition.encodeCCsUsingTargetVersion !== true) {
|
|
74
|
-
|
|
71
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
75
72
|
compat option encodeCCsUsingTargetVersion must be true or omitted`);
|
|
76
73
|
}
|
|
77
74
|
this.encodeCCsUsingTargetVersion =
|
|
@@ -79,7 +76,7 @@ compat option encodeCCsUsingTargetVersion must be true or omitted`);
|
|
|
79
76
|
}
|
|
80
77
|
if (definition.forceNotificationIdleReset != undefined) {
|
|
81
78
|
if (definition.forceNotificationIdleReset !== true) {
|
|
82
|
-
|
|
79
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
83
80
|
compat option forceNotificationIdleReset must be true or omitted`);
|
|
84
81
|
}
|
|
85
82
|
this.forceNotificationIdleReset =
|
|
@@ -87,12 +84,12 @@ compat option forceNotificationIdleReset must be true or omitted`);
|
|
|
87
84
|
}
|
|
88
85
|
if (definition.forceSceneControllerGroupCount != undefined) {
|
|
89
86
|
if (typeof definition.forceSceneControllerGroupCount !== "number") {
|
|
90
|
-
|
|
87
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
91
88
|
compat option forceSceneControllerGroupCount must be a number!`);
|
|
92
89
|
}
|
|
93
90
|
if (definition.forceSceneControllerGroupCount < 0
|
|
94
91
|
|| definition.forceSceneControllerGroupCount > 255) {
|
|
95
|
-
|
|
92
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
96
93
|
compat option forceSceneControllerGroupCount must be between 0 and 255!`);
|
|
97
94
|
}
|
|
98
95
|
this.forceSceneControllerGroupCount =
|
|
@@ -100,21 +97,21 @@ compat option forceSceneControllerGroupCount must be between 0 and 255!`);
|
|
|
100
97
|
}
|
|
101
98
|
if (definition.mapBasicReport != undefined) {
|
|
102
99
|
if (!isBasicReportMapping(definition.mapBasicReport)) {
|
|
103
|
-
|
|
100
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
104
101
|
compat option mapBasicReport contains an invalid value`);
|
|
105
102
|
}
|
|
106
103
|
this.mapBasicReport = definition.mapBasicReport;
|
|
107
104
|
}
|
|
108
105
|
if (definition.mapBasicSet != undefined) {
|
|
109
106
|
if (!isBasicSetMapping(definition.mapBasicSet)) {
|
|
110
|
-
|
|
107
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
111
108
|
compat option mapBasicSet contains an invalid value`);
|
|
112
109
|
}
|
|
113
110
|
this.mapBasicSet = definition.mapBasicSet;
|
|
114
111
|
}
|
|
115
112
|
if (definition.preserveRootApplicationCCValueIDs != undefined) {
|
|
116
113
|
if (definition.preserveRootApplicationCCValueIDs !== true) {
|
|
117
|
-
|
|
114
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
118
115
|
error in compat option preserveRootApplicationCCValueIDs`);
|
|
119
116
|
}
|
|
120
117
|
this.preserveRootApplicationCCValueIDs =
|
|
@@ -122,25 +119,25 @@ error in compat option preserveRootApplicationCCValueIDs`);
|
|
|
122
119
|
}
|
|
123
120
|
if (definition.preserveEndpoints != undefined) {
|
|
124
121
|
if (definition.preserveEndpoints !== "*"
|
|
125
|
-
&& !(
|
|
122
|
+
&& !(isArray(definition.preserveEndpoints)
|
|
126
123
|
&& definition.preserveEndpoints.every((d) => typeof d === "number" && d % 1 === 0 && d > 0))) {
|
|
127
|
-
|
|
124
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
128
125
|
compat option preserveEndpoints must be "*" or an array of positive integers`);
|
|
129
126
|
}
|
|
130
127
|
this.preserveEndpoints = definition.preserveEndpoints;
|
|
131
128
|
}
|
|
132
129
|
if (definition.removeEndpoints != undefined) {
|
|
133
130
|
if (definition.removeEndpoints !== "*"
|
|
134
|
-
&& !(
|
|
131
|
+
&& !(isArray(definition.removeEndpoints)
|
|
135
132
|
&& definition.removeEndpoints.every((d) => typeof d === "number" && d % 1 === 0 && d > 0))) {
|
|
136
|
-
|
|
133
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
137
134
|
compat option removeEndpoints must be "*" or an array of positive integers`);
|
|
138
135
|
}
|
|
139
136
|
this.removeEndpoints = definition.removeEndpoints;
|
|
140
137
|
}
|
|
141
138
|
if (definition.skipConfigurationNameQuery != undefined) {
|
|
142
139
|
if (definition.skipConfigurationNameQuery !== true) {
|
|
143
|
-
|
|
140
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
144
141
|
error in compat option skipConfigurationNameQuery`);
|
|
145
142
|
}
|
|
146
143
|
this.skipConfigurationNameQuery =
|
|
@@ -148,7 +145,7 @@ error in compat option skipConfigurationNameQuery`);
|
|
|
148
145
|
}
|
|
149
146
|
if (definition.skipConfigurationInfoQuery != undefined) {
|
|
150
147
|
if (definition.skipConfigurationInfoQuery !== true) {
|
|
151
|
-
|
|
148
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
152
149
|
error in compat option skipConfigurationInfoQuery`);
|
|
153
150
|
}
|
|
154
151
|
this.skipConfigurationInfoQuery =
|
|
@@ -156,23 +153,23 @@ error in compat option skipConfigurationInfoQuery`);
|
|
|
156
153
|
}
|
|
157
154
|
if (definition.treatMultilevelSwitchSetAsEvent != undefined) {
|
|
158
155
|
if (definition.treatMultilevelSwitchSetAsEvent !== true) {
|
|
159
|
-
|
|
156
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
160
157
|
error in compat option treatMultilevelSwitchSetAsEvent`);
|
|
161
158
|
}
|
|
162
159
|
this.treatMultilevelSwitchSetAsEvent =
|
|
163
160
|
definition.treatMultilevelSwitchSetAsEvent;
|
|
164
161
|
}
|
|
165
162
|
if (definition.treatSetAsReport != undefined) {
|
|
166
|
-
if (!(
|
|
163
|
+
if (!(isArray(definition.treatSetAsReport)
|
|
167
164
|
&& definition.treatSetAsReport.every((d) => typeof d === "string"))) {
|
|
168
|
-
|
|
165
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
169
166
|
compat option treatSetAsReport must be an array of strings`);
|
|
170
167
|
}
|
|
171
168
|
this.treatSetAsReport = new Set(definition.treatSetAsReport);
|
|
172
169
|
}
|
|
173
170
|
if (definition.treatDestinationEndpointAsSource != undefined) {
|
|
174
171
|
if (definition.treatDestinationEndpointAsSource !== true) {
|
|
175
|
-
|
|
172
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
176
173
|
error in compat option treatDestinationEndpointAsSource`);
|
|
177
174
|
}
|
|
178
175
|
this.treatDestinationEndpointAsSource =
|
|
@@ -180,19 +177,19 @@ error in compat option treatDestinationEndpointAsSource`);
|
|
|
180
177
|
}
|
|
181
178
|
if (definition.useUTCInTimeParametersCC != undefined) {
|
|
182
179
|
if (definition.useUTCInTimeParametersCC !== true) {
|
|
183
|
-
|
|
180
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
184
181
|
compat option useUTCInTimeParametersCC must be true or omitted`);
|
|
185
182
|
}
|
|
186
183
|
this.useUTCInTimeParametersCC = definition.useUTCInTimeParametersCC;
|
|
187
184
|
}
|
|
188
185
|
if (definition.manualValueRefreshDelayMs != undefined) {
|
|
189
186
|
if (typeof definition.manualValueRefreshDelayMs !== "number") {
|
|
190
|
-
|
|
187
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
191
188
|
compat option manualValueRefreshDelayMs must be a number!`);
|
|
192
189
|
}
|
|
193
190
|
if (definition.manualValueRefreshDelayMs % 1 !== 0
|
|
194
191
|
|| definition.manualValueRefreshDelayMs < 0) {
|
|
195
|
-
|
|
192
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
196
193
|
compat option manualValueRefreshDelayMs must be a non-negative integer!`);
|
|
197
194
|
}
|
|
198
195
|
this.manualValueRefreshDelayMs =
|
|
@@ -200,44 +197,44 @@ compat option manualValueRefreshDelayMs must be a non-negative integer!`);
|
|
|
200
197
|
}
|
|
201
198
|
if (definition.reportTimeout != undefined) {
|
|
202
199
|
if (typeof definition.reportTimeout !== "number") {
|
|
203
|
-
|
|
200
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
204
201
|
compat option reportTimeout must be a number!`);
|
|
205
202
|
}
|
|
206
203
|
if (definition.reportTimeout % 1 !== 0
|
|
207
204
|
|| definition.reportTimeout < 1000
|
|
208
205
|
|| definition.reportTimeout > 10000) {
|
|
209
|
-
|
|
206
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
210
207
|
compat option reportTimeout must be an integer between 1000 and 10000!`);
|
|
211
208
|
}
|
|
212
209
|
this.reportTimeout = definition.reportTimeout;
|
|
213
210
|
}
|
|
214
211
|
if (definition.mapRootReportsToEndpoint != undefined) {
|
|
215
212
|
if (typeof definition.mapRootReportsToEndpoint !== "number") {
|
|
216
|
-
|
|
213
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
217
214
|
compat option mapRootReportsToEndpoint must be a number!`);
|
|
218
215
|
}
|
|
219
216
|
if (definition.mapRootReportsToEndpoint % 1 !== 0
|
|
220
217
|
|| definition.mapRootReportsToEndpoint < 1) {
|
|
221
|
-
|
|
218
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
222
219
|
compat option mapRootReportsToEndpoint must be a positive integer!`);
|
|
223
220
|
}
|
|
224
221
|
this.mapRootReportsToEndpoint = definition.mapRootReportsToEndpoint;
|
|
225
222
|
}
|
|
226
223
|
if (definition.overrideFloatEncoding != undefined) {
|
|
227
|
-
if (!
|
|
228
|
-
|
|
224
|
+
if (!isObject(definition.overrideFloatEncoding)) {
|
|
225
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
229
226
|
error in compat option overrideFloatEncoding`);
|
|
230
227
|
}
|
|
231
228
|
this.overrideFloatEncoding = {};
|
|
232
229
|
if ("precision" in definition.overrideFloatEncoding) {
|
|
233
230
|
if (typeof definition.overrideFloatEncoding.precision
|
|
234
231
|
!= "number") {
|
|
235
|
-
|
|
232
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
236
233
|
compat option overrideFloatEncoding.precision must be a number!`);
|
|
237
234
|
}
|
|
238
235
|
if (definition.overrideFloatEncoding.precision % 1 !== 0
|
|
239
236
|
|| definition.overrideFloatEncoding.precision < 0) {
|
|
240
|
-
|
|
237
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
241
238
|
compat option overrideFloatEncoding.precision must be a positive integer!`);
|
|
242
239
|
}
|
|
243
240
|
this.overrideFloatEncoding.precision =
|
|
@@ -245,43 +242,43 @@ compat option overrideFloatEncoding.precision must be a positive integer!`);
|
|
|
245
242
|
}
|
|
246
243
|
if ("size" in definition.overrideFloatEncoding) {
|
|
247
244
|
if (typeof definition.overrideFloatEncoding.size != "number") {
|
|
248
|
-
|
|
245
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
249
246
|
compat option overrideFloatEncoding.size must be a number!`);
|
|
250
247
|
}
|
|
251
248
|
if (definition.overrideFloatEncoding.size % 1 !== 0
|
|
252
249
|
|| definition.overrideFloatEncoding.size < 1
|
|
253
250
|
|| definition.overrideFloatEncoding.size > 4) {
|
|
254
|
-
|
|
251
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
255
252
|
compat option overrideFloatEncoding.size must be an integer between 1 and 4!`);
|
|
256
253
|
}
|
|
257
254
|
this.overrideFloatEncoding.size =
|
|
258
255
|
definition.overrideFloatEncoding.size;
|
|
259
256
|
}
|
|
260
257
|
if (Object.keys(this.overrideFloatEncoding).length === 0) {
|
|
261
|
-
|
|
258
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
262
259
|
error in compat option overrideFloatEncoding: size and/or precision must be specified!`);
|
|
263
260
|
}
|
|
264
261
|
}
|
|
265
262
|
if (definition.commandClasses != undefined) {
|
|
266
|
-
if (!
|
|
267
|
-
|
|
263
|
+
if (!isObject(definition.commandClasses)) {
|
|
264
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
268
265
|
error in compat option commandClasses`);
|
|
269
266
|
}
|
|
270
267
|
if (definition.commandClasses.add != undefined) {
|
|
271
|
-
if (!
|
|
272
|
-
|
|
268
|
+
if (!isObject(definition.commandClasses.add)) {
|
|
269
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
273
270
|
error in compat option commandClasses.add`);
|
|
274
271
|
}
|
|
275
|
-
else if (!Object.values(definition.commandClasses.add).every((v) =>
|
|
276
|
-
|
|
272
|
+
else if (!Object.values(definition.commandClasses.add).every((v) => isObject(v))) {
|
|
273
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
277
274
|
All values in compat option commandClasses.add must be objects`);
|
|
278
275
|
}
|
|
279
276
|
const addCCs = new Map();
|
|
280
277
|
for (const [key, info] of Object.entries(definition.commandClasses.add)) {
|
|
281
278
|
// Parse the key into a CC ID
|
|
282
|
-
const cc =
|
|
279
|
+
const cc = tryParseCCId(key);
|
|
283
280
|
if (cc == undefined) {
|
|
284
|
-
|
|
281
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
285
282
|
Invalid Command Class "${key}" specified in compat option commandClasses.add!`);
|
|
286
283
|
}
|
|
287
284
|
addCCs.set(cc, new CompatAddCC(filename, info));
|
|
@@ -289,31 +286,31 @@ Invalid Command Class "${key}" specified in compat option commandClasses.add!`);
|
|
|
289
286
|
this.addCCs = addCCs;
|
|
290
287
|
}
|
|
291
288
|
if (definition.commandClasses.remove != undefined) {
|
|
292
|
-
if (!
|
|
293
|
-
|
|
289
|
+
if (!isObject(definition.commandClasses.remove)) {
|
|
290
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
294
291
|
error in compat option commandClasses.remove`);
|
|
295
292
|
}
|
|
296
293
|
const removeCCs = new Map();
|
|
297
294
|
for (const [key, info] of Object.entries(definition.commandClasses.remove)) {
|
|
298
295
|
// Parse the key into a CC ID
|
|
299
|
-
const cc =
|
|
296
|
+
const cc = tryParseCCId(key);
|
|
300
297
|
if (cc == undefined) {
|
|
301
|
-
|
|
298
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
302
299
|
Invalid Command Class "${key}" specified in compat option commandClasses.remove!`);
|
|
303
300
|
}
|
|
304
|
-
if (
|
|
301
|
+
if (isObject(info) && "endpoints" in info) {
|
|
305
302
|
if (info.endpoints === "*"
|
|
306
|
-
|| (
|
|
303
|
+
|| (isArray(info.endpoints)
|
|
307
304
|
&& info.endpoints.every((i) => typeof i === "number"))) {
|
|
308
305
|
removeCCs.set(cc, info.endpoints);
|
|
309
306
|
}
|
|
310
307
|
else {
|
|
311
|
-
|
|
308
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
312
309
|
Compat option commandClasses.remove has an invalid "endpoints" property. Only "*" and numeric arrays are allowed!`);
|
|
313
310
|
}
|
|
314
311
|
}
|
|
315
312
|
else {
|
|
316
|
-
|
|
313
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
317
314
|
All values in compat option commandClasses.remove must be objects with an "endpoints" property!`);
|
|
318
315
|
}
|
|
319
316
|
}
|
|
@@ -321,16 +318,16 @@ All values in compat option commandClasses.remove must be objects with an "endpo
|
|
|
321
318
|
}
|
|
322
319
|
}
|
|
323
320
|
if (definition.alarmMapping != undefined) {
|
|
324
|
-
if (!
|
|
325
|
-
|| !definition.alarmMapping.every((m) =>
|
|
326
|
-
|
|
321
|
+
if (!isArray(definition.alarmMapping)
|
|
322
|
+
|| !definition.alarmMapping.every((m) => isObject(m))) {
|
|
323
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
327
324
|
compat option alarmMapping must be an array where all items are objects!`);
|
|
328
325
|
}
|
|
329
326
|
this.alarmMapping = definition.alarmMapping.map((m, i) => new CompatMapAlarm(filename, m, i + 1));
|
|
330
327
|
}
|
|
331
328
|
if (definition.overrideQueries != undefined) {
|
|
332
|
-
if (!
|
|
333
|
-
|
|
329
|
+
if (!isObject(definition.overrideQueries)) {
|
|
330
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
334
331
|
compat option overrideQueries must be an object!`);
|
|
335
332
|
}
|
|
336
333
|
this.overrideQueries = new CompatOverrideQueries(filename, definition.overrideQueries);
|
|
@@ -365,9 +362,9 @@ compat option overrideQueries must be an object!`);
|
|
|
365
362
|
queryOnWakeup;
|
|
366
363
|
condition;
|
|
367
364
|
evaluateCondition(deviceId) {
|
|
368
|
-
if (!
|
|
365
|
+
if (!conditionApplies(this, deviceId))
|
|
369
366
|
return;
|
|
370
|
-
const ret =
|
|
367
|
+
const ret = pick(this, [
|
|
371
368
|
"alarmMapping",
|
|
372
369
|
"addCCs",
|
|
373
370
|
"removeCCs",
|
|
@@ -396,18 +393,17 @@ compat option overrideQueries must be an object!`);
|
|
|
396
393
|
"useUTCInTimeParametersCC",
|
|
397
394
|
"queryOnWakeup",
|
|
398
395
|
]);
|
|
399
|
-
return
|
|
396
|
+
return stripUndefined(ret);
|
|
400
397
|
}
|
|
401
398
|
}
|
|
402
|
-
|
|
403
|
-
class CompatAddCC {
|
|
399
|
+
export class CompatAddCC {
|
|
404
400
|
constructor(filename, definition) {
|
|
405
401
|
const endpoints = new Map();
|
|
406
402
|
const parseEndpointInfo = (endpoint, info) => {
|
|
407
403
|
const parsed = {};
|
|
408
404
|
if (info.isSupported != undefined) {
|
|
409
405
|
if (typeof info.isSupported !== "boolean") {
|
|
410
|
-
|
|
406
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
411
407
|
Property isSupported in compat option commandClasses.add, endpoint ${endpoint} must be a boolean!`);
|
|
412
408
|
}
|
|
413
409
|
else {
|
|
@@ -416,7 +412,7 @@ Property isSupported in compat option commandClasses.add, endpoint ${endpoint} m
|
|
|
416
412
|
}
|
|
417
413
|
if (info.isControlled != undefined) {
|
|
418
414
|
if (typeof info.isControlled !== "boolean") {
|
|
419
|
-
|
|
415
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
420
416
|
Property isControlled in compat option commandClasses.add, endpoint ${endpoint} must be a boolean!`);
|
|
421
417
|
}
|
|
422
418
|
else {
|
|
@@ -425,7 +421,7 @@ Property isControlled in compat option commandClasses.add, endpoint ${endpoint}
|
|
|
425
421
|
}
|
|
426
422
|
if (info.secure != undefined) {
|
|
427
423
|
if (typeof info.secure !== "boolean") {
|
|
428
|
-
|
|
424
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
429
425
|
Property secure in compat option commandClasses.add, endpoint ${endpoint} must be a boolean!`);
|
|
430
426
|
}
|
|
431
427
|
else {
|
|
@@ -434,7 +430,7 @@ Property secure in compat option commandClasses.add, endpoint ${endpoint} must b
|
|
|
434
430
|
}
|
|
435
431
|
if (info.version != undefined) {
|
|
436
432
|
if (typeof info.version !== "number") {
|
|
437
|
-
|
|
433
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
438
434
|
Property version in compat option commandClasses.add, endpoint ${endpoint} must be a number!`);
|
|
439
435
|
}
|
|
440
436
|
else {
|
|
@@ -452,9 +448,9 @@ Property version in compat option commandClasses.add, endpoint ${endpoint} must
|
|
|
452
448
|
parseEndpointInfo(0, definition);
|
|
453
449
|
}
|
|
454
450
|
// Parse all other endpoints
|
|
455
|
-
if (
|
|
451
|
+
if (isObject(definition.endpoints)) {
|
|
456
452
|
if (!Object.keys(definition.endpoints).every((k) => /^\d+$/.test(k))) {
|
|
457
|
-
|
|
453
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
458
454
|
invalid endpoint index in compat option commandClasses.add`);
|
|
459
455
|
}
|
|
460
456
|
else {
|
|
@@ -467,54 +463,53 @@ invalid endpoint index in compat option commandClasses.add`);
|
|
|
467
463
|
}
|
|
468
464
|
endpoints;
|
|
469
465
|
}
|
|
470
|
-
|
|
471
|
-
class CompatMapAlarm {
|
|
466
|
+
export class CompatMapAlarm {
|
|
472
467
|
constructor(filename, definition, index) {
|
|
473
|
-
if (!
|
|
474
|
-
|
|
468
|
+
if (!isObject(definition.from)) {
|
|
469
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
475
470
|
error in compat option alarmMapping, mapping #${index}: property "from" must be an object!`);
|
|
476
471
|
}
|
|
477
472
|
else {
|
|
478
473
|
if (typeof definition.from.alarmType !== "number") {
|
|
479
|
-
|
|
474
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
480
475
|
error in compat option alarmMapping, mapping #${index}: property "from.alarmType" must be a number!`);
|
|
481
476
|
}
|
|
482
477
|
if (definition.from.alarmLevel != undefined
|
|
483
478
|
&& typeof definition.from.alarmLevel !== "number") {
|
|
484
|
-
|
|
479
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
485
480
|
error in compat option alarmMapping, mapping #${index}: if property "from.alarmLevel" is given, it must be a number!`);
|
|
486
481
|
}
|
|
487
482
|
}
|
|
488
|
-
if (!
|
|
489
|
-
|
|
483
|
+
if (!isObject(definition.to)) {
|
|
484
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
490
485
|
error in compat option alarmMapping, mapping #${index}: property "to" must be an object!`);
|
|
491
486
|
}
|
|
492
487
|
else {
|
|
493
488
|
if (typeof definition.to.notificationType !== "number") {
|
|
494
|
-
|
|
489
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
495
490
|
error in compat option alarmMapping, mapping #${index}: property "to.notificationType" must be a number!`);
|
|
496
491
|
}
|
|
497
492
|
if (typeof definition.to.notificationEvent !== "number") {
|
|
498
|
-
|
|
493
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
499
494
|
error in compat option alarmMapping, mapping #${index}: property "to.notificationEvent" must be a number!`);
|
|
500
495
|
}
|
|
501
496
|
if (definition.to.eventParameters != undefined) {
|
|
502
|
-
if (!
|
|
503
|
-
|
|
497
|
+
if (!isObject(definition.to.eventParameters)) {
|
|
498
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
504
499
|
error in compat option alarmMapping, mapping #${index}: property "to.eventParameters" must be an object!`);
|
|
505
500
|
}
|
|
506
501
|
else {
|
|
507
502
|
for (const [key, val] of Object.entries(definition.to.eventParameters)) {
|
|
508
503
|
if (typeof val !== "number" && val !== "alarmLevel") {
|
|
509
|
-
|
|
504
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
510
505
|
error in compat option alarmMapping, mapping #${index}: property "to.eventParameters.${key}" must be a number or the literal "alarmLevel"!`);
|
|
511
506
|
}
|
|
512
507
|
}
|
|
513
508
|
}
|
|
514
509
|
}
|
|
515
510
|
}
|
|
516
|
-
this.from =
|
|
517
|
-
this.to =
|
|
511
|
+
this.from = pick(definition.from, ["alarmType", "alarmLevel"]);
|
|
512
|
+
this.to = pick(definition.to, [
|
|
518
513
|
"notificationType",
|
|
519
514
|
"notificationEvent",
|
|
520
515
|
"eventParameters",
|
|
@@ -523,36 +518,35 @@ error in compat option alarmMapping, mapping #${index}: property "to.eventParame
|
|
|
523
518
|
from;
|
|
524
519
|
to;
|
|
525
520
|
}
|
|
526
|
-
|
|
527
|
-
class CompatOverrideQueries {
|
|
521
|
+
export class CompatOverrideQueries {
|
|
528
522
|
constructor(filename, definition) {
|
|
529
523
|
const overrides = new Map();
|
|
530
524
|
const parseOverride = (cc, info) => {
|
|
531
525
|
if (typeof info.method !== "string") {
|
|
532
|
-
|
|
533
|
-
Property "method" in compat option overrideQueries, CC ${
|
|
526
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
527
|
+
Property "method" in compat option overrideQueries, CC ${getCCName(cc)} must be a string!`);
|
|
534
528
|
}
|
|
535
529
|
else if (info.matchArgs != undefined
|
|
536
|
-
&& !
|
|
537
|
-
|
|
538
|
-
Property "matchArgs" in compat option overrideQueries, CC ${
|
|
530
|
+
&& !isArray(info.matchArgs)) {
|
|
531
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
532
|
+
Property "matchArgs" in compat option overrideQueries, CC ${getCCName(cc)} must be an array!`);
|
|
539
533
|
}
|
|
540
534
|
else if (!("result" in info)) {
|
|
541
|
-
|
|
542
|
-
Property "result" is missing in in compat option overrideQueries, CC ${
|
|
535
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
536
|
+
Property "result" is missing in in compat option overrideQueries, CC ${getCCName(cc)}!`);
|
|
543
537
|
}
|
|
544
538
|
else if (info.endpoint != undefined
|
|
545
539
|
&& typeof info.endpoint !== "number") {
|
|
546
|
-
|
|
547
|
-
Property "endpoint" in compat option overrideQueries, CC ${
|
|
540
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
541
|
+
Property "endpoint" in compat option overrideQueries, CC ${getCCName(cc)} must be a number!`);
|
|
548
542
|
}
|
|
549
|
-
else if (info.persistValues && !
|
|
550
|
-
|
|
551
|
-
Property "persistValues" in compat option overrideQueries, CC ${
|
|
543
|
+
else if (info.persistValues && !isObject(info.persistValues)) {
|
|
544
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
545
|
+
Property "persistValues" in compat option overrideQueries, CC ${getCCName(cc)} must be an object!`);
|
|
552
546
|
}
|
|
553
|
-
else if (info.extendMetadata && !
|
|
554
|
-
|
|
555
|
-
Property "extendMetadata" in compat option overrideQueries, CC ${
|
|
547
|
+
else if (info.extendMetadata && !isObject(info.extendMetadata)) {
|
|
548
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
549
|
+
Property "extendMetadata" in compat option overrideQueries, CC ${getCCName(cc)} must be an object!`);
|
|
556
550
|
}
|
|
557
551
|
return {
|
|
558
552
|
endpoint: info.endpoint,
|
|
@@ -565,17 +559,17 @@ Property "extendMetadata" in compat option overrideQueries, CC ${(0, safe_1.getC
|
|
|
565
559
|
};
|
|
566
560
|
for (const [key, value] of Object.entries(definition)) {
|
|
567
561
|
// Parse the key into a CC ID
|
|
568
|
-
const cc =
|
|
562
|
+
const cc = tryParseCCId(key);
|
|
569
563
|
if (cc == undefined) {
|
|
570
|
-
|
|
564
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
571
565
|
Invalid Command Class "${key}" specified in compat option overrideQueries!`);
|
|
572
566
|
}
|
|
573
567
|
let overrideDefinitions;
|
|
574
|
-
if (
|
|
568
|
+
if (isObject(value)) {
|
|
575
569
|
overrideDefinitions = [value];
|
|
576
570
|
}
|
|
577
|
-
else if (!
|
|
578
|
-
|
|
571
|
+
else if (!isArray(value)) {
|
|
572
|
+
throwInvalidConfig("devices", `config/devices/${filename}:
|
|
579
573
|
Property "${key}" in compat option overrideQueries must be a single override object or an array thereof!`);
|
|
580
574
|
}
|
|
581
575
|
else {
|
|
@@ -606,11 +600,10 @@ Property "${key}" in compat option overrideQueries must be a single override obj
|
|
|
606
600
|
continue;
|
|
607
601
|
}
|
|
608
602
|
}
|
|
609
|
-
return
|
|
603
|
+
return pick(query, ["result", "persistValues", "extendMetadata"]);
|
|
610
604
|
}
|
|
611
605
|
}
|
|
612
606
|
}
|
|
613
|
-
exports.CompatOverrideQueries = CompatOverrideQueries;
|
|
614
607
|
const basicReportMappings = [
|
|
615
608
|
false,
|
|
616
609
|
"auto",
|