@zwave-js/cc 10.18.0 → 10.20.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.
Files changed (58) hide show
  1. package/build/cc/BasicCC.d.ts +3 -0
  2. package/build/cc/BasicCC.d.ts.map +1 -1
  3. package/build/cc/BasicCC.js +3 -0
  4. package/build/cc/BasicCC.js.map +1 -1
  5. package/build/cc/CentralSceneCC.d.ts +1 -2
  6. package/build/cc/CentralSceneCC.d.ts.map +1 -1
  7. package/build/cc/CentralSceneCC.js +10 -21
  8. package/build/cc/CentralSceneCC.js.map +1 -1
  9. package/build/cc/ConfigurationCC.d.ts +48 -37
  10. package/build/cc/ConfigurationCC.d.ts.map +1 -1
  11. package/build/cc/ConfigurationCC.js +202 -152
  12. package/build/cc/ConfigurationCC.js.map +1 -1
  13. package/build/cc/EnergyProductionCC.d.ts +7 -1
  14. package/build/cc/EnergyProductionCC.d.ts.map +1 -1
  15. package/build/cc/EnergyProductionCC.js +19 -5
  16. package/build/cc/EnergyProductionCC.js.map +1 -1
  17. package/build/cc/EntryControlCC.d.ts +1 -0
  18. package/build/cc/EntryControlCC.d.ts.map +1 -1
  19. package/build/cc/EntryControlCC.js +44 -0
  20. package/build/cc/EntryControlCC.js.map +1 -1
  21. package/build/cc/IndicatorCC.d.ts +3 -0
  22. package/build/cc/IndicatorCC.d.ts.map +1 -1
  23. package/build/cc/IndicatorCC.js +3 -0
  24. package/build/cc/IndicatorCC.js.map +1 -1
  25. package/build/cc/IrrigationCC.d.ts +7 -0
  26. package/build/cc/IrrigationCC.d.ts.map +1 -1
  27. package/build/cc/IrrigationCC.js +7 -0
  28. package/build/cc/IrrigationCC.js.map +1 -1
  29. package/build/cc/MeterCC.d.ts +6 -0
  30. package/build/cc/MeterCC.d.ts.map +1 -1
  31. package/build/cc/MeterCC.js +6 -0
  32. package/build/cc/MeterCC.js.map +1 -1
  33. package/build/cc/MultilevelSwitchCC.d.ts +11 -0
  34. package/build/cc/MultilevelSwitchCC.d.ts.map +1 -1
  35. package/build/cc/MultilevelSwitchCC.js +11 -0
  36. package/build/cc/MultilevelSwitchCC.js.map +1 -1
  37. package/build/cc/NotificationCC.d.ts.map +1 -1
  38. package/build/cc/NotificationCC.js +15 -12
  39. package/build/cc/NotificationCC.js.map +1 -1
  40. package/build/cc/ScheduleEntryLockCC.d.ts +109 -1
  41. package/build/cc/ScheduleEntryLockCC.d.ts.map +1 -1
  42. package/build/cc/ScheduleEntryLockCC.js +173 -5
  43. package/build/cc/ScheduleEntryLockCC.js.map +1 -1
  44. package/build/cc/SoundSwitchCC.js +14 -14
  45. package/build/cc/SoundSwitchCC.js.map +1 -1
  46. package/build/cc/WindowCoveringCC.d.ts +12 -0
  47. package/build/cc/WindowCoveringCC.d.ts.map +1 -1
  48. package/build/cc/WindowCoveringCC.js +12 -0
  49. package/build/cc/WindowCoveringCC.js.map +1 -1
  50. package/build/lib/_Types.d.ts +5 -0
  51. package/build/lib/_Types.d.ts.map +1 -1
  52. package/build/lib/_Types.js +8 -2
  53. package/build/lib/_Types.js.map +1 -1
  54. package/build/lib/utils.d.ts +2 -1
  55. package/build/lib/utils.d.ts.map +1 -1
  56. package/build/lib/utils.js +25 -1
  57. package/build/lib/utils.js.map +1 -1
  58. package/package.json +6 -6
