@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.
@@ -35,32 +35,6 @@ export declare const BatteryCCValues: Readonly<{
35
35
  readonly autoCreate: true;
36
36
  };
37
37
  };
38
- isLow: {
39
- id: {
40
- readonly commandClass: CommandClasses.Battery;
41
- readonly property: "isLow";
42
- };
43
- endpoint: (endpoint?: number) => {
44
- readonly commandClass: CommandClasses.Battery;
45
- readonly endpoint: number;
46
- readonly property: "isLow";
47
- };
48
- is: (valueId: import("@zwave-js/core").ValueID) => boolean;
49
- readonly meta: {
50
- readonly label: "Low battery level";
51
- readonly writeable: false;
52
- readonly type: "boolean";
53
- readonly readable: true;
54
- };
55
- options: {
56
- readonly internal: false;
57
- readonly minVersion: 1;
58
- readonly secret: false;
59
- readonly stateful: true;
60
- readonly supportsEndpoints: true;
61
- readonly autoCreate: true;
62
- };
63
- };
64
38
  maximumCapacity: {
65
39
  id: {
66
40
  readonly commandClass: CommandClasses.Battery;
@@ -337,7 +311,7 @@ export declare const BatteryCCValues: Readonly<{
337
311
  export declare class BatteryCCAPI extends PhysicalCCAPI {
338
312
  supportsCommand(cmd: BatteryCommand): MaybeNotKnown<boolean>;
339
313
  protected get [POLL_VALUE](): PollValueImplementation;
340
- get(): Promise<Pick<BatteryCCReport, "level" | "isLow" | "chargingStatus" | "rechargeable" | "backup" | "overheating" | "lowFluid" | "rechargeOrReplace" | "disconnected" | "lowTemperatureStatus"> | undefined>;
314
+ get(): Promise<Pick<BatteryCCReport, "level" | "chargingStatus" | "rechargeable" | "backup" | "overheating" | "lowFluid" | "rechargeOrReplace" | "disconnected" | "lowTemperatureStatus"> | undefined>;
341
315
  getHealth(): Promise<Pick<BatteryCCHealthReport, "maximumCapacity" | "temperature"> | undefined>;
342
316
  }
343
317
  export declare class BatteryCC extends CommandClass {
@@ -346,13 +320,9 @@ export declare class BatteryCC extends CommandClass {
346
320
  refreshValues(ctx: RefreshValuesContext): Promise<void>;
347
321
  shouldRefreshValues(this: SinglecastCC<this>, ctx: GetValueDB & GetSupportedCCVersion & GetDeviceConfig & GetNode<NodeId & GetEndpoint<EndpointId & SupportsCC & ControlsCC>>): boolean;
348
322
  }
349
- export type BatteryCCReportOptions = ({
350
- isLow?: false;
351
- level: number;
352
- } | {
353
- isLow: true;
354
- level?: undefined;
355
- }) & AllOrNone<{
323
+ export type BatteryCCReportOptions = {
324
+ level: number | "low";
325
+ } & AllOrNone<{
356
326
  chargingStatus: BatteryChargingStatus;
357
327
  rechargeable: boolean;
358
328
  backup: boolean;
@@ -368,7 +338,6 @@ export declare class BatteryCCReport extends BatteryCC {
368
338
  static from(raw: CCRaw, ctx: CCParsingContext): BatteryCCReport;
369
339
  persistValues(ctx: PersistValuesContext): boolean;
370
340
  readonly level: number;
371
- readonly isLow: boolean;
372
341
  readonly chargingStatus: BatteryChargingStatus | undefined;
373
342
  readonly rechargeable: boolean | undefined;
374
343
  readonly backup: boolean | undefined;
@@ -111,7 +111,6 @@ let BatteryCCAPI = (() => {
111
111
  return async function({ property }) {
112
112
  switch (property) {
113
113
  case "level":
114
- case "isLow":
115
114
  case "chargingStatus":
116
115
  case "rechargeable":
117
116
  case "backup":
@@ -140,7 +139,6 @@ let BatteryCCAPI = (() => {
140
139
  if (response) {
141
140
  return (0, import_shared.pick)(response, [
142
141
  "level",
143
- "isLow",
144
142
  "chargingStatus",
145
143
  "rechargeable",
146
144
  "backup",
@@ -211,7 +209,7 @@ let BatteryCC = (() => {
211
209
  const batteryStatus = await api.get();
212
210
  if (batteryStatus) {
213
211
  let logMessage = `received response for battery information:
214
- level: ${batteryStatus.level}${batteryStatus.isLow ? " (low)" : ""}`;
212
+ level: ${batteryStatus.level === 255 ? "low" : batteryStatus.level + " %"}`;
215
213
  if (api.version >= 2) {
216
214
  logMessage += `
217
215
  status: ${import_Types.BatteryChargingStatus[batteryStatus.chargingStatus]}
@@ -259,7 +257,7 @@ temperature: ${batteryHealth.temperature} \xB0C`;
259
257
  return BatteryCC2 = _classThis;
260
258
  })();
261
259
  let BatteryCCReport = (() => {
262
- let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.BatteryCommand.Report), (0, import_CommandClassDecorators.ccValueProperty)("level", import_CCValues_generated.BatteryCCValues.level), (0, import_CommandClassDecorators.ccValueProperty)("isLow", import_CCValues_generated.BatteryCCValues.isLow), (0, import_CommandClassDecorators.ccValueProperty)("chargingStatus", import_CCValues_generated.BatteryCCValues.chargingStatus), (0, import_CommandClassDecorators.ccValueProperty)("rechargeable", import_CCValues_generated.BatteryCCValues.rechargeable), (0, import_CommandClassDecorators.ccValueProperty)("backup", import_CCValues_generated.BatteryCCValues.backup), (0, import_CommandClassDecorators.ccValueProperty)("overheating", import_CCValues_generated.BatteryCCValues.overheating), (0, import_CommandClassDecorators.ccValueProperty)("lowFluid", import_CCValues_generated.BatteryCCValues.lowFluid), (0, import_CommandClassDecorators.ccValueProperty)("rechargeOrReplace", import_CCValues_generated.BatteryCCValues.rechargeOrReplace), (0, import_CommandClassDecorators.ccValueProperty)("disconnected", import_CCValues_generated.BatteryCCValues.disconnected), (0, import_CommandClassDecorators.ccValueProperty)("lowTemperatureStatus", import_CCValues_generated.BatteryCCValues.lowTemperatureStatus)];
260
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.BatteryCommand.Report), (0, import_CommandClassDecorators.ccValueProperty)("level", import_CCValues_generated.BatteryCCValues.level), (0, import_CommandClassDecorators.ccValueProperty)("chargingStatus", import_CCValues_generated.BatteryCCValues.chargingStatus), (0, import_CommandClassDecorators.ccValueProperty)("rechargeable", import_CCValues_generated.BatteryCCValues.rechargeable), (0, import_CommandClassDecorators.ccValueProperty)("backup", import_CCValues_generated.BatteryCCValues.backup), (0, import_CommandClassDecorators.ccValueProperty)("overheating", import_CCValues_generated.BatteryCCValues.overheating), (0, import_CommandClassDecorators.ccValueProperty)("lowFluid", import_CCValues_generated.BatteryCCValues.lowFluid), (0, import_CommandClassDecorators.ccValueProperty)("rechargeOrReplace", import_CCValues_generated.BatteryCCValues.rechargeOrReplace), (0, import_CommandClassDecorators.ccValueProperty)("disconnected", import_CCValues_generated.BatteryCCValues.disconnected), (0, import_CommandClassDecorators.ccValueProperty)("lowTemperatureStatus", import_CCValues_generated.BatteryCCValues.lowTemperatureStatus)];
263
261
  let _classDescriptor;
264
262
  let _classExtraInitializers = [];
265
263
  let _classThis;
@@ -280,8 +278,7 @@ let BatteryCCReport = (() => {
280
278
  }
281
279
  constructor(options) {
282
280
  super(options);
283
- this.level = options.isLow ? 0 : options.level;
284
- this.isLow = !!options.isLow;
281
+ this.level = typeof options.level === "number" ? options.level : 255;
285
282
  this.chargingStatus = options.chargingStatus;
286
283
  this.rechargeable = options.rechargeable;
287
284
  this.backup = options.backup;
@@ -295,16 +292,9 @@ let BatteryCCReport = (() => {
295
292
  let ccOptions;
296
293
  (0, import_core.validatePayload)(raw.payload.length >= 1);
297
294
  const level = raw.payload[0];
298
- if (level === 255) {
299
- ccOptions = {
300
- isLow: true
301
- };
302
- } else {
303
- ccOptions = {
304
- isLow: false,
305
- level
306
- };
307
- }
295
+ ccOptions = {
296
+ level
297
+ };
308
298
  if (raw.payload.length >= 3) {
309
299
  const chargingStatus = raw.payload[1] >>> 6;
310
300
  const rechargeable = !!(raw.payload[1] & 32);
@@ -332,8 +322,14 @@ let BatteryCCReport = (() => {
332
322
  });
333
323
  }
334
324
  persistValues(ctx) {
325
+ if (this.level === 255) {
326
+ this.level = void 0;
327
+ }
335
328
  if (!super.persistValues(ctx))
336
329
  return false;
330
+ if (this.level === void 0) {
331
+ this.level = 255;
332
+ }
337
333
  if (this.level >= 90) {
338
334
  const notificationCCVersion = ctx.getSupportedCCVersion(import_core.CommandClasses.Notification, this.nodeId, this.endpointIndex);
339
335
  if (
@@ -349,7 +345,6 @@ let BatteryCCReport = (() => {
349
345
  return true;
350
346
  }
351
347
  level;
352
- isLow;
353
348
  chargingStatus;
354
349
  rechargeable;
355
350
  backup;
@@ -359,7 +354,7 @@ let BatteryCCReport = (() => {
359
354
  disconnected;
360
355
  lowTemperatureStatus;
361
356
  serialize(ctx) {
362
- this.payload = import_shared.Bytes.from([this.isLow ? 255 : this.level]);
357
+ this.payload = import_shared.Bytes.from([this.level]);
363
358
  if (this.chargingStatus != void 0) {
364
359
  this.payload = import_shared.Bytes.concat([
365
360
  this.payload,
@@ -372,10 +367,7 @@ let BatteryCCReport = (() => {
372
367
  return super.serialize(ctx);
373
368
  }
374
369
  toLogEntry(ctx) {
375
- const message = {
376
- level: this.level,
377
- "is low": this.isLow
378
- };
370
+ const message = this.level === 255 ? { "is low": true } : { level: this.level };
379
371
  if (this.chargingStatus != void 0) {
380
372
  message["charging status"] = (0, import_shared.getEnumMemberName)(import_Types.BatteryChargingStatus, this.chargingStatus);
381
373
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/cc/BatteryCC.ts"],
4
- "sourcesContent": ["import type { CCEncodingContext, CCParsingContext } from \"@zwave-js/cc\";\nimport type { GetDeviceConfig } from \"@zwave-js/config\";\nimport {\n\tCommandClasses,\n\ttype ControlsCC,\n\ttype EndpointId,\n\ttype GetEndpoint,\n\ttype GetNode,\n\ttype GetSupportedCCVersion,\n\ttype GetValueDB,\n\ttype MaybeNotKnown,\n\ttype MessageOrCCLogEntry,\n\tMessagePriority,\n\ttype MessageRecord,\n\ttype NodeId,\n\ttype SinglecastCC,\n\ttype SupportsCC,\n\tValueMetadata,\n\ttype WithAddress,\n\tencodeFloatWithScale,\n\tenumValuesToMetadataStates,\n\tparseFloatWithScale,\n\ttimespan,\n\tvalidatePayload,\n} from \"@zwave-js/core\";\nimport {\n\ttype AllOrNone,\n\tBytes,\n\tgetEnumMemberName,\n\tpick,\n} from \"@zwave-js/shared\";\nimport {\n\tCCAPI,\n\tPOLL_VALUE,\n\tPhysicalCCAPI,\n\ttype PollValueImplementation,\n\tthrowUnsupportedProperty,\n} from \"../lib/API.js\";\nimport {\n\ttype CCRaw,\n\tCommandClass,\n\ttype InterviewContext,\n\ttype PersistValuesContext,\n\ttype RefreshValuesContext,\n} from \"../lib/CommandClass.js\";\nimport {\n\tAPI,\n\tCCCommand,\n\tccValueProperty,\n\tccValues,\n\tcommandClass,\n\texpectedCCResponse,\n\timplementedVersion,\n} from \"../lib/CommandClassDecorators.js\";\nimport { V } from \"../lib/Values.js\";\nimport {\n\tBatteryChargingStatus,\n\tBatteryCommand,\n\tBatteryReplacementStatus,\n} from \"../lib/_Types.js\";\nimport { NotificationCCValues } from \"./NotificationCC.js\";\n\nexport const BatteryCCValues = V.defineCCValues(CommandClasses.Battery, {\n\t...V.staticProperty(\n\t\t\"level\",\n\t\t{\n\t\t\t...ValueMetadata.ReadOnlyUInt8,\n\t\t\tmax: 100,\n\t\t\tunit: \"%\",\n\t\t\tlabel: \"Battery level\",\n\t\t} as const,\n\t),\n\n\t...V.staticProperty(\n\t\t\"isLow\",\n\t\t{\n\t\t\t...ValueMetadata.ReadOnlyBoolean,\n\t\t\tlabel: \"Low battery level\",\n\t\t} as const,\n\t),\n\n\t...V.staticProperty(\n\t\t\"maximumCapacity\",\n\t\t{\n\t\t\t...ValueMetadata.ReadOnlyUInt8,\n\t\t\tmax: 100,\n\t\t\tunit: \"%\",\n\t\t\tlabel: \"Maximum capacity\",\n\t\t} as const,\n\t\t{\n\t\t\tminVersion: 2,\n\t\t} as const,\n\t),\n\n\t...V.staticProperty(\n\t\t\"temperature\",\n\t\t{\n\t\t\t...ValueMetadata.ReadOnlyInt8,\n\t\t\tlabel: \"Temperature\",\n\t\t\t// For now, only \u00B0C is specified as a valid unit\n\t\t\t// If this ever changes, update the unit in persistValues on the fly\n\t\t\tunit: \"\u00B0C\",\n\t\t} as const,\n\t\t{\n\t\t\tminVersion: 2,\n\t\t} as const,\n\t),\n\n\t...V.staticProperty(\n\t\t\"chargingStatus\",\n\t\t{\n\t\t\t...ValueMetadata.ReadOnlyUInt8,\n\t\t\tlabel: \"Charging status\",\n\t\t\tstates: enumValuesToMetadataStates(BatteryChargingStatus),\n\t\t} as const,\n\t\t{\n\t\t\tminVersion: 2,\n\t\t} as const,\n\t),\n\n\t...V.staticProperty(\n\t\t\"rechargeable\",\n\t\t{\n\t\t\t...ValueMetadata.ReadOnlyBoolean,\n\t\t\tlabel: \"Rechargeable\",\n\t\t} as const,\n\t\t{\n\t\t\tminVersion: 2,\n\t\t} as const,\n\t),\n\n\t...V.staticProperty(\n\t\t\"backup\",\n\t\t{\n\t\t\t...ValueMetadata.ReadOnlyBoolean,\n\t\t\tlabel: \"Used as backup\",\n\t\t} as const,\n\t\t{\n\t\t\tminVersion: 2,\n\t\t} as const,\n\t),\n\n\t...V.staticProperty(\n\t\t\"overheating\",\n\t\t{\n\t\t\t...ValueMetadata.ReadOnlyBoolean,\n\t\t\tlabel: \"Overheating\",\n\t\t} as const,\n\t\t{\n\t\t\tminVersion: 2,\n\t\t} as const,\n\t),\n\n\t...V.staticProperty(\n\t\t\"lowFluid\",\n\t\t{\n\t\t\t...ValueMetadata.ReadOnlyBoolean,\n\t\t\tlabel: \"Fluid is low\",\n\t\t} as const,\n\t\t{\n\t\t\tminVersion: 2,\n\t\t} as const,\n\t),\n\n\t...V.staticProperty(\n\t\t\"rechargeOrReplace\",\n\t\t{\n\t\t\t...ValueMetadata.ReadOnlyUInt8,\n\t\t\tlabel: \"Recharge or replace\",\n\t\t\tstates: enumValuesToMetadataStates(BatteryReplacementStatus),\n\t\t} as const,\n\t\t{\n\t\t\tminVersion: 2,\n\t\t} as const,\n\t),\n\n\t...V.staticProperty(\n\t\t\"disconnected\",\n\t\t{\n\t\t\t...ValueMetadata.ReadOnlyBoolean,\n\t\t\tlabel: \"Battery is disconnected\",\n\t\t} as const,\n\t\t{\n\t\t\tminVersion: 2,\n\t\t} as const,\n\t),\n\n\t...V.staticProperty(\n\t\t\"lowTemperatureStatus\",\n\t\t{\n\t\t\t...ValueMetadata.ReadOnlyBoolean,\n\t\t\tlabel: \"Battery temperature is low\",\n\t\t} as const,\n\t\t{\n\t\t\tminVersion: 3,\n\t\t} as const,\n\t),\n});\n\n// @noSetValueAPI This CC is read-only\n\n@API(CommandClasses.Battery)\nexport class BatteryCCAPI extends PhysicalCCAPI {\n\tpublic supportsCommand(cmd: BatteryCommand): MaybeNotKnown<boolean> {\n\t\tswitch (cmd) {\n\t\t\tcase BatteryCommand.Get:\n\t\t\t\treturn true; // This is mandatory\n\t\t\tcase BatteryCommand.HealthGet:\n\t\t\t\treturn this.version >= 2;\n\t\t}\n\t\treturn super.supportsCommand(cmd);\n\t}\n\n\tprotected get [POLL_VALUE](): PollValueImplementation {\n\t\treturn async function(this: BatteryCCAPI, { property }) {\n\t\t\tswitch (property) {\n\t\t\t\tcase \"level\":\n\t\t\t\tcase \"isLow\":\n\t\t\t\tcase \"chargingStatus\":\n\t\t\t\tcase \"rechargeable\":\n\t\t\t\tcase \"backup\":\n\t\t\t\tcase \"overheating\":\n\t\t\t\tcase \"lowFluid\":\n\t\t\t\tcase \"rechargeOrReplace\":\n\t\t\t\tcase \"lowTemperatureStatus\":\n\t\t\t\tcase \"disconnected\":\n\t\t\t\t\treturn (await this.get())?.[property];\n\n\t\t\t\tcase \"maximumCapacity\":\n\t\t\t\tcase \"temperature\":\n\t\t\t\t\treturn (await this.getHealth())?.[property];\n\n\t\t\t\tdefault:\n\t\t\t\t\tthrowUnsupportedProperty(this.ccId, property);\n\t\t\t}\n\t\t};\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n\tpublic async get() {\n\t\tthis.assertSupportsCommand(BatteryCommand, BatteryCommand.Get);\n\n\t\tconst cc = new BatteryCCGet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t});\n\t\tconst response = await this.host.sendCommand<BatteryCCReport>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\tif (response) {\n\t\t\treturn pick(response, [\n\t\t\t\t\"level\",\n\t\t\t\t\"isLow\",\n\t\t\t\t\"chargingStatus\",\n\t\t\t\t\"rechargeable\",\n\t\t\t\t\"backup\",\n\t\t\t\t\"overheating\",\n\t\t\t\t\"lowFluid\",\n\t\t\t\t\"rechargeOrReplace\",\n\t\t\t\t\"lowTemperatureStatus\",\n\t\t\t\t\"disconnected\",\n\t\t\t]);\n\t\t}\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n\tpublic async getHealth() {\n\t\tthis.assertSupportsCommand(BatteryCommand, BatteryCommand.HealthGet);\n\n\t\tconst cc = new BatteryCCHealthGet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t});\n\t\tconst response = await this.host.sendCommand<BatteryCCHealthReport>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\tif (response) {\n\t\t\treturn pick(response, [\"maximumCapacity\", \"temperature\"]);\n\t\t}\n\t}\n}\n\n@commandClass(CommandClasses.Battery)\n@implementedVersion(3)\n@ccValues(BatteryCCValues)\nexport class BatteryCC extends CommandClass {\n\tdeclare ccCommand: BatteryCommand;\n\n\tpublic async interview(\n\t\tctx: InterviewContext,\n\t): Promise<void> {\n\t\tconst node = this.getNode(ctx)!;\n\n\t\tctx.logNode(node.id, {\n\t\t\tendpoint: this.endpointIndex,\n\t\t\tmessage: `Interviewing ${this.ccName}...`,\n\t\t\tdirection: \"none\",\n\t\t});\n\n\t\t// Query the Battery status\n\t\tawait this.refreshValues(ctx);\n\n\t\t// Remember that the interview is complete\n\t\tthis.setInterviewComplete(ctx, true);\n\t}\n\n\tpublic async refreshValues(\n\t\tctx: RefreshValuesContext,\n\t): Promise<void> {\n\t\tconst node = this.getNode(ctx)!;\n\t\tconst endpoint = this.getEndpoint(ctx)!;\n\t\tconst api = CCAPI.create(\n\t\t\tCommandClasses.Battery,\n\t\t\tctx,\n\t\t\tendpoint,\n\t\t).withOptions({\n\t\t\tpriority: MessagePriority.NodeQuery,\n\t\t});\n\n\t\tctx.logNode(node.id, {\n\t\t\tendpoint: this.endpointIndex,\n\t\t\tmessage: \"querying battery status...\",\n\t\t\tdirection: \"outbound\",\n\t\t});\n\n\t\tconst batteryStatus = await api.get();\n\t\tif (batteryStatus) {\n\t\t\tlet logMessage = `received response for battery information:\nlevel: ${batteryStatus.level}${\n\t\t\t\tbatteryStatus.isLow ? \" (low)\" : \"\"\n\t\t\t}`;\n\t\t\tif (api.version >= 2) {\n\t\t\t\tlogMessage += `\nstatus: ${\n\t\t\t\t\tBatteryChargingStatus[batteryStatus.chargingStatus!]\n\t\t\t\t}\nrechargeable: ${batteryStatus.rechargeable}\nis backup: ${batteryStatus.backup}\nis overheating: ${batteryStatus.overheating}\nfluid is low: ${batteryStatus.lowFluid}\nneeds to be replaced or charged: ${\n\t\t\t\t\tBatteryReplacementStatus[batteryStatus.rechargeOrReplace!]\n\t\t\t\t}\nis low temperature ${batteryStatus.lowTemperatureStatus}\nis disconnected: ${batteryStatus.disconnected}`;\n\t\t\t}\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage: logMessage,\n\t\t\t\tdirection: \"inbound\",\n\t\t\t});\n\t\t}\n\n\t\tif (api.version >= 2) {\n\t\t\t// always query the health\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage: \"querying battery health...\",\n\t\t\t\tdirection: \"outbound\",\n\t\t\t});\n\n\t\t\tconst batteryHealth = await api.getHealth();\n\t\t\tif (batteryHealth) {\n\t\t\t\tconst logMessage = `received response for battery health:\nmax. capacity: ${batteryHealth.maximumCapacity} %\ntemperature: ${batteryHealth.temperature} \u00B0C`;\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\t\tmessage: logMessage,\n\t\t\t\t\tdirection: \"inbound\",\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic shouldRefreshValues(\n\t\tthis: SinglecastCC<this>,\n\t\tctx:\n\t\t\t& GetValueDB\n\t\t\t& GetSupportedCCVersion\n\t\t\t& GetDeviceConfig\n\t\t\t& GetNode<\n\t\t\t\tNodeId & GetEndpoint<EndpointId & SupportsCC & ControlsCC>\n\t\t\t>,\n\t): boolean {\n\t\t// Check when the battery state was last updated\n\t\tconst valueDB = ctx.tryGetValueDB(this.nodeId);\n\t\tif (!valueDB) return true;\n\n\t\tconst lastUpdated = valueDB.getTimestamp(\n\t\t\tBatteryCCValues.level.endpoint(this.endpointIndex),\n\t\t);\n\t\treturn (\n\t\t\tlastUpdated == undefined\n\t\t\t// The specs say once per month, but that's a bit too unfrequent IMO\n\t\t\t// Also the maximum that setInterval supports is ~24.85 days\n\t\t\t|| Date.now() - lastUpdated > timespan.days(7)\n\t\t);\n\t}\n}\n\n// @publicAPI\nexport type BatteryCCReportOptions =\n\t& (\n\t\t| {\n\t\t\tisLow?: false;\n\t\t\tlevel: number;\n\t\t}\n\t\t| {\n\t\t\tisLow: true;\n\t\t\tlevel?: undefined;\n\t\t}\n\t)\n\t& AllOrNone<{\n\t\t// V2+\n\t\tchargingStatus: BatteryChargingStatus;\n\t\trechargeable: boolean;\n\t\tbackup: boolean;\n\t\toverheating: boolean;\n\t\tlowFluid: boolean;\n\t\trechargeOrReplace: BatteryReplacementStatus;\n\t\tdisconnected: boolean;\n\t}>\n\t& AllOrNone<{\n\t\t// V3+\n\t\tlowTemperatureStatus: boolean;\n\t}>;\n\n@CCCommand(BatteryCommand.Report)\n@ccValueProperty(\"level\", BatteryCCValues.level)\n@ccValueProperty(\"isLow\", BatteryCCValues.isLow)\n@ccValueProperty(\"chargingStatus\", BatteryCCValues.chargingStatus)\n@ccValueProperty(\"rechargeable\", BatteryCCValues.rechargeable)\n@ccValueProperty(\"backup\", BatteryCCValues.backup)\n@ccValueProperty(\"overheating\", BatteryCCValues.overheating)\n@ccValueProperty(\"lowFluid\", BatteryCCValues.lowFluid)\n@ccValueProperty(\"rechargeOrReplace\", BatteryCCValues.rechargeOrReplace)\n@ccValueProperty(\"disconnected\", BatteryCCValues.disconnected)\n@ccValueProperty(\"lowTemperatureStatus\", BatteryCCValues.lowTemperatureStatus)\nexport class BatteryCCReport extends BatteryCC {\n\tpublic constructor(\n\t\toptions: WithAddress<BatteryCCReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\tthis.level = options.isLow ? 0 : options.level;\n\t\tthis.isLow = !!options.isLow;\n\t\tthis.chargingStatus = options.chargingStatus;\n\t\tthis.rechargeable = options.rechargeable;\n\t\tthis.backup = options.backup;\n\t\tthis.overheating = options.overheating;\n\t\tthis.lowFluid = options.lowFluid;\n\t\tthis.rechargeOrReplace = options.rechargeOrReplace;\n\t\tthis.disconnected = options.disconnected;\n\t\tthis.lowTemperatureStatus = options.lowTemperatureStatus;\n\t}\n\n\tpublic static from(raw: CCRaw, ctx: CCParsingContext): BatteryCCReport {\n\t\tlet ccOptions: BatteryCCReportOptions;\n\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst level = raw.payload[0];\n\n\t\tif (level === 0xff) {\n\t\t\tccOptions = {\n\t\t\t\tisLow: true,\n\t\t\t};\n\t\t} else {\n\t\t\tccOptions = {\n\t\t\t\tisLow: false,\n\t\t\t\tlevel,\n\t\t\t};\n\t\t}\n\n\t\tif (raw.payload.length >= 3) {\n\t\t\t// Starting with V2\n\t\t\tconst chargingStatus: BatteryChargingStatus = raw.payload[1] >>> 6;\n\t\t\tconst rechargeable = !!(raw.payload[1] & 0b0010_0000);\n\t\t\tconst backup = !!(raw.payload[1] & 0b0001_0000);\n\t\t\tconst overheating = !!(raw.payload[1] & 0b1000);\n\t\t\tconst lowFluid = !!(raw.payload[1] & 0b0100);\n\t\t\tconst rechargeOrReplace: BatteryReplacementStatus =\n\t\t\t\t!!(raw.payload[1] & 0b10)\n\t\t\t\t\t? BatteryReplacementStatus.Now\n\t\t\t\t\t: !!(raw.payload[1] & 0b1)\n\t\t\t\t\t? BatteryReplacementStatus.Soon\n\t\t\t\t\t: BatteryReplacementStatus.No;\n\t\t\tconst lowTemperatureStatus = !!(raw.payload[2] & 0b10);\n\t\t\tconst disconnected = !!(raw.payload[2] & 0b1);\n\n\t\t\tccOptions = {\n\t\t\t\t...ccOptions,\n\t\t\t\tchargingStatus,\n\t\t\t\trechargeable,\n\t\t\t\tbackup,\n\t\t\t\toverheating,\n\t\t\t\tlowFluid,\n\t\t\t\trechargeOrReplace,\n\t\t\t\tlowTemperatureStatus,\n\t\t\t\tdisconnected,\n\t\t\t};\n\t\t}\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\t...ccOptions,\n\t\t});\n\t}\n\n\tpublic persistValues(ctx: PersistValuesContext): boolean {\n\t\tif (!super.persistValues(ctx)) return false;\n\n\t\t// Na\u00EFve heuristic for a full battery\n\t\tif (this.level >= 90) {\n\t\t\t// Some devices send Notification CC Reports with battery information,\n\t\t\t// or this information is mapped from legacy V1 alarm values.\n\t\t\t// We may need to idle the corresponding values when the battery is full\n\t\t\tconst notificationCCVersion = ctx.getSupportedCCVersion(\n\t\t\t\tCommandClasses.Notification,\n\t\t\t\tthis.nodeId as number,\n\t\t\t\tthis.endpointIndex,\n\t\t\t);\n\t\t\tif (\n\t\t\t\t// supported\n\t\t\t\tnotificationCCVersion > 0\n\t\t\t\t// but idling is not required\n\t\t\t\t&& notificationCCVersion < 8\n\t\t\t) {\n\t\t\t\tconst batteryLevelStatusValue = NotificationCCValues\n\t\t\t\t\t.notificationVariable(\n\t\t\t\t\t\t\"Power Management\",\n\t\t\t\t\t\t\"Battery level status\",\n\t\t\t\t\t);\n\t\t\t\t// If not undefined and not idle\n\t\t\t\tif (this.getValue(ctx, batteryLevelStatusValue)) {\n\t\t\t\t\tthis.setValue(\n\t\t\t\t\t\tctx,\n\t\t\t\t\t\tbatteryLevelStatusValue,\n\t\t\t\t\t\t0, /* idle */\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tpublic readonly level: number;\n\n\tpublic readonly isLow: boolean;\n\n\tpublic readonly chargingStatus: BatteryChargingStatus | undefined;\n\n\tpublic readonly rechargeable: boolean | undefined;\n\n\tpublic readonly backup: boolean | undefined;\n\n\tpublic readonly overheating: boolean | undefined;\n\n\tpublic readonly lowFluid: boolean | undefined;\n\n\tpublic readonly rechargeOrReplace: BatteryReplacementStatus | undefined;\n\n\tpublic readonly disconnected: boolean | undefined;\n\n\tpublic readonly lowTemperatureStatus: boolean | undefined;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.from([this.isLow ? 0xff : this.level]);\n\t\tif (this.chargingStatus != undefined) {\n\t\t\tthis.payload = Bytes.concat([\n\t\t\t\tthis.payload,\n\t\t\t\tBytes.from([\n\t\t\t\t\t(this.chargingStatus << 6)\n\t\t\t\t\t+ (this.rechargeable ? 0b0010_0000 : 0)\n\t\t\t\t\t+ (this.backup ? 0b0001_0000 : 0)\n\t\t\t\t\t+ (this.overheating ? 0b1000 : 0)\n\t\t\t\t\t+ (this.lowFluid ? 0b0100 : 0)\n\t\t\t\t\t+ (this.rechargeOrReplace === BatteryReplacementStatus.Now\n\t\t\t\t\t\t? 0b10\n\t\t\t\t\t\t: this.rechargeOrReplace\n\t\t\t\t\t\t\t\t=== BatteryReplacementStatus.Soon\n\t\t\t\t\t\t? 0b1\n\t\t\t\t\t\t: 0),\n\t\t\t\t\t(this.lowTemperatureStatus ? 0b10 : 0)\n\t\t\t\t\t+ (this.disconnected ? 0b1 : 0),\n\t\t\t\t]),\n\t\t\t]);\n\t\t}\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\tconst message: MessageRecord = {\n\t\t\tlevel: this.level,\n\t\t\t\"is low\": this.isLow,\n\t\t};\n\t\tif (this.chargingStatus != undefined) {\n\t\t\tmessage[\"charging status\"] = getEnumMemberName(\n\t\t\t\tBatteryChargingStatus,\n\t\t\t\tthis.chargingStatus,\n\t\t\t);\n\t\t}\n\t\tif (this.rechargeable != undefined) {\n\t\t\tmessage.rechargeable = this.rechargeable;\n\t\t}\n\t\tif (this.backup != undefined) {\n\t\t\tmessage.backup = this.backup;\n\t\t}\n\t\tif (this.overheating != undefined) {\n\t\t\tmessage.overheating = this.overheating;\n\t\t}\n\t\tif (this.lowFluid != undefined) {\n\t\t\tmessage[\"low fluid\"] = this.lowFluid;\n\t\t}\n\t\tif (this.rechargeOrReplace != undefined) {\n\t\t\tmessage[\"recharge or replace\"] = getEnumMemberName(\n\t\t\t\tBatteryReplacementStatus,\n\t\t\t\tthis.rechargeOrReplace,\n\t\t\t);\n\t\t}\n\t\tif (this.lowTemperatureStatus != undefined) {\n\t\t\tmessage.lowTemperatureStatus = this.lowTemperatureStatus;\n\t\t}\n\t\tif (this.disconnected != undefined) {\n\t\t\tmessage.disconnected = this.disconnected;\n\t\t}\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage,\n\t\t};\n\t}\n}\n\n@CCCommand(BatteryCommand.Get)\n@expectedCCResponse(BatteryCCReport)\nexport class BatteryCCGet extends BatteryCC {}\n\n// @publicAPI\nexport interface BatteryCCHealthReportOptions {\n\tmaximumCapacity?: number;\n\ttemperature?: number;\n\ttemperatureScale?: number;\n}\n\n@CCCommand(BatteryCommand.HealthReport)\n@ccValueProperty(\"maximumCapacity\", BatteryCCValues.maximumCapacity)\n@ccValueProperty(\"temperature\", BatteryCCValues.temperature)\nexport class BatteryCCHealthReport extends BatteryCC {\n\tpublic constructor(\n\t\toptions: WithAddress<BatteryCCHealthReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\t// TODO: Check implementation:\n\t\tthis.maximumCapacity = options.maximumCapacity;\n\t\tthis.temperature = options.temperature;\n\t\tthis.temperatureScale = options.temperatureScale;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): BatteryCCHealthReport {\n\t\tvalidatePayload(raw.payload.length >= 2);\n\t\t// Parse maximum capacity. 0xff means unknown\n\t\tlet maximumCapacity: number | undefined = raw.payload[0];\n\t\tif (maximumCapacity === 0xff) maximumCapacity = undefined;\n\t\tconst {\n\t\t\tvalue: temperature,\n\t\t\tscale: temperatureScale,\n\t\t} = parseFloatWithScale(\n\t\t\traw.payload.subarray(1),\n\t\t\ttrue, // The temperature field may be omitted\n\t\t);\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tmaximumCapacity,\n\t\t\ttemperature,\n\t\t\ttemperatureScale,\n\t\t});\n\t}\n\n\tpublic readonly maximumCapacity: number | undefined;\n\tpublic readonly temperature: number | undefined;\n\tprivate readonly temperatureScale: number | undefined;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tconst temperature = this.temperature != undefined\n\t\t\t? encodeFloatWithScale(\n\t\t\t\tthis.temperature,\n\t\t\t\tthis.temperatureScale ?? 0x00,\n\t\t\t)\n\t\t\t// size, precision and scale must be 0 if the temperature is omitted\n\t\t\t: Bytes.from([0x00]);\n\n\t\tthis.payload = Bytes.concat([\n\t\t\t[this.maximumCapacity ?? 0xff],\n\t\t\ttemperature,\n\t\t]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: {\n\t\t\t\ttemperature: this.temperature != undefined\n\t\t\t\t\t? this.temperature\n\t\t\t\t\t: \"unknown\",\n\t\t\t\t\"max capacity\": this.maximumCapacity != undefined\n\t\t\t\t\t? `${this.maximumCapacity} %`\n\t\t\t\t\t: \"unknown\",\n\t\t\t},\n\t\t};\n\t}\n}\n\n@CCCommand(BatteryCommand.HealthGet)\n@expectedCCResponse(BatteryCCHealthReport)\nexport class BatteryCCHealthGet extends BatteryCC {}\n"],
5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;;",
4
+ "sourcesContent": ["import type { CCEncodingContext, CCParsingContext } from \"@zwave-js/cc\";\nimport type { GetDeviceConfig } from \"@zwave-js/config\";\nimport {\n\tCommandClasses,\n\ttype ControlsCC,\n\ttype EndpointId,\n\ttype GetEndpoint,\n\ttype GetNode,\n\ttype GetSupportedCCVersion,\n\ttype GetValueDB,\n\ttype MaybeNotKnown,\n\ttype MessageOrCCLogEntry,\n\tMessagePriority,\n\ttype MessageRecord,\n\ttype NodeId,\n\ttype SinglecastCC,\n\ttype SupportsCC,\n\tValueMetadata,\n\ttype WithAddress,\n\tencodeFloatWithScale,\n\tenumValuesToMetadataStates,\n\tparseFloatWithScale,\n\ttimespan,\n\tvalidatePayload,\n} from \"@zwave-js/core\";\nimport {\n\ttype AllOrNone,\n\tBytes,\n\tgetEnumMemberName,\n\tpick,\n} from \"@zwave-js/shared\";\nimport {\n\tCCAPI,\n\tPOLL_VALUE,\n\tPhysicalCCAPI,\n\ttype PollValueImplementation,\n\tthrowUnsupportedProperty,\n} from \"../lib/API.js\";\nimport {\n\ttype CCRaw,\n\tCommandClass,\n\ttype InterviewContext,\n\ttype PersistValuesContext,\n\ttype RefreshValuesContext,\n} from \"../lib/CommandClass.js\";\nimport {\n\tAPI,\n\tCCCommand,\n\tccValueProperty,\n\tccValues,\n\tcommandClass,\n\texpectedCCResponse,\n\timplementedVersion,\n} from \"../lib/CommandClassDecorators.js\";\nimport { V } from \"../lib/Values.js\";\nimport {\n\tBatteryChargingStatus,\n\tBatteryCommand,\n\tBatteryReplacementStatus,\n} from \"../lib/_Types.js\";\nimport { NotificationCCValues } from \"./NotificationCC.js\";\n\nexport const BatteryCCValues = V.defineCCValues(CommandClasses.Battery, {\n\t...V.staticProperty(\n\t\t\"level\",\n\t\t{\n\t\t\t...ValueMetadata.ReadOnlyUInt8,\n\t\t\tmax: 100,\n\t\t\tunit: \"%\",\n\t\t\tlabel: \"Battery level\",\n\t\t} as const,\n\t),\n\n\t...V.staticProperty(\n\t\t\"maximumCapacity\",\n\t\t{\n\t\t\t...ValueMetadata.ReadOnlyUInt8,\n\t\t\tmax: 100,\n\t\t\tunit: \"%\",\n\t\t\tlabel: \"Maximum capacity\",\n\t\t} as const,\n\t\t{\n\t\t\tminVersion: 2,\n\t\t} as const,\n\t),\n\n\t...V.staticProperty(\n\t\t\"temperature\",\n\t\t{\n\t\t\t...ValueMetadata.ReadOnlyInt8,\n\t\t\tlabel: \"Temperature\",\n\t\t\t// For now, only \u00B0C is specified as a valid unit\n\t\t\t// If this ever changes, update the unit in persistValues on the fly\n\t\t\tunit: \"\u00B0C\",\n\t\t} as const,\n\t\t{\n\t\t\tminVersion: 2,\n\t\t} as const,\n\t),\n\n\t...V.staticProperty(\n\t\t\"chargingStatus\",\n\t\t{\n\t\t\t...ValueMetadata.ReadOnlyUInt8,\n\t\t\tlabel: \"Charging status\",\n\t\t\tstates: enumValuesToMetadataStates(BatteryChargingStatus),\n\t\t} as const,\n\t\t{\n\t\t\tminVersion: 2,\n\t\t} as const,\n\t),\n\n\t...V.staticProperty(\n\t\t\"rechargeable\",\n\t\t{\n\t\t\t...ValueMetadata.ReadOnlyBoolean,\n\t\t\tlabel: \"Rechargeable\",\n\t\t} as const,\n\t\t{\n\t\t\tminVersion: 2,\n\t\t} as const,\n\t),\n\n\t...V.staticProperty(\n\t\t\"backup\",\n\t\t{\n\t\t\t...ValueMetadata.ReadOnlyBoolean,\n\t\t\tlabel: \"Used as backup\",\n\t\t} as const,\n\t\t{\n\t\t\tminVersion: 2,\n\t\t} as const,\n\t),\n\n\t...V.staticProperty(\n\t\t\"overheating\",\n\t\t{\n\t\t\t...ValueMetadata.ReadOnlyBoolean,\n\t\t\tlabel: \"Overheating\",\n\t\t} as const,\n\t\t{\n\t\t\tminVersion: 2,\n\t\t} as const,\n\t),\n\n\t...V.staticProperty(\n\t\t\"lowFluid\",\n\t\t{\n\t\t\t...ValueMetadata.ReadOnlyBoolean,\n\t\t\tlabel: \"Fluid is low\",\n\t\t} as const,\n\t\t{\n\t\t\tminVersion: 2,\n\t\t} as const,\n\t),\n\n\t...V.staticProperty(\n\t\t\"rechargeOrReplace\",\n\t\t{\n\t\t\t...ValueMetadata.ReadOnlyUInt8,\n\t\t\tlabel: \"Recharge or replace\",\n\t\t\tstates: enumValuesToMetadataStates(BatteryReplacementStatus),\n\t\t} as const,\n\t\t{\n\t\t\tminVersion: 2,\n\t\t} as const,\n\t),\n\n\t...V.staticProperty(\n\t\t\"disconnected\",\n\t\t{\n\t\t\t...ValueMetadata.ReadOnlyBoolean,\n\t\t\tlabel: \"Battery is disconnected\",\n\t\t} as const,\n\t\t{\n\t\t\tminVersion: 2,\n\t\t} as const,\n\t),\n\n\t...V.staticProperty(\n\t\t\"lowTemperatureStatus\",\n\t\t{\n\t\t\t...ValueMetadata.ReadOnlyBoolean,\n\t\t\tlabel: \"Battery temperature is low\",\n\t\t} as const,\n\t\t{\n\t\t\tminVersion: 3,\n\t\t} as const,\n\t),\n});\n\n// @noSetValueAPI This CC is read-only\n\n@API(CommandClasses.Battery)\nexport class BatteryCCAPI extends PhysicalCCAPI {\n\tpublic supportsCommand(cmd: BatteryCommand): MaybeNotKnown<boolean> {\n\t\tswitch (cmd) {\n\t\t\tcase BatteryCommand.Get:\n\t\t\t\treturn true; // This is mandatory\n\t\t\tcase BatteryCommand.HealthGet:\n\t\t\t\treturn this.version >= 2;\n\t\t}\n\t\treturn super.supportsCommand(cmd);\n\t}\n\n\tprotected get [POLL_VALUE](): PollValueImplementation {\n\t\treturn async function(this: BatteryCCAPI, { property }) {\n\t\t\tswitch (property) {\n\t\t\t\tcase \"level\":\n\t\t\t\tcase \"chargingStatus\":\n\t\t\t\tcase \"rechargeable\":\n\t\t\t\tcase \"backup\":\n\t\t\t\tcase \"overheating\":\n\t\t\t\tcase \"lowFluid\":\n\t\t\t\tcase \"rechargeOrReplace\":\n\t\t\t\tcase \"lowTemperatureStatus\":\n\t\t\t\tcase \"disconnected\":\n\t\t\t\t\treturn (await this.get())?.[property];\n\n\t\t\t\tcase \"maximumCapacity\":\n\t\t\t\tcase \"temperature\":\n\t\t\t\t\treturn (await this.getHealth())?.[property];\n\n\t\t\t\tdefault:\n\t\t\t\t\tthrowUnsupportedProperty(this.ccId, property);\n\t\t\t}\n\t\t};\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n\tpublic async get() {\n\t\tthis.assertSupportsCommand(BatteryCommand, BatteryCommand.Get);\n\n\t\tconst cc = new BatteryCCGet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t});\n\t\tconst response = await this.host.sendCommand<BatteryCCReport>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\tif (response) {\n\t\t\treturn pick(response, [\n\t\t\t\t\"level\",\n\t\t\t\t\"chargingStatus\",\n\t\t\t\t\"rechargeable\",\n\t\t\t\t\"backup\",\n\t\t\t\t\"overheating\",\n\t\t\t\t\"lowFluid\",\n\t\t\t\t\"rechargeOrReplace\",\n\t\t\t\t\"lowTemperatureStatus\",\n\t\t\t\t\"disconnected\",\n\t\t\t]);\n\t\t}\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n\tpublic async getHealth() {\n\t\tthis.assertSupportsCommand(BatteryCommand, BatteryCommand.HealthGet);\n\n\t\tconst cc = new BatteryCCHealthGet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t});\n\t\tconst response = await this.host.sendCommand<BatteryCCHealthReport>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\tif (response) {\n\t\t\treturn pick(response, [\"maximumCapacity\", \"temperature\"]);\n\t\t}\n\t}\n}\n\n@commandClass(CommandClasses.Battery)\n@implementedVersion(3)\n@ccValues(BatteryCCValues)\nexport class BatteryCC extends CommandClass {\n\tdeclare ccCommand: BatteryCommand;\n\n\tpublic async interview(\n\t\tctx: InterviewContext,\n\t): Promise<void> {\n\t\tconst node = this.getNode(ctx)!;\n\n\t\tctx.logNode(node.id, {\n\t\t\tendpoint: this.endpointIndex,\n\t\t\tmessage: `Interviewing ${this.ccName}...`,\n\t\t\tdirection: \"none\",\n\t\t});\n\n\t\t// Query the Battery status\n\t\tawait this.refreshValues(ctx);\n\n\t\t// Remember that the interview is complete\n\t\tthis.setInterviewComplete(ctx, true);\n\t}\n\n\tpublic async refreshValues(\n\t\tctx: RefreshValuesContext,\n\t): Promise<void> {\n\t\tconst node = this.getNode(ctx)!;\n\t\tconst endpoint = this.getEndpoint(ctx)!;\n\t\tconst api = CCAPI.create(\n\t\t\tCommandClasses.Battery,\n\t\t\tctx,\n\t\t\tendpoint,\n\t\t).withOptions({\n\t\t\tpriority: MessagePriority.NodeQuery,\n\t\t});\n\n\t\tctx.logNode(node.id, {\n\t\t\tendpoint: this.endpointIndex,\n\t\t\tmessage: \"querying battery status...\",\n\t\t\tdirection: \"outbound\",\n\t\t});\n\n\t\tconst batteryStatus = await api.get();\n\t\tif (batteryStatus) {\n\t\t\tlet logMessage = `received response for battery information:\nlevel: ${\n\t\t\t\tbatteryStatus.level === 0xff\n\t\t\t\t\t? \"low\"\n\t\t\t\t\t: (batteryStatus.level + \" %\")\n\t\t\t}`;\n\t\t\tif (api.version >= 2) {\n\t\t\t\tlogMessage += `\nstatus: ${\n\t\t\t\t\tBatteryChargingStatus[batteryStatus.chargingStatus!]\n\t\t\t\t}\nrechargeable: ${batteryStatus.rechargeable}\nis backup: ${batteryStatus.backup}\nis overheating: ${batteryStatus.overheating}\nfluid is low: ${batteryStatus.lowFluid}\nneeds to be replaced or charged: ${\n\t\t\t\t\tBatteryReplacementStatus[batteryStatus.rechargeOrReplace!]\n\t\t\t\t}\nis low temperature ${batteryStatus.lowTemperatureStatus}\nis disconnected: ${batteryStatus.disconnected}`;\n\t\t\t}\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage: logMessage,\n\t\t\t\tdirection: \"inbound\",\n\t\t\t});\n\t\t}\n\n\t\tif (api.version >= 2) {\n\t\t\t// always query the health\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage: \"querying battery health...\",\n\t\t\t\tdirection: \"outbound\",\n\t\t\t});\n\n\t\t\tconst batteryHealth = await api.getHealth();\n\t\t\tif (batteryHealth) {\n\t\t\t\tconst logMessage = `received response for battery health:\nmax. capacity: ${batteryHealth.maximumCapacity} %\ntemperature: ${batteryHealth.temperature} \u00B0C`;\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\t\tmessage: logMessage,\n\t\t\t\t\tdirection: \"inbound\",\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic shouldRefreshValues(\n\t\tthis: SinglecastCC<this>,\n\t\tctx:\n\t\t\t& GetValueDB\n\t\t\t& GetSupportedCCVersion\n\t\t\t& GetDeviceConfig\n\t\t\t& GetNode<\n\t\t\t\tNodeId & GetEndpoint<EndpointId & SupportsCC & ControlsCC>\n\t\t\t>,\n\t): boolean {\n\t\t// Check when the battery state was last updated\n\t\tconst valueDB = ctx.tryGetValueDB(this.nodeId);\n\t\tif (!valueDB) return true;\n\n\t\tconst lastUpdated = valueDB.getTimestamp(\n\t\t\tBatteryCCValues.level.endpoint(this.endpointIndex),\n\t\t);\n\t\treturn (\n\t\t\tlastUpdated == undefined\n\t\t\t// The specs say once per month, but that's a bit too unfrequent IMO\n\t\t\t// Also the maximum that setInterval supports is ~24.85 days\n\t\t\t|| Date.now() - lastUpdated > timespan.days(7)\n\t\t);\n\t}\n}\n\n// @publicAPI\nexport type BatteryCCReportOptions =\n\t& {\n\t\tlevel: number | \"low\";\n\t}\n\t& AllOrNone<{\n\t\t// V2+\n\t\tchargingStatus: BatteryChargingStatus;\n\t\trechargeable: boolean;\n\t\tbackup: boolean;\n\t\toverheating: boolean;\n\t\tlowFluid: boolean;\n\t\trechargeOrReplace: BatteryReplacementStatus;\n\t\tdisconnected: boolean;\n\t}>\n\t& AllOrNone<{\n\t\t// V3+\n\t\tlowTemperatureStatus: boolean;\n\t}>;\n\n@CCCommand(BatteryCommand.Report)\n@ccValueProperty(\"level\", BatteryCCValues.level)\n@ccValueProperty(\"chargingStatus\", BatteryCCValues.chargingStatus)\n@ccValueProperty(\"rechargeable\", BatteryCCValues.rechargeable)\n@ccValueProperty(\"backup\", BatteryCCValues.backup)\n@ccValueProperty(\"overheating\", BatteryCCValues.overheating)\n@ccValueProperty(\"lowFluid\", BatteryCCValues.lowFluid)\n@ccValueProperty(\"rechargeOrReplace\", BatteryCCValues.rechargeOrReplace)\n@ccValueProperty(\"disconnected\", BatteryCCValues.disconnected)\n@ccValueProperty(\"lowTemperatureStatus\", BatteryCCValues.lowTemperatureStatus)\nexport class BatteryCCReport extends BatteryCC {\n\tpublic constructor(\n\t\toptions: WithAddress<BatteryCCReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\tthis.level = typeof options.level === \"number\" ? options.level : 0xff;\n\t\tthis.chargingStatus = options.chargingStatus;\n\t\tthis.rechargeable = options.rechargeable;\n\t\tthis.backup = options.backup;\n\t\tthis.overheating = options.overheating;\n\t\tthis.lowFluid = options.lowFluid;\n\t\tthis.rechargeOrReplace = options.rechargeOrReplace;\n\t\tthis.disconnected = options.disconnected;\n\t\tthis.lowTemperatureStatus = options.lowTemperatureStatus;\n\t}\n\n\tpublic static from(raw: CCRaw, ctx: CCParsingContext): BatteryCCReport {\n\t\tlet ccOptions: BatteryCCReportOptions;\n\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst level = raw.payload[0];\n\n\t\tccOptions = {\n\t\t\tlevel,\n\t\t};\n\n\t\tif (raw.payload.length >= 3) {\n\t\t\t// Starting with V2\n\t\t\tconst chargingStatus: BatteryChargingStatus = raw.payload[1] >>> 6;\n\t\t\tconst rechargeable = !!(raw.payload[1] & 0b0010_0000);\n\t\t\tconst backup = !!(raw.payload[1] & 0b0001_0000);\n\t\t\tconst overheating = !!(raw.payload[1] & 0b1000);\n\t\t\tconst lowFluid = !!(raw.payload[1] & 0b0100);\n\t\t\tconst rechargeOrReplace: BatteryReplacementStatus =\n\t\t\t\t!!(raw.payload[1] & 0b10)\n\t\t\t\t\t? BatteryReplacementStatus.Now\n\t\t\t\t\t: !!(raw.payload[1] & 0b1)\n\t\t\t\t\t? BatteryReplacementStatus.Soon\n\t\t\t\t\t: BatteryReplacementStatus.No;\n\t\t\tconst lowTemperatureStatus = !!(raw.payload[2] & 0b10);\n\t\t\tconst disconnected = !!(raw.payload[2] & 0b1);\n\n\t\t\tccOptions = {\n\t\t\t\t...ccOptions,\n\t\t\t\tchargingStatus,\n\t\t\t\trechargeable,\n\t\t\t\tbackup,\n\t\t\t\toverheating,\n\t\t\t\tlowFluid,\n\t\t\t\trechargeOrReplace,\n\t\t\t\tlowTemperatureStatus,\n\t\t\t\tdisconnected,\n\t\t\t};\n\t\t}\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\t...ccOptions,\n\t\t});\n\t}\n\n\tpublic persistValues(ctx: PersistValuesContext): boolean {\n\t\t// This is a bit hacky, but we need to avoid persisting 0xff as the battery level\n\t\t// because the report is meant as a notification in that case.\n\t\tif (this.level === 0xff) {\n\t\t\t// @ts-expect-error\n\t\t\tthis.level = undefined;\n\t\t}\n\n\t\tif (!super.persistValues(ctx)) return false;\n\n\t\tif (this.level === undefined) {\n\t\t\t// @ts-expect-error\n\t\t\tthis.level = 0xff;\n\t\t}\n\n\t\t// Na\u00EFve heuristic for a full battery\n\t\tif (this.level >= 90) {\n\t\t\t// Some devices send Notification CC Reports with battery information,\n\t\t\t// or this information is mapped from legacy V1 alarm values.\n\t\t\t// We may need to idle the corresponding values when the battery is full\n\t\t\tconst notificationCCVersion = ctx.getSupportedCCVersion(\n\t\t\t\tCommandClasses.Notification,\n\t\t\t\tthis.nodeId as number,\n\t\t\t\tthis.endpointIndex,\n\t\t\t);\n\t\t\tif (\n\t\t\t\t// supported\n\t\t\t\tnotificationCCVersion > 0\n\t\t\t\t// but idling is not required\n\t\t\t\t&& notificationCCVersion < 8\n\t\t\t) {\n\t\t\t\tconst batteryLevelStatusValue = NotificationCCValues\n\t\t\t\t\t.notificationVariable(\n\t\t\t\t\t\t\"Power Management\",\n\t\t\t\t\t\t\"Battery level status\",\n\t\t\t\t\t);\n\t\t\t\t// If not undefined and not idle\n\t\t\t\tif (this.getValue(ctx, batteryLevelStatusValue)) {\n\t\t\t\t\tthis.setValue(\n\t\t\t\t\t\tctx,\n\t\t\t\t\t\tbatteryLevelStatusValue,\n\t\t\t\t\t\t0, /* idle */\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tpublic readonly level: number;\n\n\tpublic readonly chargingStatus: BatteryChargingStatus | undefined;\n\n\tpublic readonly rechargeable: boolean | undefined;\n\n\tpublic readonly backup: boolean | undefined;\n\n\tpublic readonly overheating: boolean | undefined;\n\n\tpublic readonly lowFluid: boolean | undefined;\n\n\tpublic readonly rechargeOrReplace: BatteryReplacementStatus | undefined;\n\n\tpublic readonly disconnected: boolean | undefined;\n\n\tpublic readonly lowTemperatureStatus: boolean | undefined;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.from([this.level]);\n\t\tif (this.chargingStatus != undefined) {\n\t\t\tthis.payload = Bytes.concat([\n\t\t\t\tthis.payload,\n\t\t\t\tBytes.from([\n\t\t\t\t\t(this.chargingStatus << 6)\n\t\t\t\t\t+ (this.rechargeable ? 0b0010_0000 : 0)\n\t\t\t\t\t+ (this.backup ? 0b0001_0000 : 0)\n\t\t\t\t\t+ (this.overheating ? 0b1000 : 0)\n\t\t\t\t\t+ (this.lowFluid ? 0b0100 : 0)\n\t\t\t\t\t+ (this.rechargeOrReplace === BatteryReplacementStatus.Now\n\t\t\t\t\t\t? 0b10\n\t\t\t\t\t\t: this.rechargeOrReplace\n\t\t\t\t\t\t\t\t=== BatteryReplacementStatus.Soon\n\t\t\t\t\t\t? 0b1\n\t\t\t\t\t\t: 0),\n\t\t\t\t\t(this.lowTemperatureStatus ? 0b10 : 0)\n\t\t\t\t\t+ (this.disconnected ? 0b1 : 0),\n\t\t\t\t]),\n\t\t\t]);\n\t\t}\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\tconst message: MessageRecord = this.level === 0xff\n\t\t\t? { \"is low\": true }\n\t\t\t: { level: this.level };\n\n\t\tif (this.chargingStatus != undefined) {\n\t\t\tmessage[\"charging status\"] = getEnumMemberName(\n\t\t\t\tBatteryChargingStatus,\n\t\t\t\tthis.chargingStatus,\n\t\t\t);\n\t\t}\n\t\tif (this.rechargeable != undefined) {\n\t\t\tmessage.rechargeable = this.rechargeable;\n\t\t}\n\t\tif (this.backup != undefined) {\n\t\t\tmessage.backup = this.backup;\n\t\t}\n\t\tif (this.overheating != undefined) {\n\t\t\tmessage.overheating = this.overheating;\n\t\t}\n\t\tif (this.lowFluid != undefined) {\n\t\t\tmessage[\"low fluid\"] = this.lowFluid;\n\t\t}\n\t\tif (this.rechargeOrReplace != undefined) {\n\t\t\tmessage[\"recharge or replace\"] = getEnumMemberName(\n\t\t\t\tBatteryReplacementStatus,\n\t\t\t\tthis.rechargeOrReplace,\n\t\t\t);\n\t\t}\n\t\tif (this.lowTemperatureStatus != undefined) {\n\t\t\tmessage.lowTemperatureStatus = this.lowTemperatureStatus;\n\t\t}\n\t\tif (this.disconnected != undefined) {\n\t\t\tmessage.disconnected = this.disconnected;\n\t\t}\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage,\n\t\t};\n\t}\n}\n\n@CCCommand(BatteryCommand.Get)\n@expectedCCResponse(BatteryCCReport)\nexport class BatteryCCGet extends BatteryCC {}\n\n// @publicAPI\nexport interface BatteryCCHealthReportOptions {\n\tmaximumCapacity?: number;\n\ttemperature?: number;\n\ttemperatureScale?: number;\n}\n\n@CCCommand(BatteryCommand.HealthReport)\n@ccValueProperty(\"maximumCapacity\", BatteryCCValues.maximumCapacity)\n@ccValueProperty(\"temperature\", BatteryCCValues.temperature)\nexport class BatteryCCHealthReport extends BatteryCC {\n\tpublic constructor(\n\t\toptions: WithAddress<BatteryCCHealthReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\t// TODO: Check implementation:\n\t\tthis.maximumCapacity = options.maximumCapacity;\n\t\tthis.temperature = options.temperature;\n\t\tthis.temperatureScale = options.temperatureScale;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): BatteryCCHealthReport {\n\t\tvalidatePayload(raw.payload.length >= 2);\n\t\t// Parse maximum capacity. 0xff means unknown\n\t\tlet maximumCapacity: number | undefined = raw.payload[0];\n\t\tif (maximumCapacity === 0xff) maximumCapacity = undefined;\n\t\tconst {\n\t\t\tvalue: temperature,\n\t\t\tscale: temperatureScale,\n\t\t} = parseFloatWithScale(\n\t\t\traw.payload.subarray(1),\n\t\t\ttrue, // The temperature field may be omitted\n\t\t);\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tmaximumCapacity,\n\t\t\ttemperature,\n\t\t\ttemperatureScale,\n\t\t});\n\t}\n\n\tpublic readonly maximumCapacity: number | undefined;\n\tpublic readonly temperature: number | undefined;\n\tprivate readonly temperatureScale: number | undefined;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tconst temperature = this.temperature != undefined\n\t\t\t? encodeFloatWithScale(\n\t\t\t\tthis.temperature,\n\t\t\t\tthis.temperatureScale ?? 0x00,\n\t\t\t)\n\t\t\t// size, precision and scale must be 0 if the temperature is omitted\n\t\t\t: Bytes.from([0x00]);\n\n\t\tthis.payload = Bytes.concat([\n\t\t\t[this.maximumCapacity ?? 0xff],\n\t\t\ttemperature,\n\t\t]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: {\n\t\t\t\ttemperature: this.temperature != undefined\n\t\t\t\t\t? this.temperature\n\t\t\t\t\t: \"unknown\",\n\t\t\t\t\"max capacity\": this.maximumCapacity != undefined\n\t\t\t\t\t? `${this.maximumCapacity} %`\n\t\t\t\t\t: \"unknown\",\n\t\t\t},\n\t\t};\n\t}\n}\n\n@CCCommand(BatteryCommand.HealthGet)\n@expectedCCResponse(BatteryCCHealthReport)\nexport class BatteryCCHealthGet extends BatteryCC {}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,kBAsBO;AACP,oBAKO;AACP,iBAMO;AACP,0BAMO;AACP,oCAQO;AACP,oBAAkB;AAClB,mBAIO;AACP,4BAAqC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAsIxB,gBAAY,MAAA;8BADxB,mCAAI,2BAAe,OAAO,CAAC;;;;oBACM;oCAAA,YAAa;WAAA;;;;;;;;AAA/C,mBAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,wBAAA,YAAA,uBAAA;;IACL,gBAAgB,KAAmB;AACzC,cAAQ,KAAK;QACZ,KAAK,4BAAe;AACnB,iBAAO;;QACR,KAAK,4BAAe;AACnB,iBAAO,KAAK,WAAW;MACzB;AACA,aAAO,MAAM,gBAAgB,GAAG;IACjC;IAEA,KAAe,qBAAU,IAAC;AACzB,aAAO,eAAmC,EAAE,SAAQ,GAAE;AACrD,gBAAQ,UAAU;UACjB,KAAK;UACL,KAAK;UACL,KAAK;UACL,KAAK;UACL,KAAK;UACL,KAAK;UACL,KAAK;UACL,KAAK;UACL,KAAK;AACJ,oBAAQ,MAAM,KAAK,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Aa,KAAK,eAAe,SAC9B,KAAK,cACL;UACH,gBAAgB,KAAK,mBAAmB,SACrC,GAAG,KAAK,eAAe,OACvB;;;IAGN;;;;IAKY,sBAAkB,MAAA;8BAF9B,yCAAU,4BAAe,SAAS,OAClC,kDAAmB,qBAAqB,CAAC;;;;oBACF;0CAAA,YAAS;WAAA;;;;;;;;AAAjD,mBAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,wBAAA,YAAA,uBAAA;;;;;",
6
6
  "names": []
7
7
  }
@@ -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: import("@zwave-js/core").ValueID) => boolean;
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: import("@zwave-js/core").ValueID) => boolean;
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: import("@zwave-js/core").ValueID) => boolean;
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
- timeout: {
93
+ supportedPropertyIDs: ((indicatorId: number) => {
94
94
  id: {
95
95
  readonly commandClass: CommandClasses.Indicator;
96
- readonly property: "timeout";
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: "timeout";
102
+ readonly property: "supportedPropertyIDs";
103
+ readonly propertyKey: number;
102
104
  };
103
- is: (valueId: import("@zwave-js/core").ValueID) => boolean;
104
- readonly meta: {
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: false;
112
- readonly minVersion: 3;
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
- supportedPropertyIDs: ((indicatorId: number) => {
121
+ valueV2: ((indicatorId: number, propertyId: number) => {
120
122
  id: {
121
123
  readonly commandClass: CommandClasses.Indicator;
122
- readonly property: "supportedPropertyIDs";
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: "supportedPropertyIDs";
130
+ readonly property: number;
129
131
  readonly propertyKey: number;
130
132
  };
131
- readonly meta: Readonly<{
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: import("@zwave-js/core").ValueID) => boolean;
143
+ is: (valueId: ValueID) => boolean;
138
144
  options: {
139
- readonly internal: true;
140
- readonly minVersion: 1;
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
- valueV2: ((indicatorId: number, propertyId: number) => {
153
+ timeout: ((indicatorId: number) => {
148
154
  id: {
149
155
  readonly commandClass: CommandClasses.Indicator;
150
156
  readonly property: number;
151
- readonly propertyKey: number;
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: number;
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: "any";
170
+ readonly type: "string";
165
171
  readonly readable: true;
166
172
  readonly writeable: true;
167
173
  };
168
174
  }) & {
169
- is: (valueId: import("@zwave-js/core").ValueID) => boolean;
175
+ is: (valueId: ValueID) => boolean;
170
176
  options: {
171
177
  readonly internal: false;
172
- readonly minVersion: 2;
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: import("@zwave-js/core").ValueID) => boolean;
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 {