@zwave-js/cc 15.9.0 → 15.10.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.
- package/build/cjs/cc/BatteryCC.d.ts +4 -35
- package/build/cjs/cc/BatteryCC.js +14 -22
- package/build/cjs/cc/BatteryCC.js.map +2 -2
- package/build/cjs/cc/IndicatorCC.d.ts +38 -30
- package/build/cjs/cc/IndicatorCC.js +116 -33
- package/build/cjs/cc/IndicatorCC.js.map +2 -2
- package/build/cjs/cc/MultilevelSwitchCC.js +19 -3
- package/build/cjs/cc/MultilevelSwitchCC.js.map +2 -2
- package/build/cjs/cc/_CCValues.generated.d.ts +58 -98
- package/build/cjs/cc/_CCValues.generated.js +38 -56
- package/build/cjs/cc/_CCValues.generated.js.map +2 -2
- package/build/cjs/lib/API.d.ts +1 -1
- package/build/cjs/lib/API.js.map +1 -1
- package/build/esm/cc/BatteryCC.d.ts +4 -35
- package/build/esm/cc/BatteryCC.d.ts.map +1 -1
- package/build/esm/cc/BatteryCC.js +22 -23
- package/build/esm/cc/BatteryCC.js.map +1 -1
- package/build/esm/cc/IndicatorCC.d.ts +38 -30
- package/build/esm/cc/IndicatorCC.d.ts.map +1 -1
- package/build/esm/cc/IndicatorCC.js +132 -39
- package/build/esm/cc/IndicatorCC.js.map +1 -1
- package/build/esm/cc/MultilevelSwitchCC.d.ts.map +1 -1
- package/build/esm/cc/MultilevelSwitchCC.js +21 -8
- package/build/esm/cc/MultilevelSwitchCC.js.map +1 -1
- package/build/esm/cc/_CCValues.generated.d.ts +58 -98
- package/build/esm/cc/_CCValues.generated.d.ts.map +1 -1
- package/build/esm/cc/_CCValues.generated.js +40 -60
- package/build/esm/cc/_CCValues.generated.js.map +1 -1
- package/build/esm/lib/API.d.ts +1 -1
- package/build/esm/lib/API.d.ts.map +1 -1
- package/package.json +5 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CCEncodingContext, CCParsingContext } from "@zwave-js/cc";
|
|
2
|
-
import { CommandClasses, type EndpointId, type GetValueDB, type MaybeNotKnown, type MessageOrCCLogEntry, type SupervisionResult, type WithAddress } from "@zwave-js/core";
|
|
2
|
+
import { CommandClasses, type EndpointId, type GetValueDB, type MaybeNotKnown, type MessageOrCCLogEntry, type SupervisionResult, type ValueID, type WithAddress } from "@zwave-js/core";
|
|
3
3
|
import { Bytes } from "@zwave-js/shared";
|
|
4
4
|
import { CCAPI, POLL_VALUE, type PollValueImplementation, SET_VALUE, type SetValueImplementation } from "../lib/API.js";
|
|
5
5
|
import { type CCRaw, CommandClass, type InterviewContext, type PersistValuesContext, type RefreshValuesContext } from "../lib/CommandClass.js";
|
|
@@ -15,7 +15,7 @@ export declare const IndicatorCCValues: Readonly<{
|
|
|
15
15
|
readonly endpoint: number;
|
|
16
16
|
readonly property: "supportedIndicatorIds";
|
|
17
17
|
};
|
|
18
|
-
is: (valueId:
|
|
18
|
+
is: (valueId: ValueID) => boolean;
|
|
19
19
|
readonly meta: Readonly<{
|
|
20
20
|
readonly type: "any";
|
|
21
21
|
readonly readable: true;
|
|
@@ -40,7 +40,7 @@ export declare const IndicatorCCValues: Readonly<{
|
|
|
40
40
|
readonly endpoint: number;
|
|
41
41
|
readonly property: "value";
|
|
42
42
|
};
|
|
43
|
-
is: (valueId:
|
|
43
|
+
is: (valueId: ValueID) => boolean;
|
|
44
44
|
readonly meta: {
|
|
45
45
|
readonly label: "Indicator value";
|
|
46
46
|
readonly ccSpecific: {
|
|
@@ -71,7 +71,7 @@ export declare const IndicatorCCValues: Readonly<{
|
|
|
71
71
|
readonly endpoint: number;
|
|
72
72
|
readonly property: "identify";
|
|
73
73
|
};
|
|
74
|
-
is: (valueId:
|
|
74
|
+
is: (valueId: ValueID) => boolean;
|
|
75
75
|
readonly meta: {
|
|
76
76
|
readonly label: "Identify";
|
|
77
77
|
readonly states: {
|
|
@@ -90,86 +90,92 @@ export declare const IndicatorCCValues: Readonly<{
|
|
|
90
90
|
readonly autoCreate: true;
|
|
91
91
|
};
|
|
92
92
|
};
|
|
93
|
-
|
|
93
|
+
supportedPropertyIDs: ((indicatorId: number) => {
|
|
94
94
|
id: {
|
|
95
95
|
readonly commandClass: CommandClasses.Indicator;
|
|
96
|
-
readonly property: "
|
|
96
|
+
readonly property: "supportedPropertyIDs";
|
|
97
|
+
readonly propertyKey: number;
|
|
97
98
|
};
|
|
98
99
|
endpoint: (endpoint?: number) => {
|
|
99
100
|
readonly commandClass: CommandClasses.Indicator;
|
|
100
101
|
readonly endpoint: number;
|
|
101
|
-
readonly property: "
|
|
102
|
+
readonly property: "supportedPropertyIDs";
|
|
103
|
+
readonly propertyKey: number;
|
|
102
104
|
};
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
readonly label: "Timeout";
|
|
106
|
-
readonly type: "string";
|
|
105
|
+
readonly meta: Readonly<{
|
|
106
|
+
readonly type: "any";
|
|
107
107
|
readonly readable: true;
|
|
108
108
|
readonly writeable: true;
|
|
109
|
-
}
|
|
109
|
+
}>;
|
|
110
|
+
}) & {
|
|
111
|
+
is: (valueId: ValueID) => boolean;
|
|
110
112
|
options: {
|
|
111
|
-
readonly internal:
|
|
112
|
-
readonly minVersion:
|
|
113
|
+
readonly internal: true;
|
|
114
|
+
readonly minVersion: 1;
|
|
113
115
|
readonly secret: false;
|
|
114
116
|
readonly stateful: true;
|
|
115
117
|
readonly supportsEndpoints: true;
|
|
116
118
|
readonly autoCreate: true;
|
|
117
119
|
};
|
|
118
120
|
};
|
|
119
|
-
|
|
121
|
+
valueV2: ((indicatorId: number, propertyId: number) => {
|
|
120
122
|
id: {
|
|
121
123
|
readonly commandClass: CommandClasses.Indicator;
|
|
122
|
-
readonly property:
|
|
124
|
+
readonly property: number;
|
|
123
125
|
readonly propertyKey: number;
|
|
124
126
|
};
|
|
125
127
|
endpoint: (endpoint?: number) => {
|
|
126
128
|
readonly commandClass: CommandClasses.Indicator;
|
|
127
129
|
readonly endpoint: number;
|
|
128
|
-
readonly property:
|
|
130
|
+
readonly property: number;
|
|
129
131
|
readonly propertyKey: number;
|
|
130
132
|
};
|
|
131
|
-
readonly meta:
|
|
133
|
+
readonly meta: {
|
|
134
|
+
readonly ccSpecific: {
|
|
135
|
+
readonly indicatorId: number;
|
|
136
|
+
readonly propertyId: number;
|
|
137
|
+
};
|
|
132
138
|
readonly type: "any";
|
|
133
139
|
readonly readable: true;
|
|
134
140
|
readonly writeable: true;
|
|
135
|
-
}
|
|
141
|
+
};
|
|
136
142
|
}) & {
|
|
137
|
-
is: (valueId:
|
|
143
|
+
is: (valueId: ValueID) => boolean;
|
|
138
144
|
options: {
|
|
139
|
-
readonly internal:
|
|
140
|
-
readonly minVersion:
|
|
145
|
+
readonly internal: false;
|
|
146
|
+
readonly minVersion: 2;
|
|
141
147
|
readonly secret: false;
|
|
142
148
|
readonly stateful: true;
|
|
143
149
|
readonly supportsEndpoints: true;
|
|
144
150
|
readonly autoCreate: true;
|
|
145
151
|
};
|
|
146
152
|
};
|
|
147
|
-
|
|
153
|
+
timeout: ((indicatorId: number) => {
|
|
148
154
|
id: {
|
|
149
155
|
readonly commandClass: CommandClasses.Indicator;
|
|
150
156
|
readonly property: number;
|
|
151
|
-
readonly propertyKey:
|
|
157
|
+
readonly propertyKey: "timeout";
|
|
152
158
|
};
|
|
153
159
|
endpoint: (endpoint?: number) => {
|
|
154
160
|
readonly commandClass: CommandClasses.Indicator;
|
|
155
161
|
readonly endpoint: number;
|
|
156
162
|
readonly property: number;
|
|
157
|
-
readonly propertyKey:
|
|
163
|
+
readonly propertyKey: "timeout";
|
|
158
164
|
};
|
|
159
165
|
readonly meta: {
|
|
166
|
+
readonly label: "Timeout";
|
|
160
167
|
readonly ccSpecific: {
|
|
161
168
|
readonly indicatorId: number;
|
|
162
|
-
readonly propertyId: number;
|
|
163
169
|
};
|
|
164
|
-
readonly type: "
|
|
170
|
+
readonly type: "string";
|
|
165
171
|
readonly readable: true;
|
|
166
172
|
readonly writeable: true;
|
|
167
173
|
};
|
|
168
174
|
}) & {
|
|
169
|
-
is: (valueId:
|
|
175
|
+
is: (valueId: ValueID) => boolean;
|
|
170
176
|
options: {
|
|
171
177
|
readonly internal: false;
|
|
172
|
-
readonly minVersion:
|
|
178
|
+
readonly minVersion: 3;
|
|
173
179
|
readonly secret: false;
|
|
174
180
|
readonly stateful: true;
|
|
175
181
|
readonly supportsEndpoints: true;
|
|
@@ -192,7 +198,7 @@ export declare const IndicatorCCValues: Readonly<{
|
|
|
192
198
|
readonly writeable: true;
|
|
193
199
|
}>;
|
|
194
200
|
}) & {
|
|
195
|
-
is: (valueId:
|
|
201
|
+
is: (valueId: ValueID) => boolean;
|
|
196
202
|
options: {
|
|
197
203
|
readonly internal: true;
|
|
198
204
|
readonly minVersion: 4;
|
|
@@ -203,6 +209,7 @@ export declare const IndicatorCCValues: Readonly<{
|
|
|
203
209
|
};
|
|
204
210
|
};
|
|
205
211
|
}>;
|
|
212
|
+
export declare function shouldExposeIndicatorValue(indicatorId: number, propertyId: number): boolean;
|
|
206
213
|
export declare class IndicatorCCAPI extends CCAPI {
|
|
207
214
|
supportsCommand(cmd: IndicatorCommand): MaybeNotKnown<boolean>;
|
|
208
215
|
protected get [SET_VALUE](): SetValueImplementation;
|
|
@@ -242,6 +249,7 @@ export declare class IndicatorCC extends CommandClass {
|
|
|
242
249
|
translatePropertyKey(ctx: GetValueDB, property: string | number, propertyKey: string | number): string | undefined;
|
|
243
250
|
translateProperty(ctx: GetValueDB, property: string | number, propertyKey?: string | number): string;
|
|
244
251
|
protected supportsV2Indicators(ctx: GetValueDB): boolean;
|
|
252
|
+
protected getManufacturerDefinedIndicatorLabel(ctx: GetValueDB, indicatorId: number): string | undefined;
|
|
245
253
|
static getSupportedPropertyIDsCached(ctx: GetValueDB, endpoint: EndpointId, indicatorId: number): MaybeNotKnown<number[]>;
|
|
246
254
|
}
|
|
247
255
|
export interface IndicatorObject {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IndicatorCC.d.ts","sourceRoot":"","sources":["../../../src/cc/IndicatorCC.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EACN,cAAc,EACd,KAAK,UAAU,EACf,KAAK,UAAU,EAEf,KAAK,aAAa,EAClB,KAAK,mBAAmB,EAGxB,KAAK,iBAAiB,
|
|
1
|
+
{"version":3,"file":"IndicatorCC.d.ts","sourceRoot":"","sources":["../../../src/cc/IndicatorCC.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EACN,cAAc,EACd,KAAK,UAAU,EACf,KAAK,UAAU,EAEf,KAAK,aAAa,EAClB,KAAK,mBAAmB,EAGxB,KAAK,iBAAiB,EACtB,KAAK,OAAO,EAEZ,KAAK,WAAW,EAOhB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,KAAK,EAA8B,MAAM,kBAAkB,CAAC;AAIrE,OAAO,EACN,KAAK,EACL,UAAU,EACV,KAAK,uBAAuB,EAC5B,SAAS,EACT,KAAK,sBAAsB,EAG3B,MAAM,eAAe,CAAC;AACvB,OAAO,EACN,KAAK,KAAK,EACV,YAAY,EACZ,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,MAAM,wBAAwB,CAAC;AAWhC,OAAO,EAAE,gBAAgB,EAAE,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAmF3E,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6E5B,CAAC;A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,4BAA6B,SAAQ,WAAW;gBAE3D,OAAO,EAAE,WAAW,CAAC,mCAAmC,CAAC;WAQ5C,IAAI,CACjB,GAAG,EAAE,KAAK,EACV,GAAG,EAAE,gBAAgB,GACnB,4BAA4B;IAgBxB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IAEpB,aAAa,CAAC,GAAG,EAAE,oBAAoB,GAAG,OAAO;IAcjD,SAAS,CAAC,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,KAAK,CAAC;IASjD,UAAU,CAAC,GAAG,CAAC,EAAE,UAAU,GAAG,mBAAmB;CASxD;AAGD,MAAM,WAAW,gCAAgC;IAChD,WAAW,EAAE,MAAM,CAAC;CACpB;AASD,qBAKa,yBAA0B,SAAQ,WAAW;gBAExD,OAAO,EAAE,WAAW,CAAC,gCAAgC,CAAC;WAMzC,IAAI,CACjB,GAAG,EAAE,KAAK,EACV,GAAG,EAAE,gBAAgB,GACnB,yBAAyB;IAUrB,WAAW,EAAE,MAAM,CAAC;IAEpB,SAAS,CAAC,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,KAAK,CAAC;IAKjD,UAAU,CAAC,GAAG,CAAC,EAAE,UAAU,GAAG,mBAAmB;CAQxD"}
|
|
@@ -35,7 +35,7 @@ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn,
|
|
|
35
35
|
import * as __validateArgs from "./IndicatorCC._validateArgs.js";
|
|
36
36
|
const { validateArgs_IndicatorCCAPI_get, validateArgs_IndicatorCCAPI_set, validateArgs_IndicatorCCAPI_sendReport, validateArgs_IndicatorCCAPI_getSupported, validateArgs_IndicatorCCAPI_reportSupported, validateArgs_IndicatorCCAPI_reportDescription, validateArgs_IndicatorCCAPI_setTimeout, validateArgs_IndicatorCCAPI_getTimeout, validateArgs_IndicatorCCAPI_getDescription } = __validateArgs;
|
|
37
37
|
import { CommandClasses, Indicator, MessagePriority, ValueMetadata, ZWaveError, ZWaveErrorCodes, encodeBitMask, getIndicatorProperty, parseBitMask, validatePayload, } from "@zwave-js/core";
|
|
38
|
-
import { Bytes, num2hex } from "@zwave-js/shared";
|
|
38
|
+
import { Bytes, getEnumMemberName, num2hex } from "@zwave-js/shared";
|
|
39
39
|
import { clamp, roundTo } from "alcalzone-shared/math";
|
|
40
40
|
import { isArray } from "alcalzone-shared/typeguards";
|
|
41
41
|
import { CCAPI, POLL_VALUE, SET_VALUE, throwUnsupportedProperty, throwWrongValueType, } from "../lib/API.js";
|
|
@@ -47,6 +47,7 @@ function isManufacturerDefinedIndicator(indicatorId) {
|
|
|
47
47
|
return indicatorId >= 0x80 && indicatorId <= 0x9f;
|
|
48
48
|
}
|
|
49
49
|
const timeoutStringRegex = /^(?:(?<hoursStr>\d+)h)?(?:(?<minutesStr>\d+)m)?(?:(?<secondsStr>\d+(?:\.\d+)?)s)?$/i;
|
|
50
|
+
const MAX_INDICATOR_OBJECTS = 31;
|
|
50
51
|
function parseIndicatorTimeoutString(text) {
|
|
51
52
|
if (!text.length)
|
|
52
53
|
return undefined;
|
|
@@ -69,6 +70,16 @@ function parseIndicatorTimeoutString(text) {
|
|
|
69
70
|
}
|
|
70
71
|
return ret;
|
|
71
72
|
}
|
|
73
|
+
function groupByIndicatorId(values) {
|
|
74
|
+
const ret = new Map();
|
|
75
|
+
for (const value of values) {
|
|
76
|
+
if (!ret.has(value.indicatorId)) {
|
|
77
|
+
ret.set(value.indicatorId, []);
|
|
78
|
+
}
|
|
79
|
+
ret.get(value.indicatorId).push(value);
|
|
80
|
+
}
|
|
81
|
+
return ret;
|
|
82
|
+
}
|
|
72
83
|
function indicatorObjectsToTimeout(values) {
|
|
73
84
|
const timeoutValues = values.filter((v) => [0x0a, 0x06, 0x07, 0x08].includes(v.propertyId));
|
|
74
85
|
if (!timeoutValues.length)
|
|
@@ -94,17 +105,10 @@ export { IndicatorCCValues };
|
|
|
94
105
|
* Looks up the configured metadata for the given indicator and property
|
|
95
106
|
*/
|
|
96
107
|
function getIndicatorMetadata(indicatorId, propertyId, overrideIndicatorLabel) {
|
|
97
|
-
const label = overrideIndicatorLabel
|
|
98
|
-
|| getIndicatorName(indicatorId);
|
|
108
|
+
const label = getIndicatorLabel(indicatorId, propertyId, overrideIndicatorLabel);
|
|
99
109
|
const prop = getIndicatorProperty(propertyId);
|
|
100
110
|
const baseMetadata = IndicatorCCValues.valueV2(indicatorId, propertyId).meta;
|
|
101
|
-
if (!
|
|
102
|
-
return {
|
|
103
|
-
...baseMetadata,
|
|
104
|
-
...ValueMetadata.UInt8,
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
else if (!prop) {
|
|
111
|
+
if (!prop) {
|
|
108
112
|
return {
|
|
109
113
|
...baseMetadata,
|
|
110
114
|
...ValueMetadata.UInt8,
|
|
@@ -116,7 +120,7 @@ function getIndicatorMetadata(indicatorId, propertyId, overrideIndicatorLabel) {
|
|
|
116
120
|
return {
|
|
117
121
|
...baseMetadata,
|
|
118
122
|
...ValueMetadata.Boolean,
|
|
119
|
-
label
|
|
123
|
+
label,
|
|
120
124
|
description: prop.description,
|
|
121
125
|
readable: !prop.readonly,
|
|
122
126
|
};
|
|
@@ -126,7 +130,7 @@ function getIndicatorMetadata(indicatorId, propertyId, overrideIndicatorLabel) {
|
|
|
126
130
|
return {
|
|
127
131
|
...baseMetadata,
|
|
128
132
|
...ValueMetadata.UInt8,
|
|
129
|
-
label
|
|
133
|
+
label,
|
|
130
134
|
description: prop.description,
|
|
131
135
|
min: prop.min,
|
|
132
136
|
max: prop.max,
|
|
@@ -137,13 +141,48 @@ function getIndicatorMetadata(indicatorId, propertyId, overrideIndicatorLabel) {
|
|
|
137
141
|
}
|
|
138
142
|
function getIndicatorName(indicatorId) {
|
|
139
143
|
if (indicatorId) {
|
|
140
|
-
return
|
|
144
|
+
return getEnumMemberName(Indicator, indicatorId);
|
|
141
145
|
}
|
|
142
146
|
else {
|
|
143
|
-
return "
|
|
147
|
+
return "Default";
|
|
144
148
|
}
|
|
145
149
|
}
|
|
146
|
-
|
|
150
|
+
/** Returns a user-friendly label for an indicator */
|
|
151
|
+
function getIndicatorLabel(indicatorId, propertyId, overrideIndicatorLabel, overridePropertyLabel) {
|
|
152
|
+
const defaultName = overrideIndicatorLabel || getIndicatorName(indicatorId);
|
|
153
|
+
// Without a defined property, we cannot suggest a better label
|
|
154
|
+
const prop = getIndicatorProperty(propertyId);
|
|
155
|
+
if (!prop)
|
|
156
|
+
return defaultName;
|
|
157
|
+
// For indicators that correspond to an LCD or buttons,
|
|
158
|
+
// the indicator enum names are enough
|
|
159
|
+
if (indicatorId >= Indicator["LCD backlight"]
|
|
160
|
+
&& indicatorId <= Indicator["Button 12 indication"]
|
|
161
|
+
&& (propertyId === 0x01 /* Multilevel */
|
|
162
|
+
|| propertyId === 0x02 /* Binary */
|
|
163
|
+
|| overridePropertyLabel) // custom property label
|
|
164
|
+
) {
|
|
165
|
+
let ret = Indicator[indicatorId];
|
|
166
|
+
// Append the overridden property label if it exists
|
|
167
|
+
if (overridePropertyLabel) {
|
|
168
|
+
ret += ` - ${overridePropertyLabel}`;
|
|
169
|
+
}
|
|
170
|
+
return ret;
|
|
171
|
+
}
|
|
172
|
+
// Default to the current behavior of <indicator name> - <property label>
|
|
173
|
+
return `${defaultName} - ${overridePropertyLabel || prop.label}`;
|
|
174
|
+
}
|
|
175
|
+
export function shouldExposeIndicatorValue(indicatorId, propertyId) {
|
|
176
|
+
// Many possible indicator values are not suitable to be exposed as CC values,
|
|
177
|
+
// usually because they need to be set in groups.
|
|
178
|
+
// Indicator properties that should be exposed are marked as such
|
|
179
|
+
const prop = getIndicatorProperty(propertyId);
|
|
180
|
+
if (prop && !prop.exposeAsValue) {
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
183
|
+
// Unless we know better, expose anyways
|
|
184
|
+
return true;
|
|
185
|
+
}
|
|
147
186
|
let IndicatorCCAPI = (() => {
|
|
148
187
|
let _classDecorators = [API(CommandClasses.Indicator)];
|
|
149
188
|
let _classDescriptor;
|
|
@@ -205,6 +244,12 @@ let IndicatorCCAPI = (() => {
|
|
|
205
244
|
}
|
|
206
245
|
get [SET_VALUE]() {
|
|
207
246
|
return async function ({ property, propertyKey }, value) {
|
|
247
|
+
const valueId = {
|
|
248
|
+
commandClass: this.ccId,
|
|
249
|
+
endpoint: this.endpoint.index,
|
|
250
|
+
property,
|
|
251
|
+
propertyKey,
|
|
252
|
+
};
|
|
208
253
|
if (property === "value") {
|
|
209
254
|
// V1 value
|
|
210
255
|
if (typeof value !== "number") {
|
|
@@ -212,8 +257,7 @@ let IndicatorCCAPI = (() => {
|
|
|
212
257
|
}
|
|
213
258
|
return this.set(value);
|
|
214
259
|
}
|
|
215
|
-
else if (
|
|
216
|
-
&& typeof propertyKey === "number") {
|
|
260
|
+
else if (IndicatorCCValues.valueV2.is(valueId)) {
|
|
217
261
|
const indicatorId = property;
|
|
218
262
|
const propertyId = propertyKey;
|
|
219
263
|
const expectedType = getIndicatorMetadata(indicatorId, propertyId).type;
|
|
@@ -223,13 +267,20 @@ let IndicatorCCAPI = (() => {
|
|
|
223
267
|
}
|
|
224
268
|
return this.set([
|
|
225
269
|
{
|
|
226
|
-
indicatorId
|
|
227
|
-
propertyId
|
|
270
|
+
indicatorId,
|
|
271
|
+
propertyId,
|
|
228
272
|
value: value,
|
|
229
273
|
},
|
|
230
274
|
]);
|
|
231
275
|
}
|
|
232
|
-
else if (
|
|
276
|
+
else if (IndicatorCCValues.timeout.is(valueId)) {
|
|
277
|
+
const indicatorId = property;
|
|
278
|
+
if (typeof value !== "string") {
|
|
279
|
+
throwWrongValueType(this.ccId, property, "string", typeof value);
|
|
280
|
+
}
|
|
281
|
+
return this.setTimeout(indicatorId, value);
|
|
282
|
+
}
|
|
283
|
+
else if (IndicatorCCValues.identify.is(valueId)) {
|
|
233
284
|
if (typeof value !== "boolean") {
|
|
234
285
|
throwWrongValueType(this.ccId, property, "boolean", typeof value);
|
|
235
286
|
}
|
|
@@ -509,7 +560,9 @@ let IndicatorCC = (() => {
|
|
|
509
560
|
});
|
|
510
561
|
return;
|
|
511
562
|
}
|
|
512
|
-
|
|
563
|
+
if (supportedResponse.supportedProperties.length > 0) {
|
|
564
|
+
supportedIndicatorIds.push(supportedResponse.indicatorId ?? curId);
|
|
565
|
+
}
|
|
513
566
|
curId = supportedResponse.nextIndicatorId;
|
|
514
567
|
} while (curId !== 0x00);
|
|
515
568
|
// The IDs are not stored by the report CCs so store them here once we have all of them
|
|
@@ -578,13 +631,19 @@ let IndicatorCC = (() => {
|
|
|
578
631
|
if (prop)
|
|
579
632
|
return prop.label;
|
|
580
633
|
}
|
|
634
|
+
else if (typeof property === "number"
|
|
635
|
+
&& propertyKey === "timeout") {
|
|
636
|
+
return "Timeout";
|
|
637
|
+
}
|
|
581
638
|
return super.translatePropertyKey(ctx, property, propertyKey);
|
|
582
639
|
}
|
|
583
640
|
translateProperty(ctx, property, propertyKey) {
|
|
584
|
-
if (typeof property === "number"
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
641
|
+
if (typeof property === "number") {
|
|
642
|
+
if (typeof propertyKey === "number" || propertyKey === "timeout") {
|
|
643
|
+
// The indicator corresponds to our property
|
|
644
|
+
if (property in Indicator)
|
|
645
|
+
return Indicator[property];
|
|
646
|
+
}
|
|
588
647
|
}
|
|
589
648
|
return super.translateProperty(ctx, property, propertyKey);
|
|
590
649
|
}
|
|
@@ -596,6 +655,11 @@ let IndicatorCC = (() => {
|
|
|
596
655
|
// Then test if there are any property ids defined
|
|
597
656
|
return supportedIndicatorIds.some((indicatorId) => !!this.getValue(ctx, IndicatorCCValues.supportedPropertyIDs(indicatorId))?.length);
|
|
598
657
|
}
|
|
658
|
+
getManufacturerDefinedIndicatorLabel(ctx, indicatorId) {
|
|
659
|
+
if (isManufacturerDefinedIndicator(indicatorId)) {
|
|
660
|
+
return this.getValue(ctx, IndicatorCCValues.indicatorDescription(indicatorId));
|
|
661
|
+
}
|
|
662
|
+
}
|
|
599
663
|
static getSupportedPropertyIDsCached(ctx, endpoint, indicatorId) {
|
|
600
664
|
return ctx
|
|
601
665
|
.getValueDB(endpoint.nodeId)
|
|
@@ -812,17 +876,36 @@ let IndicatorCCReport = (() => {
|
|
|
812
876
|
this.setIndicatorValue(ctx, value);
|
|
813
877
|
}
|
|
814
878
|
// Then group values into the convenience properties
|
|
815
|
-
|
|
816
|
-
const
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
879
|
+
const groupedValues = groupByIndicatorId(this.values);
|
|
880
|
+
for (const [indicatorId, values] of groupedValues) {
|
|
881
|
+
// Some devices report all properties it supports in every report,
|
|
882
|
+
// even if it does not support all properties for the given indicator ID.
|
|
883
|
+
// To avoid confusion, we need to filter out the unsupported properties
|
|
884
|
+
const supportedPropertyIDs = this.getValue(ctx, IndicatorCCValues.supportedPropertyIDs(indicatorId)) ?? [];
|
|
885
|
+
const filteredValues = values.filter((v) => supportedPropertyIDs.includes(v.propertyId));
|
|
886
|
+
const overrideIndicatorLabel = this
|
|
887
|
+
.getManufacturerDefinedIndicatorLabel(ctx, indicatorId);
|
|
888
|
+
// ... timeout
|
|
889
|
+
const timeout = indicatorObjectsToTimeout(filteredValues);
|
|
890
|
+
if (timeout) {
|
|
891
|
+
let timeoutString = "";
|
|
892
|
+
if (timeout?.hours)
|
|
893
|
+
timeoutString += `${timeout.hours}h`;
|
|
894
|
+
if (timeout?.minutes) {
|
|
895
|
+
timeoutString += `${timeout.minutes}m`;
|
|
896
|
+
}
|
|
897
|
+
if (timeout?.seconds) {
|
|
898
|
+
timeoutString += `${timeout.seconds}s`;
|
|
899
|
+
}
|
|
900
|
+
const timeoutValue = IndicatorCCValues.timeout(indicatorId);
|
|
901
|
+
const metadata = {
|
|
902
|
+
...timeoutValue.meta,
|
|
903
|
+
label: getIndicatorLabel(indicatorId, 0x06, // This is actually ignored, but pass a valid ID for clarity
|
|
904
|
+
overrideIndicatorLabel, "Timeout"),
|
|
905
|
+
};
|
|
906
|
+
this.setMetadata(ctx, timeoutValue, metadata);
|
|
907
|
+
this.setValue(ctx, timeoutValue, timeoutString);
|
|
908
|
+
}
|
|
826
909
|
}
|
|
827
910
|
}
|
|
828
911
|
return true;
|
|
@@ -831,14 +914,24 @@ let IndicatorCCReport = (() => {
|
|
|
831
914
|
values;
|
|
832
915
|
setIndicatorValue(ctx, value) {
|
|
833
916
|
// Manufacturer-defined indicators may need a custom label
|
|
834
|
-
const overrideIndicatorLabel =
|
|
835
|
-
|
|
836
|
-
: undefined;
|
|
917
|
+
const overrideIndicatorLabel = this
|
|
918
|
+
.getManufacturerDefinedIndicatorLabel(ctx, value.indicatorId);
|
|
837
919
|
const metadata = getIndicatorMetadata(value.indicatorId, value.propertyId, overrideIndicatorLabel);
|
|
838
920
|
// Some values need to be converted
|
|
839
921
|
if (metadata.type === "boolean") {
|
|
840
922
|
value.value = !!value.value;
|
|
841
923
|
}
|
|
924
|
+
// Only expose the value if it should be user-facing
|
|
925
|
+
if (value.indicatorId === Indicator["Node Identify"]) {
|
|
926
|
+
return;
|
|
927
|
+
}
|
|
928
|
+
const prop = getIndicatorProperty(value.propertyId);
|
|
929
|
+
if (!prop?.exposeAsValue)
|
|
930
|
+
return;
|
|
931
|
+
// And only if it is actually supported and not just reported by accident
|
|
932
|
+
const supportedPropertyIDs = this.getValue(ctx, IndicatorCCValues.supportedPropertyIDs(value.indicatorId)) ?? [];
|
|
933
|
+
if (!supportedPropertyIDs.includes(value.propertyId))
|
|
934
|
+
return;
|
|
842
935
|
// Publish the value
|
|
843
936
|
const valueV2 = IndicatorCCValues.valueV2(value.indicatorId, value.propertyId);
|
|
844
937
|
this.setMetadata(ctx, valueV2, metadata);
|