@@ -1368,30 +1368,38 @@ exports.ConfigurationCC = ConfigurationCC;
1368
1368
  let ConfigurationCCReport = class ConfigurationCCReport extends ConfigurationCC {
1369
1369
  constructor(host, options) {
1370
1370
  super(host, options);
1371
- // All fields must be present
1372
- (0, safe_1.validatePayload)(this.payload.length > 2);
1373
- this._parameter = this.payload[0];
1374
- this._valueSize = this.payload[1] & 0b111;
1375
- // Ensure we received a valid report
1376
- (0, safe_1.validatePayload)(this._valueSize >= 1, this._valueSize <= 4, this.payload.length >= 2 + this._valueSize);
1377
- // Default to parsing the value as SignedInteger, like the specs say.
1378
- // We try to re-interpret the value in persistValues()
1379
- this._value = parseValue(this.payload.slice(2), this._valueSize, safe_1.ConfigValueFormat.SignedInteger);
1371
+ if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
1372
+ // All fields must be present
1373
+ (0, safe_1.validatePayload)(this.payload.length > 2);
1374
+ this.parameter = this.payload[0];
1375
+ this.valueSize = this.payload[1] & 0b111;
1376
+ // Ensure we received a valid report
1377
+ (0, safe_1.validatePayload)(this.valueSize >= 1, this.valueSize <= 4, this.payload.length >= 2 + this.valueSize);
1378
+ // Default to parsing the value as SignedInteger, like the specs say.
1379
+ // We try to re-interpret the value in persistValues()
1380
+ this.value = parseValue(this.payload.slice(2), this.valueSize, safe_1.ConfigValueFormat.SignedInteger);
1381
+ }
1382
+ else {
1383
+ this.parameter = options.parameter;
1384
+ this.value = options.value;
1385
+ this.valueSize = options.valueSize;
1386
+ this.valueFormat = options.valueFormat;
1387
+ }
1380
1388
  }
1381
1389
  persistValues(applHost) {
1382
1390
  if (!super.persistValues(applHost))
1383
1391
  return false;
1384
1392
  const valueDB = this.getValueDB(applHost);
1385
1393
  // Check if the initial assumption of SignedInteger holds true
1386
- const oldParamInformation = this.getParamInformation(applHost, this._parameter);
1394
+ const oldParamInformation = this.getParamInformation(applHost, this.parameter);
1387
1395
  if (oldParamInformation.format != undefined &&
1388
1396
  oldParamInformation.format !== safe_1.ConfigValueFormat.SignedInteger) {
1389
1397
  // Re-interpret the value with the new format
1390
- this._value = reInterpretSignedValue(this._value, this._valueSize, oldParamInformation.format);
1398
+ this.value = reInterpretSignedValue(this.value, this.valueSize, oldParamInformation.format);
1391
1399
  }
1392
1400
  // Store the parameter size and value
1393
- this.extendParamInformation(applHost, this._parameter, undefined, {
1394
- valueSize: this._valueSize,
1401
+ this.extendParamInformation(applHost, this.parameter, undefined, {
1402
+ valueSize: this.valueSize,
1395
1403
  type: oldParamInformation.format === safe_1.ConfigValueFormat.BitField
1396
1404
  ? "number[]"
1397
1405
  : "number",
@@ -1402,19 +1410,19 @@ let ConfigurationCCReport = class ConfigurationCCReport extends ConfigurationCC
1402
1410
  oldParamInformation.max == undefined) {
1403
1411
  const isSigned = oldParamInformation.format == undefined ||
1404
1412
  oldParamInformation.format === safe_1.ConfigValueFormat.SignedInteger;
1405
- this.extendParamInformation(applHost, this._parameter, undefined, (0, safe_1.getIntegerLimits)(this._valueSize, isSigned));
1413
+ this.extendParamInformation(applHost, this.parameter, undefined, (0, safe_1.getIntegerLimits)(this.valueSize, isSigned));
1406
1414
  }
1407
1415
  // And store the value itself
1408
1416
  // If we have partial config params defined, we need to split the value
1409
- const partialParams = this.getPartialParamInfos(applHost, this._parameter);
1417
+ const partialParams = this.getPartialParamInfos(applHost, this.parameter);
1410
1418
  if (partialParams.length > 0) {
1411
1419
  for (const param of partialParams) {
1412
1420
  if (typeof param.propertyKey === "number") {
1413
1421
  valueDB.setValue({
1414
1422
  commandClass: this.ccId,
1415
- property: this._parameter,
1423
+ property: this.parameter,
1416
1424
  propertyKey: param.propertyKey,
1417
- }, (0, safe_1.parsePartial)(this._value, param.propertyKey, isSignedPartial(param.propertyKey, param.metadata.format)));
1425
+ }, (0, safe_1.parsePartial)(this.value, param.propertyKey, isSignedPartial(param.propertyKey, param.metadata.format)));
1418
1426
  }
1419
1427
  }
1420
1428
  }
@@ -1422,19 +1430,21 @@ let ConfigurationCCReport = class ConfigurationCCReport extends ConfigurationCC
1422
1430
  // This is a single param
1423
1431
  valueDB.setValue({
1424
1432
  commandClass: this.ccId,
1425
- property: this._parameter,
1426
- }, this._value);
1433
+ property: this.parameter,
1434
+ }, this.value);
1427
1435
  }
1428
1436
  return true;
1429
1437
  }
1430
- get parameter() {
1431
- return this._parameter;
1432
- }
1433
- get value() {
1434
- return this._value;
1435
- }
1436
- get valueSize() {
1437
- return this._valueSize;
1438
+ serialize() {
1439
+ this.payload = Buffer.concat([
1440
+ Buffer.from([this.parameter, this.valueSize & 0b111]),
1441
+ Buffer.allocUnsafe(this.valueSize),
1442
+ ]);
1443
+ const valueFormat = typeof this.value === "number"
1444
+ ? this.valueFormat ?? safe_1.ConfigValueFormat.SignedInteger
1445
+ : safe_1.ConfigValueFormat.BitField;
1446
+ serializeValue(this.payload, 2, this.valueSize, valueFormat, this.value);
1447
+ return super.serialize();
1438
1448
  }
1439
1449
  toLogEntry(applHost) {
1440
1450
  return {
@@ -1459,8 +1469,9 @@ let ConfigurationCCGet = class ConfigurationCCGet extends ConfigurationCC {
1459
1469
  constructor(host, options) {
1460
1470
  super(host, options);
1461
1471
  if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
1462
- // TODO: Deserialize payload
1463
- throw new safe_1.ZWaveError(`${this.constructor.name}: deserialization not implemented`, safe_1.ZWaveErrorCodes.Deserialization_NotImplemented);
1472
+ (0, safe_1.validatePayload)(this.payload.length >= 1);
1473
+ this.parameter = this.payload[0];
1474
+ this.allowUnexpectedResponse = false;
1464
1475
  }
1465
1476
  else {
1466
1477
  this.parameter = options.parameter;
@@ -1488,8 +1499,14 @@ let ConfigurationCCSet = class ConfigurationCCSet extends ConfigurationCC {
1488
1499
  constructor(host, options) {
1489
1500
  super(host, options);
1490
1501
  if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
1491
- // TODO: Deserialize payload
1492
- throw new safe_1.ZWaveError(`${this.constructor.name}: deserialization not implemented`, safe_1.ZWaveErrorCodes.Deserialization_NotImplemented);
1502
+ (0, safe_1.validatePayload)(this.payload.length >= 2);
1503
+ this.parameter = this.payload[0];
1504
+ this.resetToDefault = !!(this.payload[1] & 128);
1505
+ this.valueSize = this.payload[1] & 0b111;
1506
+ // Ensure we received a valid report
1507
+ (0, safe_1.validatePayload)(this.valueSize >= 1, this.valueSize <= 4, this.payload.length >= 2 + this.valueSize);
1508
+ // Parse the value as signed integer. We don't know the format here.
1509
+ this.value = parseValue(this.payload.slice(2), this.valueSize, safe_1.ConfigValueFormat.SignedInteger);
1493
1510
  }
1494
1511
  else {
1495
1512
  this.parameter = options.parameter;
@@ -1809,6 +1826,7 @@ let ConfigurationCCNameReport = class ConfigurationCCNameReport extends Configur
1809
1826
  return false;
1810
1827
  this.extendParamInformation(applHost, this.parameter, undefined, {
1811
1828
  name: this.name,
1829
+ label: this.name,
1812
1830
  });
1813
1831
  return true;
1814
1832
  }
@@ -1879,44 +1897,51 @@ exports.ConfigurationCCNameGet = ConfigurationCCNameGet;
1879
1897
  let ConfigurationCCInfoReport = class ConfigurationCCInfoReport extends ConfigurationCC {
1880
1898
  constructor(host, options) {
1881
1899
  super(host, options);
1882
- // Parameter and # of reports must be present
1883
- (0, safe_1.validatePayload)(this.payload.length >= 3);
1884
- this._parameter = this.payload.readUInt16BE(0);
1885
- this._reportsToFollow = this.payload[2];
1886
- if (this._reportsToFollow > 0) {
1887
- // If more reports follow, the info must at least be one byte
1888
- (0, safe_1.validatePayload)(this.payload.length >= 4);
1900
+ if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
1901
+ // Parameter and # of reports must be present
1902
+ (0, safe_1.validatePayload)(this.payload.length >= 3);
1903
+ this.parameter = this.payload.readUInt16BE(0);
1904
+ this.reportsToFollow = this.payload[2];
1905
+ if (this.reportsToFollow > 0) {
1906
+ // If more reports follow, the info must at least be one byte
1907
+ (0, safe_1.validatePayload)(this.payload.length >= 4);
1908
+ }
1909
+ this.info = this.payload.slice(3).toString("utf8");
1910
+ }
1911
+ else {
1912
+ this.parameter = options.parameter;
1913
+ this.info = options.info;
1914
+ this.reportsToFollow = options.reportsToFollow;
1889
1915
  }
1890
- this._info = this.payload.slice(3).toString("utf8");
1891
1916
  }
1892
1917
  persistValues(applHost) {
1893
1918
  if (!super.persistValues(applHost))
1894
1919
  return false;
1895
- this.extendParamInformation(applHost, this._parameter, undefined, {
1896
- info: this._info,
1920
+ this.extendParamInformation(applHost, this.parameter, undefined, {
1921
+ info: this.info,
1922
+ description: this.info,
1897
1923
  });
1898
1924
  return true;
1899
1925
  }
1900
- get parameter() {
1901
- return this._parameter;
1902
- }
1903
- get info() {
1904
- return this._info;
1905
- }
1906
- get reportsToFollow() {
1907
- return this._reportsToFollow;
1926
+ serialize() {
1927
+ const infoBuffer = Buffer.from(this.info, "utf8");
1928
+ this.payload = Buffer.allocUnsafe(3 + infoBuffer.length);
1929
+ this.payload.writeUInt16BE(this.parameter, 0);
1930
+ this.payload[2] = this.reportsToFollow;
1931
+ infoBuffer.copy(this.payload, 3);
1932
+ return super.serialize();
1908
1933
  }
1909
1934
  getPartialCCSessionId() {
1910
1935
  // Distinguish sessions by the parameter number
1911
- return { parameter: this._parameter };
1936
+ return { parameter: this.parameter };
1912
1937
  }
1913
1938
  expectMoreMessages() {
1914
- return this._reportsToFollow > 0;
1939
+ return this.reportsToFollow > 0;
1915
1940
  }
1916
1941
  mergePartialCCs(applHost, partials) {
1917
1942
  // Concat the info
1918
- this._info = [...partials, this]
1919
- .map((report) => report._info)
1943
+ this.info = [...partials, this]
1944
+ .map((report) => report.info)
1920
1945
  .reduce((prev, cur) => prev + cur, "");
1921
1946
  }
1922
1947
  toLogEntry(applHost) {
@@ -1938,8 +1963,8 @@ let ConfigurationCCInfoGet = class ConfigurationCCInfoGet extends ConfigurationC
1938
1963
  constructor(host, options) {
1939
1964
  super(host, options);
1940
1965
  if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
1941
- // TODO: Deserialize payload
1942
- throw new safe_1.ZWaveError(`${this.constructor.name}: deserialization not implemented`, safe_1.ZWaveErrorCodes.Deserialization_NotImplemented);
1966
+ (0, safe_1.validatePayload)(this.payload.length >= 2);
1967
+ this.parameter = this.payload.readUInt16BE(0);
1943
1968
  }
1944
1969
  else {
1945
1970
  this.parameter = options.parameter;
@@ -1965,128 +1990,153 @@ exports.ConfigurationCCInfoGet = ConfigurationCCInfoGet;
1965
1990
  let ConfigurationCCPropertiesReport = class ConfigurationCCPropertiesReport extends ConfigurationCC {
1966
1991
  constructor(host, options) {
1967
1992
  super(host, options);
1968
- (0, safe_1.validatePayload)(this.payload.length >= 3);
1969
- this._parameter = this.payload.readUInt16BE(0);
1970
- this._valueFormat = (this.payload[2] & 0b111000) >>> 3;
1971
- this._valueSize = this.payload[2] & 0b111;
1972
- // GH#1309 Some devices don't tell us the first parameter if we query #0
1973
- // Instead, they contain 0x000000
1974
- if (this._valueSize === 0 && this.payload.length < 5) {
1975
- this._nextParameter = 0;
1976
- return;
1977
- }
1978
- // Ensure the payload contains the two bytes for next parameter
1979
- const nextParameterOffset = 3 + 3 * this._valueSize;
1980
- (0, safe_1.validatePayload)(this.payload.length >= nextParameterOffset + 2);
1981
- if (this.valueSize > 0) {
1982
- if (this._valueFormat !== safe_1.ConfigValueFormat.BitField) {
1983
- this._minValue = parseValue(this.payload.slice(3), this._valueSize, this._valueFormat);
1993
+ if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
1994
+ (0, safe_1.validatePayload)(this.payload.length >= 3);
1995
+ this.parameter = this.payload.readUInt16BE(0);
1996
+ this.valueFormat = (this.payload[2] & 0b111000) >>> 3;
1997
+ this.valueSize = this.payload[2] & 0b111;
1998
+ // GH#1309 Some devices don't tell us the first parameter if we query #0
1999
+ // Instead, they contain 0x000000
2000
+ if (this.valueSize === 0 && this.payload.length < 5) {
2001
+ this.nextParameter = 0;
2002
+ return;
2003
+ }
2004
+ // Ensure the payload contains the two bytes for next parameter
2005
+ const nextParameterOffset = 3 + 3 * this.valueSize;
2006
+ (0, safe_1.validatePayload)(this.payload.length >= nextParameterOffset + 2);
2007
+ if (this.valueSize > 0) {
2008
+ if (this.valueFormat !== safe_1.ConfigValueFormat.BitField) {
2009
+ this.minValue = parseValue(this.payload.slice(3), this.valueSize, this.valueFormat);
2010
+ }
2011
+ this.maxValue = parseValue(this.payload.slice(3 + this.valueSize), this.valueSize, this.valueFormat);
2012
+ this.defaultValue = parseValue(this.payload.slice(3 + 2 * this.valueSize), this.valueSize, this.valueFormat);
2013
+ }
2014
+ if (this.version < 4) {
2015
+ // Read the last 2 bytes to work around nodes not omitting min/max value when their size is 0
2016
+ this.nextParameter = this.payload.readUInt16BE(this.payload.length - 2);
2017
+ }
2018
+ else {
2019
+ this.nextParameter =
2020
+ this.payload.readUInt16BE(nextParameterOffset);
2021
+ // Ensure the payload contains a byte for the 2nd option flags
2022
+ (0, safe_1.validatePayload)(this.payload.length >= nextParameterOffset + 3);
2023
+ const options1 = this.payload[2];
2024
+ const options2 = this.payload[3 + 3 * this.valueSize + 2];
2025
+ this.altersCapabilities = !!(options1 & 128);
2026
+ this.isReadonly = !!(options1 & 64);
2027
+ this.isAdvanced = !!(options2 & 0b1);
2028
+ this.noBulkSupport = !!(options2 & 0b10);
1984
2029
  }
1985
- this._maxValue = parseValue(this.payload.slice(3 + this._valueSize), this._valueSize, this._valueFormat);
1986
- this._defaultValue = parseValue(this.payload.slice(3 + 2 * this._valueSize), this._valueSize, this._valueFormat);
1987
- }
1988
- if (this.version < 4) {
1989
- // Read the last 2 bytes to work around nodes not omitting min/max value when their size is 0
1990
- this._nextParameter = this.payload.readUInt16BE(this.payload.length - 2);
1991
2030
  }
1992
2031
  else {
1993
- this._nextParameter =
1994
- this.payload.readUInt16BE(nextParameterOffset);
1995
- // Ensure the payload contains a byte for the 2nd option flags
1996
- (0, safe_1.validatePayload)(this.payload.length >= nextParameterOffset + 3);
1997
- const options1 = this.payload[2];
1998
- const options2 = this.payload[3 + 3 * this.valueSize + 2];
1999
- this._altersCapabilities = !!(options1 & 128);
2000
- this._isReadonly = !!(options1 & 64);
2001
- this._isAdvanced = !!(options2 & 0b1);
2002
- this._noBulkSupport = !!(options2 & 0b10);
2032
+ this.parameter = options.parameter;
2033
+ this.valueSize = options.valueSize;
2034
+ this.valueFormat = options.valueFormat;
2035
+ if (this.valueSize > 0) {
2036
+ if (options.minValue == undefined) {
2037
+ throw new safe_1.ZWaveError("The minimum value must be set when the value size is non-zero", safe_1.ZWaveErrorCodes.Argument_Invalid);
2038
+ }
2039
+ else if (options.maxValue == undefined) {
2040
+ throw new safe_1.ZWaveError("The maximum value must be set when the value size is non-zero", safe_1.ZWaveErrorCodes.Argument_Invalid);
2041
+ }
2042
+ else if (options.defaultValue == undefined) {
2043
+ throw new safe_1.ZWaveError("The default value must be set when the value size is non-zero", safe_1.ZWaveErrorCodes.Argument_Invalid);
2044
+ }
2045
+ this.minValue = options.minValue;
2046
+ this.maxValue = options.maxValue;
2047
+ this.defaultValue = options.defaultValue;
2048
+ }
2049
+ this.nextParameter = options.nextParameter;
2050
+ this.altersCapabilities = options.altersCapabilities;
2051
+ this.isReadonly = options.isReadonly;
2052
+ this.isAdvanced = options.isAdvanced;
2053
+ this.noBulkSupport = options.noBulkSupport;
2003
2054
  }
2004
2055
  }
2005
2056
  persistValues(applHost) {
2006
2057
  if (!super.persistValues(applHost))
2007
2058
  return false;
2008
2059
  // If we actually received parameter info, store it
2009
- if (this._valueSize > 0) {
2010
- const valueType = this._valueFormat === safe_1.ConfigValueFormat.SignedInteger ||
2011
- this._valueFormat === safe_1.ConfigValueFormat.UnsignedInteger
2060
+ if (this.valueSize > 0) {
2061
+ const valueType = this.valueFormat === safe_1.ConfigValueFormat.SignedInteger ||
2062
+ this.valueFormat === safe_1.ConfigValueFormat.UnsignedInteger
2012
2063
  ? "number"
2013
2064
  : "number[]";
2014
2065
  const paramInfo = (0, safe_1.stripUndefined)({
2015
2066
  type: valueType,
2016
- valueFormat: this._valueFormat,
2017
- valueSize: this._valueSize,
2018
- minValue: this._minValue,
2019
- maxValue: this._maxValue,
2020
- defaultValue: this._defaultValue,
2021
- requiresReInclusion: this._altersCapabilities,
2022
- writeable: !this._isReadonly,
2023
- isAdvanced: this._isAdvanced,
2024
- noBulkSupport: this._noBulkSupport,
2067
+ format: this.valueFormat,
2068
+ valueSize: this.valueSize,
2069
+ min: this.minValue,
2070
+ max: this.maxValue,
2071
+ default: this.defaultValue,
2072
+ requiresReInclusion: this.altersCapabilities,
2073
+ readable: true,
2074
+ writeable: !this.isReadonly,
2075
+ allowManualEntry: true,
2076
+ isAdvanced: this.isAdvanced,
2077
+ noBulkSupport: this.noBulkSupport,
2078
+ isFromConfig: false,
2025
2079
  });
2026
- this.extendParamInformation(applHost, this._parameter, undefined, paramInfo);
2080
+ this.extendParamInformation(applHost, this.parameter, undefined, paramInfo);
2027
2081
  }
2028
2082
  return true;
2029
2083
  }
2030
- get parameter() {
2031
- return this._parameter;
2032
- }
2033
- get valueSize() {
2034
- return this._valueSize;
2035
- }
2036
- get valueFormat() {
2037
- return this._valueFormat;
2038
- }
2039
- get minValue() {
2040
- return this._minValue;
2041
- }
2042
- get maxValue() {
2043
- return this._maxValue;
2044
- }
2045
- get defaultValue() {
2046
- return this._defaultValue;
2047
- }
2048
- get nextParameter() {
2049
- return this._nextParameter;
2050
- }
2051
- get altersCapabilities() {
2052
- return this._altersCapabilities;
2053
- }
2054
- get isReadonly() {
2055
- return this._isReadonly;
2056
- }
2057
- get isAdvanced() {
2058
- return this._isAdvanced;
2059
- }
2060
- get noBulkSupport() {
2061
- return this._noBulkSupport;
2084
+ serialize() {
2085
+ this.payload = Buffer.allocUnsafe(3 + // preamble
2086
+ 3 * this.valueSize + // min, max, default value
2087
+ 2);
2088
+ this.payload.writeUInt16BE(this.parameter, 0);
2089
+ const options1 = (this.altersCapabilities ? 128 : 0) |
2090
+ (this.isReadonly ? 64 : 0) |
2091
+ ((this.valueFormat & 0b111) << 3) |
2092
+ (this.valueSize & 0b111);
2093
+ this.payload[2] = options1;
2094
+ let offset = 3;
2095
+ if (this.valueSize > 0) {
2096
+ serializeValue(this.payload, offset, this.valueSize, this.valueFormat, this.minValue);
2097
+ offset += this.valueSize;
2098
+ serializeValue(this.payload, offset, this.valueSize, this.valueFormat, this.maxValue);
2099
+ offset += this.valueSize;
2100
+ serializeValue(this.payload, offset, this.valueSize, this.valueFormat, this.defaultValue);
2101
+ offset += this.valueSize;
2102
+ }
2103
+ this.payload.writeUInt16BE(this.nextParameter, offset);
2104
+ if (this.version >= 4) {
2105
+ const options2 = (this.isAdvanced ? 0b1 : 0) | (this.noBulkSupport ? 0b10 : 0);
2106
+ this.payload = Buffer.concat([
2107
+ this.payload,
2108
+ Buffer.from([options2]),
2109
+ ]);
2110
+ }
2111
+ return super.serialize();
2062
2112
  }
2063
2113
  toLogEntry(applHost) {
2064
2114
  const message = {
2065
- "parameter #": this._parameter,
2066
- "next param #": this._nextParameter,
2067
- "value size": this._valueSize,
2068
- "value format": (0, safe_2.getEnumMemberName)(safe_1.ConfigValueFormat, this._valueFormat),
2115
+ "parameter #": this.parameter,
2116
+ "next param #": this.nextParameter,
2117
+ "value size": this.valueSize,
2118
+ "value format": (0, safe_2.getEnumMemberName)(safe_1.ConfigValueFormat, this.valueFormat),
2069
2119
  };
2070
- if (this._minValue != undefined) {
2071
- message["min value"] = configValueToString(this._minValue);
2120
+ if (this.minValue != undefined) {
2121
+ message["min value"] = configValueToString(this.minValue);
2072
2122
  }
2073
- if (this._maxValue != undefined) {
2074
- message["max value"] = configValueToString(this._maxValue);
2123
+ if (this.maxValue != undefined) {
2124
+ message["max value"] = configValueToString(this.maxValue);
2075
2125
  }
2076
- if (this._defaultValue != undefined) {
2077
- message["default value"] = configValueToString(this._defaultValue);
2126
+ if (this.defaultValue != undefined) {
2127
+ message["default value"] = configValueToString(this.defaultValue);
2078
2128
  }
2079
- if (this._altersCapabilities != undefined) {
2080
- message["alters capabilities"] = this._altersCapabilities;
2129
+ if (this.altersCapabilities != undefined) {
2130
+ message["alters capabilities"] = this.altersCapabilities;
2081
2131
  }
2082
- if (this._isReadonly != undefined) {
2083
- message.readonly = this._isReadonly;
2132
+ if (this.isReadonly != undefined) {
2133
+ message.readonly = this.isReadonly;
2084
2134
  }
2085
- if (this._isAdvanced != undefined) {
2086
- message.advanced = this._isAdvanced;
2135
+ if (this.isAdvanced != undefined) {
2136
+ message.advanced = this.isAdvanced;
2087
2137
  }
2088
- if (this._noBulkSupport != undefined) {
2089
- message["bulk support"] = !this._noBulkSupport;
2138
+ if (this.noBulkSupport != undefined) {
2139
+ message["bulk support"] = !this.noBulkSupport;
2090
2140
  }
2091
2141
  return {
2092
2142
  ...super.toLogEntry(applHost),
@@ -2102,8 +2152,8 @@ let ConfigurationCCPropertiesGet = class ConfigurationCCPropertiesGet extends Co
2102
2152
  constructor(host, options) {
2103
2153
  super(host, options);
2104
2154
  if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
2105
- // TODO: Deserialize payload
2106
- throw new safe_1.ZWaveError(`${this.constructor.name}: deserialization not implemented`, safe_1.ZWaveErrorCodes.Deserialization_NotImplemented);
2155
+ (0, safe_1.validatePayload)(this.payload.length >= 2);
2156
+ this.parameter = this.payload.readUInt16BE(0);
2107
2157
  }
2108
2158
  else {
2109
2159
  this.parameter = options.parameter;