@zwave-js/cc 13.10.1 → 14.0.0-beta.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 (293) hide show
  1. package/build/cc/AlarmSensorCC.d.ts +31 -20
  2. package/build/cc/AlarmSensorCC.d.ts.map +1 -1
  3. package/build/cc/AlarmSensorCC.js +106 -87
  4. package/build/cc/AlarmSensorCC.js.map +1 -1
  5. package/build/cc/AssociationCC.d.ts +38 -32
  6. package/build/cc/AssociationCC.d.ts.map +1 -1
  7. package/build/cc/AssociationCC.js +193 -176
  8. package/build/cc/AssociationCC.js.map +1 -1
  9. package/build/cc/AssociationGroupInfoCC.d.ts +42 -36
  10. package/build/cc/AssociationGroupInfoCC.d.ts.map +1 -1
  11. package/build/cc/AssociationGroupInfoCC.js +218 -200
  12. package/build/cc/AssociationGroupInfoCC.js.map +1 -1
  13. package/build/cc/BarrierOperatorCC.d.ts +41 -24
  14. package/build/cc/BarrierOperatorCC.d.ts.map +1 -1
  15. package/build/cc/BarrierOperatorCC.js +143 -109
  16. package/build/cc/BarrierOperatorCC.js.map +1 -1
  17. package/build/cc/BasicCC.d.ts +22 -23
  18. package/build/cc/BasicCC.d.ts.map +1 -1
  19. package/build/cc/BasicCC.js +83 -77
  20. package/build/cc/BasicCC.js.map +1 -1
  21. package/build/cc/BatteryCC.d.ts +22 -14
  22. package/build/cc/BatteryCC.d.ts.map +1 -1
  23. package/build/cc/BatteryCC.js +116 -87
  24. package/build/cc/BatteryCC.js.map +1 -1
  25. package/build/cc/BinarySensorCC.d.ts +22 -19
  26. package/build/cc/BinarySensorCC.d.ts.map +1 -1
  27. package/build/cc/BinarySensorCC.js +103 -93
  28. package/build/cc/BinarySensorCC.js.map +1 -1
  29. package/build/cc/BinarySwitchCC.d.ts +20 -20
  30. package/build/cc/BinarySwitchCC.d.ts.map +1 -1
  31. package/build/cc/BinarySwitchCC.js +71 -59
  32. package/build/cc/BinarySwitchCC.js.map +1 -1
  33. package/build/cc/CRC16CC.d.ts +9 -9
  34. package/build/cc/CRC16CC.d.ts.map +1 -1
  35. package/build/cc/CRC16CC.js +36 -36
  36. package/build/cc/CRC16CC.js.map +1 -1
  37. package/build/cc/CentralSceneCC.d.ts +34 -16
  38. package/build/cc/CentralSceneCC.d.ts.map +1 -1
  39. package/build/cc/CentralSceneCC.js +116 -79
  40. package/build/cc/CentralSceneCC.js.map +1 -1
  41. package/build/cc/ClimateControlScheduleCC.d.ts +38 -21
  42. package/build/cc/ClimateControlScheduleCC.d.ts.map +1 -1
  43. package/build/cc/ClimateControlScheduleCC.js +113 -81
  44. package/build/cc/ClimateControlScheduleCC.js.map +1 -1
  45. package/build/cc/ClockCC.d.ts +18 -11
  46. package/build/cc/ClockCC.d.ts.map +1 -1
  47. package/build/cc/ClockCC.js +57 -43
  48. package/build/cc/ClockCC.js.map +1 -1
  49. package/build/cc/ColorSwitchCC.d.ts +37 -33
  50. package/build/cc/ColorSwitchCC.d.ts.map +1 -1
  51. package/build/cc/ColorSwitchCC.js +216 -189
  52. package/build/cc/ColorSwitchCC.js.map +1 -1
  53. package/build/cc/ConfigurationCC.d.ts +89 -74
  54. package/build/cc/ConfigurationCC.d.ts.map +1 -1
  55. package/build/cc/ConfigurationCC.js +541 -485
  56. package/build/cc/ConfigurationCC.js.map +1 -1
  57. package/build/cc/DeviceResetLocallyCC.d.ts +3 -3
  58. package/build/cc/DeviceResetLocallyCC.d.ts.map +1 -1
  59. package/build/cc/DeviceResetLocallyCC.js +14 -14
  60. package/build/cc/DeviceResetLocallyCC.js.map +1 -1
  61. package/build/cc/DoorLockCC.d.ts +66 -27
  62. package/build/cc/DoorLockCC.d.ts.map +1 -1
  63. package/build/cc/DoorLockCC.js +288 -197
  64. package/build/cc/DoorLockCC.js.map +1 -1
  65. package/build/cc/DoorLockLoggingCC.d.ts +23 -13
  66. package/build/cc/DoorLockLoggingCC.d.ts.map +1 -1
  67. package/build/cc/DoorLockLoggingCC.js +81 -63
  68. package/build/cc/DoorLockLoggingCC.js.map +1 -1
  69. package/build/cc/EnergyProductionCC.d.ts +16 -14
  70. package/build/cc/EnergyProductionCC.d.ts.map +1 -1
  71. package/build/cc/EnergyProductionCC.js +58 -52
  72. package/build/cc/EnergyProductionCC.js.map +1 -1
  73. package/build/cc/EntryControlCC.d.ts +44 -18
  74. package/build/cc/EntryControlCC.d.ts.map +1 -1
  75. package/build/cc/EntryControlCC.js +163 -112
  76. package/build/cc/EntryControlCC.js.map +1 -1
  77. package/build/cc/FirmwareUpdateMetaDataCC.d.ts +69 -34
  78. package/build/cc/FirmwareUpdateMetaDataCC.d.ts.map +1 -1
  79. package/build/cc/FirmwareUpdateMetaDataCC.js +311 -245
  80. package/build/cc/FirmwareUpdateMetaDataCC.js.map +1 -1
  81. package/build/cc/HumidityControlModeCC.d.ts +24 -16
  82. package/build/cc/HumidityControlModeCC.d.ts.map +1 -1
  83. package/build/cc/HumidityControlModeCC.js +80 -65
  84. package/build/cc/HumidityControlModeCC.js.map +1 -1
  85. package/build/cc/HumidityControlOperatingStateCC.d.ts +11 -7
  86. package/build/cc/HumidityControlOperatingStateCC.d.ts.map +1 -1
  87. package/build/cc/HumidityControlOperatingStateCC.js +31 -22
  88. package/build/cc/HumidityControlOperatingStateCC.js.map +1 -1
  89. package/build/cc/HumidityControlSetpointCC.d.ts +68 -49
  90. package/build/cc/HumidityControlSetpointCC.d.ts.map +1 -1
  91. package/build/cc/HumidityControlSetpointCC.js +203 -181
  92. package/build/cc/HumidityControlSetpointCC.js.map +1 -1
  93. package/build/cc/InclusionControllerCC.d.ts +13 -11
  94. package/build/cc/InclusionControllerCC.d.ts.map +1 -1
  95. package/build/cc/InclusionControllerCC.js +49 -42
  96. package/build/cc/InclusionControllerCC.js.map +1 -1
  97. package/build/cc/IndicatorCC.d.ts +46 -39
  98. package/build/cc/IndicatorCC.d.ts.map +1 -1
  99. package/build/cc/IndicatorCC.js +298 -277
  100. package/build/cc/IndicatorCC.js.map +1 -1
  101. package/build/cc/IrrigationCC.d.ts +127 -57
  102. package/build/cc/IrrigationCC.d.ts.map +1 -1
  103. package/build/cc/IrrigationCC.js +496 -352
  104. package/build/cc/IrrigationCC.js.map +1 -1
  105. package/build/cc/LanguageCC.d.ts +17 -11
  106. package/build/cc/LanguageCC.d.ts.map +1 -1
  107. package/build/cc/LanguageCC.js +54 -44
  108. package/build/cc/LanguageCC.js.map +1 -1
  109. package/build/cc/LockCC.d.ts +16 -11
  110. package/build/cc/LockCC.d.ts.map +1 -1
  111. package/build/cc/LockCC.js +48 -38
  112. package/build/cc/LockCC.js.map +1 -1
  113. package/build/cc/ManufacturerProprietaryCC.d.ts +12 -11
  114. package/build/cc/ManufacturerProprietaryCC.d.ts.map +1 -1
  115. package/build/cc/ManufacturerProprietaryCC.js +45 -50
  116. package/build/cc/ManufacturerProprietaryCC.js.map +1 -1
  117. package/build/cc/ManufacturerSpecificCC.d.ts +20 -13
  118. package/build/cc/ManufacturerSpecificCC.d.ts.map +1 -1
  119. package/build/cc/ManufacturerSpecificCC.js +79 -63
  120. package/build/cc/ManufacturerSpecificCC.js.map +1 -1
  121. package/build/cc/MeterCC.d.ts +30 -26
  122. package/build/cc/MeterCC.d.ts.map +1 -1
  123. package/build/cc/MeterCC.js +236 -204
  124. package/build/cc/MeterCC.js.map +1 -1
  125. package/build/cc/MultiChannelAssociationCC.d.ts +31 -26
  126. package/build/cc/MultiChannelAssociationCC.d.ts.map +1 -1
  127. package/build/cc/MultiChannelAssociationCC.js +177 -168
  128. package/build/cc/MultiChannelAssociationCC.js.map +1 -1
  129. package/build/cc/MultiChannelCC.d.ts +70 -49
  130. package/build/cc/MultiChannelCC.d.ts.map +1 -1
  131. package/build/cc/MultiChannelCC.js +377 -318
  132. package/build/cc/MultiChannelCC.js.map +1 -1
  133. package/build/cc/MultiCommandCC.d.ts +9 -9
  134. package/build/cc/MultiCommandCC.d.ts.map +1 -1
  135. package/build/cc/MultiCommandCC.js +35 -36
  136. package/build/cc/MultiCommandCC.js.map +1 -1
  137. package/build/cc/MultilevelSensorCC.d.ts +38 -33
  138. package/build/cc/MultilevelSensorCC.d.ts.map +1 -1
  139. package/build/cc/MultilevelSensorCC.js +172 -152
  140. package/build/cc/MultilevelSensorCC.js.map +1 -1
  141. package/build/cc/MultilevelSwitchCC.d.ts +29 -25
  142. package/build/cc/MultilevelSwitchCC.d.ts.map +1 -1
  143. package/build/cc/MultilevelSwitchCC.js +147 -127
  144. package/build/cc/MultilevelSwitchCC.js.map +1 -1
  145. package/build/cc/NoOperationCC.d.ts +0 -8
  146. package/build/cc/NoOperationCC.d.ts.map +1 -1
  147. package/build/cc/NoOperationCC.js +2 -11
  148. package/build/cc/NoOperationCC.js.map +1 -1
  149. package/build/cc/NodeNamingCC.d.ts +27 -17
  150. package/build/cc/NodeNamingCC.d.ts.map +1 -1
  151. package/build/cc/NodeNamingCC.js +86 -69
  152. package/build/cc/NodeNamingCC.js.map +1 -1
  153. package/build/cc/NotificationCC.d.ts +46 -43
  154. package/build/cc/NotificationCC.d.ts.map +1 -1
  155. package/build/cc/NotificationCC.js +317 -303
  156. package/build/cc/NotificationCC.js.map +1 -1
  157. package/build/cc/PowerlevelCC.d.ts +22 -18
  158. package/build/cc/PowerlevelCC.d.ts.map +1 -1
  159. package/build/cc/PowerlevelCC.js +125 -95
  160. package/build/cc/PowerlevelCC.js.map +1 -1
  161. package/build/cc/ProtectionCC.d.ts +49 -26
  162. package/build/cc/ProtectionCC.d.ts.map +1 -1
  163. package/build/cc/ProtectionCC.js +172 -126
  164. package/build/cc/ProtectionCC.js.map +1 -1
  165. package/build/cc/SceneActivationCC.d.ts +8 -7
  166. package/build/cc/SceneActivationCC.d.ts.map +1 -1
  167. package/build/cc/SceneActivationCC.js +28 -23
  168. package/build/cc/SceneActivationCC.js.map +1 -1
  169. package/build/cc/SceneActuatorConfigurationCC.d.ts +23 -15
  170. package/build/cc/SceneActuatorConfigurationCC.d.ts.map +1 -1
  171. package/build/cc/SceneActuatorConfigurationCC.js +79 -62
  172. package/build/cc/SceneActuatorConfigurationCC.js.map +1 -1
  173. package/build/cc/SceneControllerConfigurationCC.d.ts +25 -17
  174. package/build/cc/SceneControllerConfigurationCC.d.ts.map +1 -1
  175. package/build/cc/SceneControllerConfigurationCC.js +92 -78
  176. package/build/cc/SceneControllerConfigurationCC.js.map +1 -1
  177. package/build/cc/ScheduleEntryLockCC.d.ts +86 -72
  178. package/build/cc/ScheduleEntryLockCC.d.ts.map +1 -1
  179. package/build/cc/ScheduleEntryLockCC.js +607 -455
  180. package/build/cc/ScheduleEntryLockCC.js.map +1 -1
  181. package/build/cc/Security2CC.d.ts +78 -87
  182. package/build/cc/Security2CC.d.ts.map +1 -1
  183. package/build/cc/Security2CC.js +798 -765
  184. package/build/cc/Security2CC.js.map +1 -1
  185. package/build/cc/SecurityCC.d.ts +47 -42
  186. package/build/cc/SecurityCC.d.ts.map +1 -1
  187. package/build/cc/SecurityCC.js +240 -218
  188. package/build/cc/SecurityCC.js.map +1 -1
  189. package/build/cc/SoundSwitchCC.d.ts +36 -29
  190. package/build/cc/SoundSwitchCC.d.ts.map +1 -1
  191. package/build/cc/SoundSwitchCC.js +180 -157
  192. package/build/cc/SoundSwitchCC.js.map +1 -1
  193. package/build/cc/SupervisionCC.d.ts +17 -14
  194. package/build/cc/SupervisionCC.d.ts.map +1 -1
  195. package/build/cc/SupervisionCC.js +86 -66
  196. package/build/cc/SupervisionCC.js.map +1 -1
  197. package/build/cc/ThermostatFanModeCC.d.ts +25 -15
  198. package/build/cc/ThermostatFanModeCC.d.ts.map +1 -1
  199. package/build/cc/ThermostatFanModeCC.js +79 -60
  200. package/build/cc/ThermostatFanModeCC.js.map +1 -1
  201. package/build/cc/ThermostatFanStateCC.d.ts +11 -7
  202. package/build/cc/ThermostatFanStateCC.d.ts.map +1 -1
  203. package/build/cc/ThermostatFanStateCC.js +31 -22
  204. package/build/cc/ThermostatFanStateCC.js.map +1 -1
  205. package/build/cc/ThermostatModeCC.d.ts +24 -21
  206. package/build/cc/ThermostatModeCC.d.ts.map +1 -1
  207. package/build/cc/ThermostatModeCC.js +106 -90
  208. package/build/cc/ThermostatModeCC.js.map +1 -1
  209. package/build/cc/ThermostatOperatingStateCC.d.ts +11 -7
  210. package/build/cc/ThermostatOperatingStateCC.d.ts.map +1 -1
  211. package/build/cc/ThermostatOperatingStateCC.js +31 -22
  212. package/build/cc/ThermostatOperatingStateCC.js.map +1 -1
  213. package/build/cc/ThermostatSetbackCC.d.ts +14 -13
  214. package/build/cc/ThermostatSetbackCC.d.ts.map +1 -1
  215. package/build/cc/ThermostatSetbackCC.js +64 -57
  216. package/build/cc/ThermostatSetbackCC.js.map +1 -1
  217. package/build/cc/ThermostatSetpointCC.d.ts +38 -57
  218. package/build/cc/ThermostatSetpointCC.d.ts.map +1 -1
  219. package/build/cc/ThermostatSetpointCC.js +200 -264
  220. package/build/cc/ThermostatSetpointCC.js.map +1 -1
  221. package/build/cc/TimeCC.d.ts +24 -20
  222. package/build/cc/TimeCC.d.ts.map +1 -1
  223. package/build/cc/TimeCC.js +119 -108
  224. package/build/cc/TimeCC.js.map +1 -1
  225. package/build/cc/TimeParametersCC.d.ts +18 -14
  226. package/build/cc/TimeParametersCC.d.ts.map +1 -1
  227. package/build/cc/TimeParametersCC.js +77 -69
  228. package/build/cc/TimeParametersCC.js.map +1 -1
  229. package/build/cc/TransportServiceCC.d.ts +29 -32
  230. package/build/cc/TransportServiceCC.d.ts.map +1 -1
  231. package/build/cc/TransportServiceCC.js +159 -161
  232. package/build/cc/TransportServiceCC.js.map +1 -1
  233. package/build/cc/UserCodeCC.d.ts +83 -66
  234. package/build/cc/UserCodeCC.d.ts.map +1 -1
  235. package/build/cc/UserCodeCC.js +449 -402
  236. package/build/cc/UserCodeCC.js.map +1 -1
  237. package/build/cc/VersionCC.d.ts +36 -20
  238. package/build/cc/VersionCC.d.ts.map +1 -1
  239. package/build/cc/VersionCC.js +190 -149
  240. package/build/cc/VersionCC.js.map +1 -1
  241. package/build/cc/WakeUpCC.d.ts +27 -13
  242. package/build/cc/WakeUpCC.d.ts.map +1 -1
  243. package/build/cc/WakeUpCC.js +105 -77
  244. package/build/cc/WakeUpCC.js.map +1 -1
  245. package/build/cc/WindowCoveringCC.d.ts +39 -27
  246. package/build/cc/WindowCoveringCC.d.ts.map +1 -1
  247. package/build/cc/WindowCoveringCC.js +169 -137
  248. package/build/cc/WindowCoveringCC.js.map +1 -1
  249. package/build/cc/ZWavePlusCC.d.ts +8 -7
  250. package/build/cc/ZWavePlusCC.d.ts.map +1 -1
  251. package/build/cc/ZWavePlusCC.js +44 -37
  252. package/build/cc/ZWavePlusCC.js.map +1 -1
  253. package/build/cc/ZWaveProtocolCC.d.ts +111 -84
  254. package/build/cc/ZWaveProtocolCC.d.ts.map +1 -1
  255. package/build/cc/ZWaveProtocolCC.js +583 -508
  256. package/build/cc/ZWaveProtocolCC.js.map +1 -1
  257. package/build/cc/index.d.ts +37 -34
  258. package/build/cc/index.d.ts.map +1 -1
  259. package/build/cc/index.js +6 -7
  260. package/build/cc/index.js.map +1 -1
  261. package/build/cc/manufacturerProprietary/FibaroCC.d.ts +29 -24
  262. package/build/cc/manufacturerProprietary/FibaroCC.d.ts.map +1 -1
  263. package/build/cc/manufacturerProprietary/FibaroCC.js +109 -112
  264. package/build/cc/manufacturerProprietary/FibaroCC.js.map +1 -1
  265. package/build/index.d.ts +0 -1
  266. package/build/index.d.ts.map +1 -1
  267. package/build/index.js +0 -1
  268. package/build/index.js.map +1 -1
  269. package/build/lib/API.d.ts +21 -18
  270. package/build/lib/API.d.ts.map +1 -1
  271. package/build/lib/API.js +25 -49
  272. package/build/lib/API.js.map +1 -1
  273. package/build/lib/CommandClass.d.ts +51 -89
  274. package/build/lib/CommandClass.d.ts.map +1 -1
  275. package/build/lib/CommandClass.js +177 -249
  276. package/build/lib/CommandClass.js.map +1 -1
  277. package/build/lib/EncapsulatingCommandClass.d.ts +1 -15
  278. package/build/lib/EncapsulatingCommandClass.d.ts.map +1 -1
  279. package/build/lib/EncapsulatingCommandClass.js.map +1 -1
  280. package/build/lib/ICommandClassContainer.d.ts +1 -8
  281. package/build/lib/ICommandClassContainer.d.ts.map +1 -1
  282. package/build/lib/ICommandClassContainer.js +0 -8
  283. package/build/lib/ICommandClassContainer.js.map +1 -1
  284. package/build/lib/Values.d.ts +3 -3
  285. package/build/lib/Values.d.ts.map +1 -1
  286. package/build/lib/_Types.d.ts.map +1 -1
  287. package/build/lib/_Types.js +1 -0
  288. package/build/lib/_Types.js.map +1 -1
  289. package/build/lib/utils.d.ts +14 -13
  290. package/build/lib/utils.d.ts.map +1 -1
  291. package/build/lib/utils.js +94 -92
  292. package/build/lib/utils.js.map +1 -1
  293. package/package.json +4 -5
@@ -5,6 +5,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
5
5
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
6
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7
7
  };
8
+ var ConfigurationCCReport_1, ConfigurationCCGet_1, ConfigurationCCSet_1, ConfigurationCCBulkReport_1, ConfigurationCCNameReport_1, ConfigurationCCNameGet_1, ConfigurationCCInfoReport_1, ConfigurationCCInfoGet_1, ConfigurationCCPropertiesReport_1, ConfigurationCCPropertiesGet_1;
8
9
  Object.defineProperty(exports, "__esModule", { value: true });
9
10
  exports.ConfigurationCCDefaultReset = exports.ConfigurationCCPropertiesGet = exports.ConfigurationCCPropertiesReport = exports.ConfigurationCCInfoGet = exports.ConfigurationCCInfoReport = exports.ConfigurationCCNameGet = exports.ConfigurationCCNameReport = exports.ConfigurationCCBulkGet = exports.ConfigurationCCBulkReport = exports.ConfigurationCCBulkSet = exports.ConfigurationCCSet = exports.ConfigurationCCGet = exports.ConfigurationCCReport = exports.ConfigurationCC = exports.ConfigurationCCAPI = exports.ConfigurationCCValues = exports.ConfigurationCCError = void 0;
10
11
  function __assertType(argName, typeName, boundHasError) {
@@ -445,14 +446,14 @@ exports.ConfigurationCCValues = Object.freeze({
445
446
  undefined),
446
447
  }),
447
448
  });
448
- function createConfigurationCCInstance(applHost, endpoint) {
449
- return CommandClass_1.CommandClass.createInstanceUnchecked(applHost, endpoint.virtual ? endpoint.node.physicalNodes[0] : endpoint, ConfigurationCC);
449
+ function createConfigurationCCInstance(endpoint) {
450
+ return CommandClass_1.CommandClass.createInstanceUnchecked(endpoint.virtual ? endpoint.node.physicalNodes[0] : endpoint, ConfigurationCC);
450
451
  }
451
- function normalizeConfigurationCCAPISetOptions(applHost, endpoint, options) {
452
+ function normalizeConfigurationCCAPISetOptions(ctx, endpoint, options) {
452
453
  if ("bitMask" in options && options.bitMask) {
453
454
  // Variant 3: Partial param, look it up in the device config
454
- const ccc = createConfigurationCCInstance(applHost, endpoint);
455
- const paramInfo = ccc.getParamInformation(applHost, options.parameter, options.bitMask);
455
+ const ccc = createConfigurationCCInstance(endpoint);
456
+ const paramInfo = ccc.getParamInformation(ctx, options.parameter, options.bitMask);
456
457
  if (!paramInfo.isFromConfig) {
457
458
  throw new safe_1.ZWaveError("Setting a partial configuration parameter requires it to be defined in a device config file!", safe_1.ZWaveErrorCodes.Argument_Invalid);
458
459
  }
@@ -475,8 +476,8 @@ function normalizeConfigurationCCAPISetOptions(applHost, endpoint, options) {
475
476
  }
476
477
  else {
477
478
  // Variant 1: Normal parameter, defined in a config file
478
- const ccc = createConfigurationCCInstance(applHost, endpoint);
479
- const paramInfo = ccc.getParamInformation(applHost, options.parameter, options.bitMask);
479
+ const ccc = createConfigurationCCInstance(endpoint);
480
+ const paramInfo = ccc.getParamInformation(ctx, options.parameter, options.bitMask);
480
481
  if (!paramInfo.isFromConfig) {
481
482
  throw new safe_1.ZWaveError("Setting a configuration parameter without specifying a value size and format requires it to be defined in a device config file!", safe_1.ZWaveErrorCodes.Argument_Invalid);
482
483
  }
@@ -488,7 +489,7 @@ function normalizeConfigurationCCAPISetOptions(applHost, endpoint, options) {
488
489
  };
489
490
  }
490
491
  }
491
- function bulkMergePartialParamValues(applHost, endpoint, options) {
492
+ function bulkMergePartialParamValues(ctx, endpoint, options) {
492
493
  // Merge partial parameters before doing anything else. Therefore, take the non-partials, ...
493
494
  const allParams = options.filter((o) => o.bitMask == undefined);
494
495
  // ... group the partials by parameter
@@ -501,11 +502,11 @@ function bulkMergePartialParamValues(applHost, endpoint, options) {
501
502
  }
502
503
  // and push the merged result into the array we'll be working with
503
504
  if (unmergedPartials.size) {
504
- const ccc = createConfigurationCCInstance(applHost, endpoint);
505
+ const ccc = createConfigurationCCInstance(endpoint);
505
506
  for (const [parameter, partials] of unmergedPartials) {
506
507
  allParams.push({
507
508
  parameter,
508
- value: ccc.composePartialParamValues(applHost, parameter, partials.map((p) => ({
509
+ value: ccc.composePartialParamValues(ctx, parameter, partials.map((p) => ({
509
510
  bitMask: p.bitMask,
510
511
  partialValue: p.value,
511
512
  }))),
@@ -530,8 +531,8 @@ function reInterpretSignedValue(value, valueSize, targetFormat) {
530
531
  serializeValue(raw, 0, valueSize, safe_1.ConfigValueFormat.SignedInteger, value);
531
532
  return parseValue(raw, valueSize, targetFormat);
532
533
  }
533
- function getParamInformationFromConfigFile(applHost, nodeId, endpointIndex) {
534
- const deviceConfig = applHost.getDeviceConfig?.(nodeId);
534
+ function getParamInformationFromConfigFile(ctx, nodeId, endpointIndex) {
535
+ const deviceConfig = ctx.getDeviceConfig?.(nodeId);
535
536
  if (endpointIndex === 0) {
536
537
  return (deviceConfig?.paramInformation
537
538
  ?? deviceConfig?.endpoints?.get(0)?.paramInformation);
@@ -571,9 +572,9 @@ let ConfigurationCCAPI = class ConfigurationCCAPI extends API_1.CCAPI {
571
572
  (0, API_1.throwWrongValueType)(this.ccId, property, "number", typeof value);
572
573
  }
573
574
  let ccInstance;
574
- const applHost = this.applHost;
575
+ const applHost = this.host;
575
576
  if (this.isSinglecast()) {
576
- ccInstance = createConfigurationCCInstance(this.applHost, this.endpoint);
577
+ ccInstance = createConfigurationCCInstance(this.endpoint);
577
578
  }
578
579
  else if (this.isMulticast()) {
579
580
  // Multicast is only possible if the parameter definition is the same on all target nodes
@@ -584,7 +585,7 @@ let ConfigurationCCAPI = class ConfigurationCCAPI extends API_1.CCAPI {
584
585
  throw new safe_1.ZWaveError(`The multicast setValue API for Configuration CC requires all virtual target endpoints to support Configuration CC!`, safe_1.ZWaveErrorCodes.CC_Invalid);
585
586
  }
586
587
  // Figure out if all the relevant info is the same
587
- const paramInfos = this.endpoint.node.physicalNodes.map((node) => createConfigurationCCInstance(this.applHost, node.getEndpoint(this.endpoint.index)).getParamInformation(this.applHost, property, propertyKey));
588
+ const paramInfos = this.endpoint.node.physicalNodes.map((node) => createConfigurationCCInstance(node.getEndpoint(this.endpoint.index)).getParamInformation(this.host, property, propertyKey));
588
589
  if (!paramInfos.length
589
590
  || !paramInfos.every((info, index) => {
590
591
  if (index === 0)
@@ -595,7 +596,7 @@ let ConfigurationCCAPI = class ConfigurationCCAPI extends API_1.CCAPI {
595
596
  throw new safe_1.ZWaveError(`The multicast setValue API for Configuration CC requires all virtual target nodes to have the same parameter definition!`, safe_1.ZWaveErrorCodes.CC_Invalid);
596
597
  }
597
598
  // If it is, just use the first node to create the CC instance
598
- ccInstance = createConfigurationCCInstance(this.applHost, this.endpoint);
599
+ ccInstance = createConfigurationCCInstance(this.endpoint);
599
600
  }
600
601
  else {
601
602
  throw new safe_1.ZWaveError(`The setValue API for Configuration CC is not supported via broadcast!`, safe_1.ZWaveErrorCodes.CC_NotSupported);
@@ -680,13 +681,13 @@ let ConfigurationCCAPI = class ConfigurationCCAPI extends API_1.CCAPI {
680
681
  }
681
682
  this.assertSupportsCommand(_Types_1.ConfigurationCommand, _Types_1.ConfigurationCommand.Get);
682
683
  const { valueBitMask, allowUnexpectedResponse } = options ?? {};
683
- const cc = new ConfigurationCCGet(this.applHost, {
684
+ const cc = new ConfigurationCCGet({
684
685
  nodeId: this.endpoint.nodeId,
685
- endpoint: this.endpoint.index,
686
+ endpointIndex: this.endpoint.index,
686
687
  parameter,
687
688
  allowUnexpectedResponse,
688
689
  });
689
- const response = await this.applHost.sendCommand(cc, this.commandOptions);
690
+ const response = await this.host.sendCommand(cc, this.commandOptions);
690
691
  if (!response)
691
692
  return;
692
693
  // Nodes may respond with a different parameter, e.g. if we
@@ -695,10 +696,10 @@ let ConfigurationCCAPI = class ConfigurationCCAPI extends API_1.CCAPI {
695
696
  if (!valueBitMask)
696
697
  return response.value;
697
698
  // If a partial parameter was requested, extract that value
698
- const paramInfo = cc.getParamInformation(this.applHost, response.parameter, valueBitMask);
699
+ const paramInfo = cc.getParamInformation(this.host, response.parameter, valueBitMask);
699
700
  return (0, safe_1.parsePartial)(response.value, valueBitMask, isSignedPartial(valueBitMask, paramInfo.format));
700
701
  }
701
- this.applHost.controllerLog.logNode(this.endpoint.nodeId, {
702
+ this.host.logNode(this.endpoint.nodeId, {
702
703
  endpoint: this.endpoint.index,
703
704
  message: `Received unexpected ConfigurationReport (param = ${response.parameter}, value = ${response.value.toString()})`,
704
705
  direction: "inbound",
@@ -719,12 +720,12 @@ let ConfigurationCCAPI = class ConfigurationCCAPI extends API_1.CCAPI {
719
720
  const distinctParameters = (0, arrays_1.distinct)(options.map((o) => o.parameter));
720
721
  if (this.supportsCommand(_Types_1.ConfigurationCommand.BulkGet)
721
722
  && (0, safe_1.isConsecutiveArray)(distinctParameters)) {
722
- const cc = new ConfigurationCCBulkGet(this.applHost, {
723
+ const cc = new ConfigurationCCBulkGet({
723
724
  nodeId: this.endpoint.nodeId,
724
- endpoint: this.endpoint.index,
725
+ endpointIndex: this.endpoint.index,
725
726
  parameters: distinctParameters,
726
727
  });
727
- const response = await this.applHost.sendCommand(cc, this.commandOptions);
728
+ const response = await this.host.sendCommand(cc, this.commandOptions);
728
729
  if (response)
729
730
  values = response.values;
730
731
  }
@@ -732,12 +733,12 @@ let ConfigurationCCAPI = class ConfigurationCCAPI extends API_1.CCAPI {
732
733
  this.assertSupportsCommand(_Types_1.ConfigurationCommand, _Types_1.ConfigurationCommand.Get);
733
734
  const _values = new Map();
734
735
  for (const parameter of distinctParameters) {
735
- const cc = new ConfigurationCCGet(this.applHost, {
736
+ const cc = new ConfigurationCCGet({
736
737
  nodeId: this.endpoint.nodeId,
737
- endpoint: this.endpoint.index,
738
+ endpointIndex: this.endpoint.index,
738
739
  parameter,
739
740
  });
740
- const response = await this.applHost.sendCommand(cc, this.commandOptions);
741
+ const response = await this.host.sendCommand(cc, this.commandOptions);
741
742
  if (response) {
742
743
  _values.set(response.parameter, response.value);
743
744
  }
@@ -745,11 +746,11 @@ let ConfigurationCCAPI = class ConfigurationCCAPI extends API_1.CCAPI {
745
746
  values = _values;
746
747
  }
747
748
  // Combine the returned values with the requested ones
748
- const cc = createConfigurationCCInstance(this.applHost, this.endpoint);
749
+ const cc = createConfigurationCCInstance(this.endpoint);
749
750
  return options.map((o) => {
750
751
  let value = values?.get(o.parameter);
751
752
  if (typeof value === "number" && o.bitMask) {
752
- const paramInfo = cc.getParamInformation(this.applHost, o.parameter, o.bitMask);
753
+ const paramInfo = cc.getParamInformation(this.host, o.parameter, o.bitMask);
753
754
  value = (0, safe_1.parsePartial)(value, o.bitMask, isSignedPartial(o.bitMask, paramInfo.format));
754
755
  }
755
756
  return { ...o, value };
@@ -765,22 +766,22 @@ let ConfigurationCCAPI = class ConfigurationCCAPI extends API_1.CCAPI {
765
766
  return this.setBulk([options]);
766
767
  }
767
768
  this.assertSupportsCommand(_Types_1.ConfigurationCommand, _Types_1.ConfigurationCommand.Set);
768
- const normalized = normalizeConfigurationCCAPISetOptions(this.applHost, this.endpoint, options);
769
+ const normalized = normalizeConfigurationCCAPISetOptions(this.host, this.endpoint, options);
769
770
  let value = normalized.value;
770
771
  if (normalized.bitMask) {
771
- const ccc = createConfigurationCCInstance(this.applHost, this.endpoint);
772
- value = ccc.composePartialParamValue(this.applHost, normalized.parameter, normalized.bitMask, normalized.value);
772
+ const ccc = createConfigurationCCInstance(this.endpoint);
773
+ value = ccc.composePartialParamValue(this.host, normalized.parameter, normalized.bitMask, normalized.value);
773
774
  }
774
- const cc = new ConfigurationCCSet(this.applHost, {
775
+ const cc = new ConfigurationCCSet({
775
776
  nodeId: this.endpoint.nodeId,
776
- endpoint: this.endpoint.index,
777
+ endpointIndex: this.endpoint.index,
777
778
  resetToDefault: false,
778
779
  parameter: normalized.parameter,
779
780
  value,
780
781
  valueSize: normalized.valueSize,
781
782
  valueFormat: normalized.valueFormat,
782
783
  });
783
- return this.applHost.sendCommand(cc, this.commandOptions);
784
+ return this.host.sendCommand(cc, this.commandOptions);
784
785
  }
785
786
  /**
786
787
  * Sets new values for multiple config parameters of the device. Uses the `BulkSet` command if supported, otherwise falls back to individual `Set` commands.
@@ -788,9 +789,9 @@ let ConfigurationCCAPI = class ConfigurationCCAPI extends API_1.CCAPI {
788
789
  async setBulk(values) {
789
790
  __assertType("values", undefined, __assertType__sa_su_si__4__5_ei_si__4__7_ei_si__4__9_ei_eu_ea_2.bind(void 0, values));
790
791
  // Normalize the values so we can better work with them
791
- const normalized = values.map((v) => normalizeConfigurationCCAPISetOptions(this.applHost, this.endpoint, v));
792
+ const normalized = values.map((v) => normalizeConfigurationCCAPISetOptions(this.host, this.endpoint, v));
792
793
  // And merge multiple partials that belong the same "full" value
793
- const allParams = bulkMergePartialParamValues(this.applHost, this.endpoint, normalized);
794
+ const allParams = bulkMergePartialParamValues(this.host, this.endpoint, normalized);
794
795
  const canUseBulkSet = this.supportsCommand(_Types_1.ConfigurationCommand.BulkSet)
795
796
  // For Bulk Set we need consecutive parameters
796
797
  && (0, safe_1.isConsecutiveArray)(allParams.map((v) => v.parameter))
@@ -799,9 +800,9 @@ let ConfigurationCCAPI = class ConfigurationCCAPI extends API_1.CCAPI {
799
800
  // and identical size
800
801
  && new Set(allParams.map((v) => v.valueSize)).size === 1;
801
802
  if (canUseBulkSet) {
802
- const cc = new ConfigurationCCBulkSet(this.applHost, {
803
+ const cc = new ConfigurationCCBulkSet({
803
804
  nodeId: this.endpoint.nodeId,
804
- endpoint: this.endpoint.index,
805
+ endpointIndex: this.endpoint.index,
805
806
  parameters: allParams.map((v) => v.parameter),
806
807
  valueSize: allParams[0].valueSize,
807
808
  valueFormat: allParams[0].valueFormat,
@@ -809,7 +810,7 @@ let ConfigurationCCAPI = class ConfigurationCCAPI extends API_1.CCAPI {
809
810
  handshake: true,
810
811
  });
811
812
  // The handshake flag is set, so we expect a BulkReport in response
812
- const result = await this.applHost.sendCommand(cc, this.commandOptions);
813
+ const result = await this.host.sendCommand(cc, this.commandOptions);
813
814
  // If we did receive a response, we also received the updated parameters,
814
815
  // so if any one was not accepted, we know by looking at the values.
815
816
  // Translate the result into a SupervisionResult by comparing the values
@@ -832,15 +833,15 @@ let ConfigurationCCAPI = class ConfigurationCCAPI extends API_1.CCAPI {
832
833
  this.assertSupportsCommand(_Types_1.ConfigurationCommand, _Types_1.ConfigurationCommand.Set);
833
834
  const supervisionResults = [];
834
835
  for (const { parameter, value, valueSize, valueFormat, } of allParams) {
835
- const cc = new ConfigurationCCSet(this.applHost, {
836
+ const cc = new ConfigurationCCSet({
836
837
  nodeId: this.endpoint.nodeId,
837
- endpoint: this.endpoint.index,
838
+ endpointIndex: this.endpoint.index,
838
839
  parameter,
839
840
  value,
840
841
  valueSize,
841
842
  valueFormat,
842
843
  });
843
- supervisionResults.push(await this.applHost.sendCommand(cc, this.commandOptions));
844
+ supervisionResults.push(await this.host.sendCommand(cc, this.commandOptions));
844
845
  }
845
846
  return (0, safe_1.mergeSupervisionResults)(supervisionResults);
846
847
  }
@@ -856,14 +857,21 @@ let ConfigurationCCAPI = class ConfigurationCCAPI extends API_1.CCAPI {
856
857
  if (parameter > 255) {
857
858
  return this.resetBulk([parameter]);
858
859
  }
860
+ // According to SDS14223 this flag SHOULD NOT be set
861
+ // Because we don't want to test the behavior, we enforce that it MUST not be set
862
+ // on legacy nodes
863
+ if (this.version <= 3) {
864
+ throw new safe_1.ZWaveError(`Resetting configuration parameters to default MUST not be done on nodes implementing ConfigurationCC V3 or below!`, safe_1.ZWaveErrorCodes
865
+ .ConfigurationCC_NoResetToDefaultOnLegacyDevices);
866
+ }
859
867
  this.assertSupportsCommand(_Types_1.ConfigurationCommand, _Types_1.ConfigurationCommand.Set);
860
- const cc = new ConfigurationCCSet(this.applHost, {
868
+ const cc = new ConfigurationCCSet({
861
869
  nodeId: this.endpoint.nodeId,
862
- endpoint: this.endpoint.index,
870
+ endpointIndex: this.endpoint.index,
863
871
  parameter,
864
872
  resetToDefault: true,
865
873
  });
866
- return this.applHost.sendCommand(cc, this.commandOptions);
874
+ return this.host.sendCommand(cc, this.commandOptions);
867
875
  }
868
876
  /**
869
877
  * Resets multiple configuration parameters to their default value. Uses BulkSet if supported, otherwise falls back to individual Set commands.
@@ -874,24 +882,24 @@ let ConfigurationCCAPI = class ConfigurationCCAPI extends API_1.CCAPI {
874
882
  __assertType("parameters", undefined, __assertType__sa__number_ea_2.bind(void 0, parameters));
875
883
  if ((0, safe_1.isConsecutiveArray)(parameters)
876
884
  && this.supportsCommand(_Types_1.ConfigurationCommand.BulkSet)) {
877
- const cc = new ConfigurationCCBulkSet(this.applHost, {
885
+ const cc = new ConfigurationCCBulkSet({
878
886
  nodeId: this.endpoint.nodeId,
879
- endpoint: this.endpoint.index,
887
+ endpointIndex: this.endpoint.index,
880
888
  parameters,
881
889
  resetToDefault: true,
882
890
  });
883
- return this.applHost.sendCommand(cc, this.commandOptions);
891
+ return this.host.sendCommand(cc, this.commandOptions);
884
892
  }
885
893
  else {
886
894
  this.assertSupportsCommand(_Types_1.ConfigurationCommand, _Types_1.ConfigurationCommand.Set);
887
- const CCs = (0, arrays_1.distinct)(parameters).map((parameter) => new ConfigurationCCSet(this.applHost, {
895
+ const CCs = (0, arrays_1.distinct)(parameters).map((parameter) => new ConfigurationCCSet({
888
896
  nodeId: this.endpoint.nodeId,
889
- endpoint: this.endpoint.index,
897
+ endpointIndex: this.endpoint.index,
890
898
  parameter,
891
899
  resetToDefault: true,
892
900
  }));
893
901
  for (const cc of CCs) {
894
- await this.applHost.sendCommand(cc, this.commandOptions);
902
+ await this.host.sendCommand(cc, this.commandOptions);
895
903
  }
896
904
  }
897
905
  }
@@ -900,22 +908,22 @@ let ConfigurationCCAPI = class ConfigurationCCAPI extends API_1.CCAPI {
900
908
  // This is dangerous - don't allow resetting all parameters via multicast
901
909
  this.assertPhysicalEndpoint(this.endpoint);
902
910
  this.assertSupportsCommand(_Types_1.ConfigurationCommand, _Types_1.ConfigurationCommand.DefaultReset);
903
- const cc = new ConfigurationCCDefaultReset(this.applHost, {
911
+ const cc = new ConfigurationCCDefaultReset({
904
912
  nodeId: this.endpoint.nodeId,
905
- endpoint: this.endpoint.index,
913
+ endpointIndex: this.endpoint.index,
906
914
  });
907
- await this.applHost.sendCommand(cc, this.commandOptions);
915
+ await this.host.sendCommand(cc, this.commandOptions);
908
916
  }
909
917
  async getProperties(parameter) {
910
918
  __assertType("parameter", "number", __assertType__number.bind(void 0, parameter));
911
919
  // Get-type commands are only possible in singlecast
912
920
  this.assertPhysicalEndpoint(this.endpoint);
913
- const cc = new ConfigurationCCPropertiesGet(this.applHost, {
921
+ const cc = new ConfigurationCCPropertiesGet({
914
922
  nodeId: this.endpoint.nodeId,
915
- endpoint: this.endpoint.index,
923
+ endpointIndex: this.endpoint.index,
916
924
  parameter,
917
925
  });
918
- const response = await this.applHost.sendCommand(cc, this.commandOptions);
926
+ const response = await this.host.sendCommand(cc, this.commandOptions);
919
927
  if (response) {
920
928
  return (0, safe_2.pick)(response, [
921
929
  "valueSize",
@@ -936,12 +944,12 @@ let ConfigurationCCAPI = class ConfigurationCCAPI extends API_1.CCAPI {
936
944
  __assertType("parameter", "number", __assertType__number.bind(void 0, parameter));
937
945
  // Get-type commands are only possible in singlecast
938
946
  this.assertPhysicalEndpoint(this.endpoint);
939
- const cc = new ConfigurationCCNameGet(this.applHost, {
947
+ const cc = new ConfigurationCCNameGet({
940
948
  nodeId: this.endpoint.nodeId,
941
- endpoint: this.endpoint.index,
949
+ endpointIndex: this.endpoint.index,
942
950
  parameter,
943
951
  });
944
- const response = await this.applHost.sendCommand(cc, this.commandOptions);
952
+ const response = await this.host.sendCommand(cc, this.commandOptions);
945
953
  return response?.name;
946
954
  }
947
955
  /** Requests usage info for a configuration parameter from the node */
@@ -949,12 +957,12 @@ let ConfigurationCCAPI = class ConfigurationCCAPI extends API_1.CCAPI {
949
957
  __assertType("parameter", "number", __assertType__number.bind(void 0, parameter));
950
958
  // Get-type commands are only possible in singlecast
951
959
  this.assertPhysicalEndpoint(this.endpoint);
952
- const cc = new ConfigurationCCInfoGet(this.applHost, {
960
+ const cc = new ConfigurationCCInfoGet({
953
961
  nodeId: this.endpoint.nodeId,
954
- endpoint: this.endpoint.index,
962
+ endpointIndex: this.endpoint.index,
955
963
  parameter,
956
964
  });
957
- const response = await this.applHost.sendCommand(cc, this.commandOptions);
965
+ const response = await this.host.sendCommand(cc, this.commandOptions);
958
966
  return response?.info;
959
967
  }
960
968
  /**
@@ -975,15 +983,15 @@ let ConfigurationCCAPI = class ConfigurationCCAPI extends API_1.CCAPI {
975
983
  // Get-type commands are only possible in singlecast
976
984
  this.assertPhysicalEndpoint(this.endpoint);
977
985
  // TODO: Reduce the priority of the messages
978
- this.applHost.controllerLog.logNode(this.endpoint.nodeId, {
986
+ this.host.logNode(this.endpoint.nodeId, {
979
987
  endpoint: this.endpoint.index,
980
988
  message: `Scanning available parameters...`,
981
989
  });
982
- const ccInstance = createConfigurationCCInstance(this.applHost, this.endpoint);
990
+ const ccInstance = createConfigurationCCInstance(this.endpoint);
983
991
  for (let param = 1; param <= 255; param++) {
984
992
  // Check if the parameter is readable
985
993
  let originalValue;
986
- this.applHost.controllerLog.logNode(this.endpoint.nodeId, {
994
+ this.host.logNode(this.endpoint.nodeId, {
987
995
  endpoint: this.endpoint.index,
988
996
  message: ` trying param ${param}...`,
989
997
  direction: "outbound",
@@ -998,10 +1006,10 @@ let ConfigurationCCAPI = class ConfigurationCCAPI extends API_1.CCAPI {
998
1006
  if (originalValue != undefined) {
999
1007
  const logMessage = ` Param ${param}:
1000
1008
  readable = true
1001
- valueSize = ${ccInstance.getParamInformation(this.applHost, param)
1009
+ valueSize = ${ccInstance.getParamInformation(this.host, param)
1002
1010
  .valueSize}
1003
1011
  value = ${originalValue.toString()}`;
1004
- this.applHost.controllerLog.logNode(this.endpoint.nodeId, {
1012
+ this.host.logNode(this.endpoint.nodeId, {
1005
1013
  endpoint: this.endpoint.index,
1006
1014
  message: logMessage,
1007
1015
  direction: "inbound",
@@ -1027,30 +1035,30 @@ exports.ConfigurationCCAPI = ConfigurationCCAPI = __decorate([
1027
1035
  (0, CommandClassDecorators_1.API)(safe_1.CommandClasses.Configuration)
1028
1036
  ], ConfigurationCCAPI);
1029
1037
  let ConfigurationCC = class ConfigurationCC extends CommandClass_1.CommandClass {
1030
- async interview(applHost) {
1031
- const node = this.getNode(applHost);
1032
- const endpoint = this.getEndpoint(applHost);
1033
- const api = API_1.CCAPI.create(safe_1.CommandClasses.Configuration, applHost, endpoint).withOptions({
1038
+ async interview(ctx) {
1039
+ const node = this.getNode(ctx);
1040
+ const endpoint = this.getEndpoint(ctx);
1041
+ const api = API_1.CCAPI.create(safe_1.CommandClasses.Configuration, ctx, endpoint).withOptions({
1034
1042
  priority: safe_1.MessagePriority.NodeQuery,
1035
1043
  });
1036
- applHost.controllerLog.logNode(node.id, {
1044
+ ctx.logNode(node.id, {
1037
1045
  endpoint: this.endpointIndex,
1038
1046
  message: `Interviewing ${this.ccName}...`,
1039
1047
  direction: "none",
1040
1048
  });
1041
- const deviceConfig = applHost.getDeviceConfig?.(node.id);
1042
- const paramInfo = getParamInformationFromConfigFile(applHost, node.id, this.endpointIndex);
1049
+ const deviceConfig = ctx.getDeviceConfig?.(node.id);
1050
+ const paramInfo = getParamInformationFromConfigFile(ctx, node.id, this.endpointIndex);
1043
1051
  if (paramInfo) {
1044
- applHost.controllerLog.logNode(node.id, {
1052
+ ctx.logNode(node.id, {
1045
1053
  endpoint: this.endpointIndex,
1046
1054
  message: `${this.constructor.name}: Loading configuration parameters from device config`,
1047
1055
  direction: "none",
1048
1056
  });
1049
- this.deserializeParamInformationFromConfig(applHost, paramInfo);
1057
+ this.deserializeParamInformationFromConfig(ctx, paramInfo);
1050
1058
  }
1051
1059
  const documentedParamNumbers = new Set(Array.from(paramInfo?.keys() ?? []).map((k) => k.parameter));
1052
- if (this.version >= 3) {
1053
- applHost.controllerLog.logNode(node.id, {
1060
+ if (api.version >= 3) {
1061
+ ctx.logNode(node.id, {
1054
1062
  endpoint: this.endpointIndex,
1055
1063
  message: "finding first configuration parameter...",
1056
1064
  direction: "outbound",
@@ -1060,7 +1068,7 @@ let ConfigurationCC = class ConfigurationCC extends CommandClass_1.CommandClass
1060
1068
  if (param0props) {
1061
1069
  param = param0props.nextParameter;
1062
1070
  if (param === 0) {
1063
- applHost.controllerLog.logNode(node.id, {
1071
+ ctx.logNode(node.id, {
1064
1072
  endpoint: this.endpointIndex,
1065
1073
  message: `didn't report any config params, trying #1 just to be sure...`,
1066
1074
  direction: "inbound",
@@ -1069,7 +1077,7 @@ let ConfigurationCC = class ConfigurationCC extends CommandClass_1.CommandClass
1069
1077
  }
1070
1078
  }
1071
1079
  else {
1072
- applHost.controllerLog.logNode(node.id, {
1080
+ ctx.logNode(node.id, {
1073
1081
  endpoint: this.endpointIndex,
1074
1082
  message: "Finding first configuration parameter timed out, skipping interview...",
1075
1083
  level: "warn",
@@ -1077,7 +1085,7 @@ let ConfigurationCC = class ConfigurationCC extends CommandClass_1.CommandClass
1077
1085
  return;
1078
1086
  }
1079
1087
  while (param > 0) {
1080
- applHost.controllerLog.logNode(node.id, {
1088
+ ctx.logNode(node.id, {
1081
1089
  endpoint: this.endpointIndex,
1082
1090
  message: `querying parameter #${param} information...`,
1083
1091
  direction: "outbound",
@@ -1087,7 +1095,7 @@ let ConfigurationCC = class ConfigurationCC extends CommandClass_1.CommandClass
1087
1095
  // If querying the properties fails, don't abort the entire interview
1088
1096
  () => undefined);
1089
1097
  if (!props) {
1090
- applHost.controllerLog.logNode(node.id, {
1098
+ ctx.logNode(node.id, {
1091
1099
  endpoint: this.endpointIndex,
1092
1100
  message: `Querying parameter #${param} information timed out, skipping scan...`,
1093
1101
  level: "warn",
@@ -1134,7 +1142,7 @@ is advanced (UI): ${!!properties.isAdvanced}
1134
1142
  has bulk support: ${!properties.noBulkSupport}
1135
1143
  alters capabilities: ${!!properties.altersCapabilities}`;
1136
1144
  }
1137
- applHost.controllerLog.logNode(node.id, {
1145
+ ctx.logNode(node.id, {
1138
1146
  endpoint: this.endpointIndex,
1139
1147
  message: logMessage,
1140
1148
  direction: "inbound",
@@ -1150,19 +1158,19 @@ alters capabilities: ${!!properties.altersCapabilities}`;
1150
1158
  }
1151
1159
  }
1152
1160
  }
1153
- await this.refreshValues(applHost);
1161
+ await this.refreshValues(ctx);
1154
1162
  // Remember that the interview is complete
1155
- this.setInterviewComplete(applHost, true);
1163
+ this.setInterviewComplete(ctx, true);
1156
1164
  }
1157
- async refreshValues(applHost) {
1158
- const node = this.getNode(applHost);
1159
- const endpoint = this.getEndpoint(applHost);
1160
- const api = API_1.CCAPI.create(safe_1.CommandClasses.Configuration, applHost, endpoint).withOptions({
1165
+ async refreshValues(ctx) {
1166
+ const node = this.getNode(ctx);
1167
+ const endpoint = this.getEndpoint(ctx);
1168
+ const api = API_1.CCAPI.create(safe_1.CommandClasses.Configuration, ctx, endpoint).withOptions({
1161
1169
  priority: safe_1.MessagePriority.NodeQuery,
1162
1170
  });
1163
- if (this.version < 3) {
1171
+ if (api.version < 3) {
1164
1172
  // V1/V2: Query all values defined in the config file
1165
- const paramInfo = getParamInformationFromConfigFile(applHost, node.id, this.endpointIndex);
1173
+ const paramInfo = getParamInformationFromConfigFile(ctx, node.id, this.endpointIndex);
1166
1174
  if (paramInfo?.size) {
1167
1175
  // Because partial params share the same parameter number,
1168
1176
  // we need to remember which ones we have already queried.
@@ -1176,7 +1184,7 @@ alters capabilities: ${!!properties.altersCapabilities}`;
1176
1184
  continue;
1177
1185
  alreadyQueried.add(param.parameter);
1178
1186
  // Query the current value
1179
- applHost.controllerLog.logNode(node.id, {
1187
+ ctx.logNode(node.id, {
1180
1188
  endpoint: this.endpointIndex,
1181
1189
  message: `querying parameter #${param.parameter} value...`,
1182
1190
  direction: "outbound",
@@ -1184,14 +1192,14 @@ alters capabilities: ${!!properties.altersCapabilities}`;
1184
1192
  // ... at least try to
1185
1193
  const paramValue = await api.get(param.parameter);
1186
1194
  if (typeof paramValue === "number") {
1187
- applHost.controllerLog.logNode(node.id, {
1195
+ ctx.logNode(node.id, {
1188
1196
  endpoint: this.endpointIndex,
1189
1197
  message: `parameter #${param.parameter} has value: ${paramValue}`,
1190
1198
  direction: "inbound",
1191
1199
  });
1192
1200
  }
1193
1201
  else if (!paramValue) {
1194
- applHost.controllerLog.logNode(node.id, {
1202
+ ctx.logNode(node.id, {
1195
1203
  endpoint: this.endpointIndex,
1196
1204
  message: `received no value for parameter #${param.parameter}`,
1197
1205
  direction: "inbound",
@@ -1201,7 +1209,7 @@ alters capabilities: ${!!properties.altersCapabilities}`;
1201
1209
  }
1202
1210
  }
1203
1211
  else {
1204
- applHost.controllerLog.logNode(node.id, {
1212
+ ctx.logNode(node.id, {
1205
1213
  endpoint: this.endpointIndex,
1206
1214
  message: `${this.constructor.name}: skipping interview because CC version is < 3 and there is no config file`,
1207
1215
  direction: "none",
@@ -1210,12 +1218,12 @@ alters capabilities: ${!!properties.altersCapabilities}`;
1210
1218
  }
1211
1219
  else {
1212
1220
  // V3+: Query the values of discovered parameters
1213
- const parameters = (0, arrays_1.distinct)(this.getDefinedValueIDs(applHost)
1221
+ const parameters = (0, arrays_1.distinct)(this.getDefinedValueIDs(ctx)
1214
1222
  .map((v) => v.property)
1215
1223
  .filter((p) => typeof p === "number"));
1216
1224
  for (const param of parameters) {
1217
- if (this.getParamInformation(applHost, param).readable !== false) {
1218
- applHost.controllerLog.logNode(node.id, {
1225
+ if (this.getParamInformation(ctx, param).readable !== false) {
1226
+ ctx.logNode(node.id, {
1219
1227
  endpoint: this.endpointIndex,
1220
1228
  message: `querying parameter #${param} value...`,
1221
1229
  direction: "outbound",
@@ -1223,7 +1231,7 @@ alters capabilities: ${!!properties.altersCapabilities}`;
1223
1231
  await api.get(param);
1224
1232
  }
1225
1233
  else {
1226
- applHost.controllerLog.logNode(node.id, {
1234
+ ctx.logNode(node.id, {
1227
1235
  endpoint: this.endpointIndex,
1228
1236
  message: `not querying parameter #${param} value, because it is writeonly`,
1229
1237
  direction: "none",
@@ -1236,11 +1244,11 @@ alters capabilities: ${!!properties.altersCapabilities}`;
1236
1244
  * Whether this node's param information was loaded from a config file.
1237
1245
  * If this is true, we don't trust what the node reports
1238
1246
  */
1239
- paramExistsInConfigFile(applHost, parameter, valueBitMask) {
1240
- if (this.getValue(applHost, exports.ConfigurationCCValues.isParamInformationFromConfig) !== true) {
1247
+ paramExistsInConfigFile(ctx, parameter, valueBitMask) {
1248
+ if (this.getValue(ctx, exports.ConfigurationCCValues.isParamInformationFromConfig) !== true) {
1241
1249
  return false;
1242
1250
  }
1243
- const paramInformation = getParamInformationFromConfigFile(applHost, this.nodeId, this.endpointIndex);
1251
+ const paramInformation = getParamInformationFromConfigFile(ctx, this.nodeId, this.endpointIndex);
1244
1252
  if (!paramInformation)
1245
1253
  return false;
1246
1254
  // Check if the param is defined in the config file, either as a normal param or a partial
@@ -1260,25 +1268,25 @@ alters capabilities: ${!!properties.altersCapabilities}`;
1260
1268
  * @internal
1261
1269
  * Stores config parameter metadata for this CC's node
1262
1270
  */
1263
- extendParamInformation(applHost, parameter, valueBitMask, info) {
1271
+ extendParamInformation(ctx, parameter, valueBitMask, info) {
1264
1272
  // Don't trust param information that a node reports if we have already loaded it from a config file
1265
1273
  if (valueBitMask === undefined
1266
- && this.paramExistsInConfigFile(applHost, parameter)) {
1274
+ && this.paramExistsInConfigFile(ctx, parameter)) {
1267
1275
  return;
1268
1276
  }
1269
1277
  // Retrieve the base metadata
1270
- const metadata = this.getParamInformation(applHost, parameter, valueBitMask);
1278
+ const metadata = this.getParamInformation(ctx, parameter, valueBitMask);
1271
1279
  // Override it with new data
1272
1280
  Object.assign(metadata, info);
1273
1281
  // And store it back
1274
- this.setMetadata(applHost, exports.ConfigurationCCValues.paramInformation(parameter, valueBitMask), metadata);
1282
+ this.setMetadata(ctx, exports.ConfigurationCCValues.paramInformation(parameter, valueBitMask), metadata);
1275
1283
  }
1276
1284
  /**
1277
1285
  * @internal
1278
1286
  * Returns stored config parameter metadata for this CC's node
1279
1287
  */
1280
- getParamInformation(applHost, parameter, valueBitMask) {
1281
- return (this.getMetadata(applHost, exports.ConfigurationCCValues.paramInformation(parameter, valueBitMask)) ?? {
1288
+ getParamInformation(ctx, parameter, valueBitMask) {
1289
+ return (this.getMetadata(ctx, exports.ConfigurationCCValues.paramInformation(parameter, valueBitMask)) ?? {
1282
1290
  ...safe_1.ValueMetadata.Any,
1283
1291
  });
1284
1292
  }
@@ -1286,20 +1294,20 @@ alters capabilities: ${!!properties.altersCapabilities}`;
1286
1294
  * **INTERNAL:** Returns the param info that was queried for this node. This returns the information that was returned by the node
1287
1295
  * and does not include partial parameters.
1288
1296
  */
1289
- getQueriedParamInfos(applHost) {
1290
- const parameters = (0, arrays_1.distinct)(this.getDefinedValueIDs(applHost)
1297
+ getQueriedParamInfos(ctx) {
1298
+ const parameters = (0, arrays_1.distinct)(this.getDefinedValueIDs(ctx)
1291
1299
  .map((v) => v.property)
1292
1300
  .filter((p) => typeof p === "number"));
1293
1301
  return (0, objects_1.composeObject)(parameters.map((p) => [
1294
1302
  p,
1295
- this.getParamInformation(applHost, p),
1303
+ this.getParamInformation(ctx, p),
1296
1304
  ]));
1297
1305
  }
1298
1306
  /**
1299
1307
  * Returns stored config parameter metadata for all partial config params addressed with the given parameter number
1300
1308
  */
1301
- getPartialParamInfos(applHost, parameter) {
1302
- const valueDB = this.getValueDB(applHost);
1309
+ getPartialParamInfos(ctx, parameter) {
1310
+ const valueDB = this.getValueDB(ctx);
1303
1311
  return valueDB.findMetadata((id) => id.commandClass === this.ccId
1304
1312
  && (id.endpoint ?? 0) === this.endpointIndex
1305
1313
  && id.property === parameter
@@ -1308,16 +1316,16 @@ alters capabilities: ${!!properties.altersCapabilities}`;
1308
1316
  /**
1309
1317
  * Computes the full value of a parameter after applying a partial param value
1310
1318
  */
1311
- composePartialParamValue(applHost, parameter, bitMask, partialValue) {
1312
- return this.composePartialParamValues(applHost, parameter, [
1319
+ composePartialParamValue(ctx, parameter, bitMask, partialValue) {
1320
+ return this.composePartialParamValues(ctx, parameter, [
1313
1321
  { bitMask, partialValue },
1314
1322
  ]);
1315
1323
  }
1316
1324
  /**
1317
1325
  * Computes the full value of a parameter after applying multiple partial param values
1318
1326
  */
1319
- composePartialParamValues(applHost, parameter, partials) {
1320
- const valueDB = this.getValueDB(applHost);
1327
+ composePartialParamValues(ctx, parameter, partials) {
1328
+ const valueDB = this.getValueDB(ctx);
1321
1329
  // Add the other values together
1322
1330
  const otherValues = valueDB.findValues((id) => id.commandClass === this.ccId
1323
1331
  && (id.endpoint ?? 0) === this.endpointIndex
@@ -1334,8 +1342,8 @@ alters capabilities: ${!!properties.altersCapabilities}`;
1334
1342
  return ret;
1335
1343
  }
1336
1344
  /** Deserializes the config parameter info from a config file */
1337
- deserializeParamInformationFromConfig(applHost, config) {
1338
- const valueDB = this.getValueDB(applHost);
1345
+ deserializeParamInformationFromConfig(ctx, config) {
1346
+ const valueDB = this.getValueDB(ctx);
1339
1347
  // Clear old param information
1340
1348
  for (const meta of valueDB.getAllMetadata(this.ccId)) {
1341
1349
  if (typeof meta.property === "number"
@@ -1347,7 +1355,7 @@ alters capabilities: ${!!properties.altersCapabilities}`;
1347
1355
  }
1348
1356
  }
1349
1357
  // Allow overwriting the param info (mark it as unloaded)
1350
- this.setValue(applHost, exports.ConfigurationCCValues.isParamInformationFromConfig, false);
1358
+ this.setValue(ctx, exports.ConfigurationCCValues.isParamInformationFromConfig, false);
1351
1359
  for (const [param, info] of config.entries()) {
1352
1360
  // We need to make the config information compatible with the
1353
1361
  // format that ConfigurationCC reports
@@ -1375,25 +1383,25 @@ alters capabilities: ${!!properties.altersCapabilities}`;
1375
1383
  description: info.description,
1376
1384
  isFromConfig: true,
1377
1385
  });
1378
- this.extendParamInformation(applHost, param.parameter, param.valueBitMask, paramInfo);
1386
+ this.extendParamInformation(ctx, param.parameter, param.valueBitMask, paramInfo);
1379
1387
  }
1380
1388
  // Remember that we loaded the param information from a config file
1381
- this.setValue(applHost, exports.ConfigurationCCValues.isParamInformationFromConfig, true);
1389
+ this.setValue(ctx, exports.ConfigurationCCValues.isParamInformationFromConfig, true);
1382
1390
  }
1383
- translatePropertyKey(applHost, property, propertyKey) {
1391
+ translatePropertyKey(ctx, property, propertyKey) {
1384
1392
  if (typeof property === "number"
1385
1393
  && (propertyKey == undefined || typeof propertyKey === "number")) {
1386
1394
  // This CC names all configuration parameters differently,
1387
1395
  // so no name for the property key is required
1388
1396
  return undefined;
1389
1397
  }
1390
- return super.translateProperty(applHost, property, propertyKey);
1398
+ return super.translateProperty(ctx, property, propertyKey);
1391
1399
  }
1392
- translateProperty(applHost, property, propertyKey) {
1400
+ translateProperty(ctx, property, propertyKey) {
1393
1401
  // Try to retrieve the configured param label
1394
1402
  if (typeof property === "number"
1395
1403
  && (propertyKey == undefined || typeof propertyKey === "number")) {
1396
- const paramInfo = this.getParamInformation(applHost, property, propertyKey);
1404
+ const paramInfo = this.getParamInformation(ctx, property, propertyKey);
1397
1405
  if (paramInfo.label)
1398
1406
  return paramInfo.label;
1399
1407
  // fall back to paramXYZ[_key] if none is defined
@@ -1403,7 +1411,7 @@ alters capabilities: ${!!properties.altersCapabilities}`;
1403
1411
  }
1404
1412
  return ret;
1405
1413
  }
1406
- return super.translateProperty(applHost, property, propertyKey);
1414
+ return super.translateProperty(ctx, property, propertyKey);
1407
1415
  }
1408
1416
  };
1409
1417
  exports.ConfigurationCC = ConfigurationCC;
@@ -1412,38 +1420,43 @@ exports.ConfigurationCC = ConfigurationCC = __decorate([
1412
1420
  (0, CommandClassDecorators_1.implementedVersion)(4),
1413
1421
  (0, CommandClassDecorators_1.ccValues)(exports.ConfigurationCCValues)
1414
1422
  ], ConfigurationCC);
1415
- let ConfigurationCCReport = class ConfigurationCCReport extends ConfigurationCC {
1416
- constructor(host, options) {
1417
- super(host, options);
1418
- if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
1419
- // All fields must be present
1420
- (0, safe_1.validatePayload)(this.payload.length > 2);
1421
- this.parameter = this.payload[0];
1422
- this.valueSize = this.payload[1] & 0b111;
1423
- // Ensure we received a valid report
1424
- (0, safe_1.validatePayload)(this.valueSize >= 1, this.valueSize <= 4, this.payload.length >= 2 + this.valueSize);
1425
- // Default to parsing the value as SignedInteger, like the specs say.
1426
- // We try to re-interpret the value in persistValues()
1427
- this.value = parseValue(this.payload.subarray(2), this.valueSize, safe_1.ConfigValueFormat.SignedInteger);
1428
- }
1429
- else {
1430
- this.parameter = options.parameter;
1431
- this.value = options.value;
1432
- this.valueSize = options.valueSize;
1433
- this.valueFormat = options.valueFormat;
1434
- }
1423
+ let ConfigurationCCReport = ConfigurationCCReport_1 = class ConfigurationCCReport extends ConfigurationCC {
1424
+ constructor(options) {
1425
+ super(options);
1426
+ this.parameter = options.parameter;
1427
+ this.value = options.value;
1428
+ this.valueSize = options.valueSize;
1429
+ this.valueFormat = options.valueFormat;
1430
+ }
1431
+ static from(raw, ctx) {
1432
+ // All fields must be present
1433
+ (0, safe_1.validatePayload)(raw.payload.length > 2);
1434
+ const parameter = raw.payload[0];
1435
+ const valueSize = raw.payload[1] & 0b111;
1436
+ // Ensure we received a valid report
1437
+ (0, safe_1.validatePayload)(valueSize >= 1, valueSize <= 4, raw.payload.length >= 2 + valueSize);
1438
+ // Default to parsing the value as SignedInteger, like the specs say.
1439
+ // We try to re-interpret the value in persistValues()
1440
+ const value = parseValue(raw.payload.subarray(2), valueSize, safe_1.ConfigValueFormat.SignedInteger);
1441
+ return new ConfigurationCCReport_1({
1442
+ nodeId: ctx.sourceNodeId,
1443
+ parameter,
1444
+ valueSize,
1445
+ value,
1446
+ });
1435
1447
  }
1436
1448
  parameter;
1437
1449
  value;
1438
1450
  valueSize;
1439
1451
  valueFormat; // only used for serialization
1440
- persistValues(applHost) {
1441
- if (!super.persistValues(applHost))
1452
+ persistValues(ctx) {
1453
+ if (!super.persistValues(ctx))
1442
1454
  return false;
1455
+ const ccVersion = (0, CommandClass_1.getEffectiveCCVersion)(ctx, this);
1443
1456
  // This parameter may be a partial param in the following cases:
1444
1457
  // * a config file defines it as such
1445
1458
  // * it was reported by the device as a bit field
1446
- const partialParams = this.getPartialParamInfos(applHost, this.parameter);
1459
+ const partialParams = this.getPartialParamInfos(ctx, this.parameter);
1447
1460
  let cachedValueFormat;
1448
1461
  if (partialParams.length > 0) {
1449
1462
  // This is a partial param. All definitions should have the same format, so we just take the first one
@@ -1451,21 +1464,21 @@ let ConfigurationCCReport = class ConfigurationCCReport extends ConfigurationCC
1451
1464
  }
1452
1465
  else {
1453
1466
  // Check if the initial assumption of SignedInteger holds true
1454
- const oldParamInformation = this.getParamInformation(applHost, this.parameter);
1467
+ const oldParamInformation = this.getParamInformation(ctx, this.parameter);
1455
1468
  cachedValueFormat = oldParamInformation.format;
1456
1469
  // On older CC versions, these reports may be the only way we can retrieve the value size
1457
1470
  // Therefore we store it here
1458
- this.extendParamInformation(applHost, this.parameter, undefined, {
1471
+ this.extendParamInformation(ctx, this.parameter, undefined, {
1459
1472
  valueSize: this.valueSize,
1460
1473
  });
1461
- if (this.version < 3
1462
- && !this.paramExistsInConfigFile(applHost, this.parameter)
1474
+ if (ccVersion < 3
1475
+ && !this.paramExistsInConfigFile(ctx, this.parameter)
1463
1476
  && oldParamInformation.min == undefined
1464
1477
  && oldParamInformation.max == undefined) {
1465
1478
  const isSigned = oldParamInformation.format == undefined
1466
1479
  || oldParamInformation.format
1467
1480
  === safe_1.ConfigValueFormat.SignedInteger;
1468
- this.extendParamInformation(applHost, this.parameter, undefined, (0, safe_1.getIntegerLimits)(this.valueSize, isSigned));
1481
+ this.extendParamInformation(ctx, this.parameter, undefined, (0, safe_1.getIntegerLimits)(this.valueSize, isSigned));
1469
1482
  }
1470
1483
  }
1471
1484
  // We may have to re-interpret the value as unsigned, depending on the cached value format
@@ -1479,27 +1492,27 @@ let ConfigurationCCReport = class ConfigurationCCReport extends ConfigurationCC
1479
1492
  if (partialParams.length > 0) {
1480
1493
  for (const param of partialParams) {
1481
1494
  if (typeof param.propertyKey === "number") {
1482
- this.setValue(applHost, exports.ConfigurationCCValues.paramInformation(this.parameter, param.propertyKey), (0, safe_1.parsePartial)(this.value, param.propertyKey, isSignedPartial(param.propertyKey, param.metadata.format)));
1495
+ this.setValue(ctx, exports.ConfigurationCCValues.paramInformation(this.parameter, param.propertyKey), (0, safe_1.parsePartial)(this.value, param.propertyKey, isSignedPartial(param.propertyKey, param.metadata.format)));
1483
1496
  }
1484
1497
  }
1485
1498
  }
1486
1499
  else {
1487
1500
  // This is a single param
1488
- this.setValue(applHost, exports.ConfigurationCCValues.paramInformation(this.parameter), this.value);
1501
+ this.setValue(ctx, exports.ConfigurationCCValues.paramInformation(this.parameter), this.value);
1489
1502
  }
1490
1503
  return true;
1491
1504
  }
1492
- serialize() {
1505
+ serialize(ctx) {
1493
1506
  this.payload = Buffer.concat([
1494
1507
  Buffer.from([this.parameter, this.valueSize & 0b111]),
1495
1508
  Buffer.allocUnsafe(this.valueSize),
1496
1509
  ]);
1497
1510
  serializeValue(this.payload, 2, this.valueSize, this.valueFormat ?? safe_1.ConfigValueFormat.SignedInteger, this.value);
1498
- return super.serialize();
1511
+ return super.serialize(ctx);
1499
1512
  }
1500
- toLogEntry(host) {
1513
+ toLogEntry(ctx) {
1501
1514
  return {
1502
- ...super.toLogEntry(host),
1515
+ ...super.toLogEntry(ctx),
1503
1516
  message: {
1504
1517
  "parameter #": this.parameter,
1505
1518
  "value size": this.valueSize,
@@ -1509,83 +1522,82 @@ let ConfigurationCCReport = class ConfigurationCCReport extends ConfigurationCC
1509
1522
  }
1510
1523
  };
1511
1524
  exports.ConfigurationCCReport = ConfigurationCCReport;
1512
- exports.ConfigurationCCReport = ConfigurationCCReport = __decorate([
1525
+ exports.ConfigurationCCReport = ConfigurationCCReport = ConfigurationCCReport_1 = __decorate([
1513
1526
  (0, CommandClassDecorators_1.CCCommand)(_Types_1.ConfigurationCommand.Report)
1514
1527
  ], ConfigurationCCReport);
1515
1528
  function testResponseForConfigurationGet(sent, received) {
1516
1529
  // We expect a Configuration Report that matches the requested parameter
1517
1530
  return (sent.parameter === received.parameter || sent.allowUnexpectedResponse);
1518
1531
  }
1519
- let ConfigurationCCGet = class ConfigurationCCGet extends ConfigurationCC {
1520
- constructor(host, options) {
1521
- super(host, options);
1522
- if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
1523
- (0, safe_1.validatePayload)(this.payload.length >= 1);
1524
- this.parameter = this.payload[0];
1525
- this.allowUnexpectedResponse = false;
1526
- }
1527
- else {
1528
- this.parameter = options.parameter;
1529
- this.allowUnexpectedResponse = options.allowUnexpectedResponse
1530
- ?? false;
1531
- }
1532
+ let ConfigurationCCGet = ConfigurationCCGet_1 = class ConfigurationCCGet extends ConfigurationCC {
1533
+ constructor(options) {
1534
+ super(options);
1535
+ this.parameter = options.parameter;
1536
+ this.allowUnexpectedResponse = options.allowUnexpectedResponse
1537
+ ?? false;
1538
+ }
1539
+ static from(raw, ctx) {
1540
+ (0, safe_1.validatePayload)(raw.payload.length >= 1);
1541
+ const parameter = raw.payload[0];
1542
+ return new ConfigurationCCGet_1({
1543
+ nodeId: ctx.sourceNodeId,
1544
+ parameter,
1545
+ });
1532
1546
  }
1533
1547
  parameter;
1534
1548
  allowUnexpectedResponse;
1535
- serialize() {
1549
+ serialize(ctx) {
1536
1550
  this.payload = Buffer.from([this.parameter]);
1537
- return super.serialize();
1551
+ return super.serialize(ctx);
1538
1552
  }
1539
- toLogEntry(host) {
1553
+ toLogEntry(ctx) {
1540
1554
  return {
1541
- ...super.toLogEntry(host),
1555
+ ...super.toLogEntry(ctx),
1542
1556
  message: { "parameter #": this.parameter },
1543
1557
  };
1544
1558
  }
1545
1559
  };
1546
1560
  exports.ConfigurationCCGet = ConfigurationCCGet;
1547
- exports.ConfigurationCCGet = ConfigurationCCGet = __decorate([
1561
+ exports.ConfigurationCCGet = ConfigurationCCGet = ConfigurationCCGet_1 = __decorate([
1548
1562
  (0, CommandClassDecorators_1.CCCommand)(_Types_1.ConfigurationCommand.Get),
1549
1563
  (0, CommandClassDecorators_1.expectedCCResponse)(ConfigurationCCReport, testResponseForConfigurationGet)
1550
1564
  ], ConfigurationCCGet);
1551
- let ConfigurationCCSet = class ConfigurationCCSet extends ConfigurationCC {
1552
- constructor(host, options) {
1553
- super(host, options);
1554
- if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
1555
- (0, safe_1.validatePayload)(this.payload.length >= 2);
1556
- this.parameter = this.payload[0];
1557
- this.resetToDefault = !!(this.payload[1] & 0b1000_0000);
1558
- this.valueSize = this.payload[1] & 0b111;
1559
- // Ensure we received a valid report
1560
- (0, safe_1.validatePayload)(this.valueSize >= 1, this.valueSize <= 4, this.payload.length >= 2 + this.valueSize);
1561
- // Parse the value as signed integer. We don't know the format here.
1562
- this.value = parseValue(this.payload.subarray(2), this.valueSize, safe_1.ConfigValueFormat.SignedInteger);
1563
- }
1564
- else {
1565
- this.parameter = options.parameter;
1566
- // According to SDS14223 this flag SHOULD NOT be set
1567
- // Because we don't want to test the behavior, we enforce that it MUST not be set
1568
- // on legacy nodes
1569
- if (options.resetToDefault && this.version <= 3) {
1570
- throw new safe_1.ZWaveError(`The resetToDefault flag MUST not be used on nodes implementing ConfigurationCC V3 or less!`, safe_1.ZWaveErrorCodes
1571
- .ConfigurationCC_NoResetToDefaultOnLegacyDevices);
1572
- }
1573
- this.resetToDefault = !!options.resetToDefault;
1574
- if (!options.resetToDefault) {
1575
- // TODO: Default to the stored value size
1576
- this.valueSize = options.valueSize;
1577
- this.valueFormat = options.valueFormat
1578
- ?? safe_1.ConfigValueFormat.SignedInteger;
1579
- this.value = options.value;
1580
- }
1565
+ let ConfigurationCCSet = ConfigurationCCSet_1 = class ConfigurationCCSet extends ConfigurationCC {
1566
+ constructor(options) {
1567
+ super(options);
1568
+ this.parameter = options.parameter;
1569
+ this.resetToDefault = !!options.resetToDefault;
1570
+ if (!options.resetToDefault) {
1571
+ // TODO: Default to the stored value size
1572
+ this.valueSize = options.valueSize;
1573
+ this.valueFormat = options.valueFormat
1574
+ ?? safe_1.ConfigValueFormat.SignedInteger;
1575
+ this.value = options.value;
1581
1576
  }
1582
1577
  }
1578
+ static from(raw, ctx) {
1579
+ (0, safe_1.validatePayload)(raw.payload.length >= 2);
1580
+ const parameter = raw.payload[0];
1581
+ const resetToDefault = !!(raw.payload[1] & 0b1000_0000);
1582
+ const valueSize = raw.payload[1] & 0b111;
1583
+ // Ensure we received a valid report
1584
+ (0, safe_1.validatePayload)(valueSize >= 1, valueSize <= 4, raw.payload.length >= 2 + valueSize);
1585
+ // Parse the value as signed integer. We don't know the format here.
1586
+ const value = parseValue(raw.payload.subarray(2), valueSize, safe_1.ConfigValueFormat.SignedInteger);
1587
+ return new ConfigurationCCSet_1({
1588
+ nodeId: ctx.sourceNodeId,
1589
+ parameter,
1590
+ resetToDefault,
1591
+ valueSize,
1592
+ value,
1593
+ });
1594
+ }
1583
1595
  resetToDefault;
1584
1596
  parameter;
1585
1597
  valueSize;
1586
1598
  valueFormat;
1587
1599
  value;
1588
- serialize() {
1600
+ serialize(ctx) {
1589
1601
  const valueSize = this.resetToDefault ? 1 : this.valueSize;
1590
1602
  const payloadLength = 2 + valueSize;
1591
1603
  this.payload = Buffer.alloc(payloadLength, 0);
@@ -1606,9 +1618,9 @@ let ConfigurationCCSet = class ConfigurationCCSet extends ConfigurationCC {
1606
1618
  tryCatchOutOfBoundsError(e, this.value, this.parameter, valueSize, this.valueFormat);
1607
1619
  }
1608
1620
  }
1609
- return super.serialize();
1621
+ return super.serialize(ctx);
1610
1622
  }
1611
- toLogEntry(host) {
1623
+ toLogEntry(ctx) {
1612
1624
  const message = {
1613
1625
  "parameter #": this.parameter,
1614
1626
  "reset to default": this.resetToDefault,
@@ -1623,13 +1635,13 @@ let ConfigurationCCSet = class ConfigurationCCSet extends ConfigurationCC {
1623
1635
  message.value = configValueToString(this.value);
1624
1636
  }
1625
1637
  return {
1626
- ...super.toLogEntry(host),
1638
+ ...super.toLogEntry(ctx),
1627
1639
  message,
1628
1640
  };
1629
1641
  }
1630
1642
  };
1631
1643
  exports.ConfigurationCCSet = ConfigurationCCSet;
1632
- exports.ConfigurationCCSet = ConfigurationCCSet = __decorate([
1644
+ exports.ConfigurationCCSet = ConfigurationCCSet = ConfigurationCCSet_1 = __decorate([
1633
1645
  (0, CommandClassDecorators_1.CCCommand)(_Types_1.ConfigurationCommand.Set),
1634
1646
  (0, CommandClassDecorators_1.useSupervision)()
1635
1647
  ], ConfigurationCCSet);
@@ -1637,35 +1649,36 @@ function getResponseForBulkSet(cc) {
1637
1649
  return cc.handshake ? ConfigurationCCBulkReport : undefined;
1638
1650
  }
1639
1651
  let ConfigurationCCBulkSet = class ConfigurationCCBulkSet extends ConfigurationCC {
1640
- constructor(host, options) {
1641
- super(host, options);
1642
- if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
1643
- // TODO: Deserialize payload
1644
- throw new safe_1.ZWaveError(`${this.constructor.name}: deserialization not implemented`, safe_1.ZWaveErrorCodes.Deserialization_NotImplemented);
1652
+ constructor(options) {
1653
+ super(options);
1654
+ this._parameters = options.parameters;
1655
+ if (this._parameters.length < 1) {
1656
+ throw new safe_1.ZWaveError(`In a ConfigurationCC.BulkSet, parameters must be a non-empty array`, safe_1.ZWaveErrorCodes.CC_Invalid);
1657
+ }
1658
+ else if (!(0, safe_1.isConsecutiveArray)(this._parameters)) {
1659
+ throw new safe_1.ZWaveError(`A ConfigurationCC.BulkSet can only be used for consecutive parameters`, safe_1.ZWaveErrorCodes.CC_Invalid);
1660
+ }
1661
+ this._handshake = !!options.handshake;
1662
+ this._resetToDefault = !!options.resetToDefault;
1663
+ if (!!options.resetToDefault) {
1664
+ this._valueSize = 1;
1665
+ this._valueFormat = safe_1.ConfigValueFormat.SignedInteger;
1666
+ this._values = this._parameters.map(() => 0);
1645
1667
  }
1646
1668
  else {
1647
- this._parameters = options.parameters;
1648
- if (this._parameters.length < 1) {
1649
- throw new safe_1.ZWaveError(`In a ConfigurationCC.BulkSet, parameters must be a non-empty array`, safe_1.ZWaveErrorCodes.CC_Invalid);
1650
- }
1651
- else if (!(0, safe_1.isConsecutiveArray)(this._parameters)) {
1652
- throw new safe_1.ZWaveError(`A ConfigurationCC.BulkSet can only be used for consecutive parameters`, safe_1.ZWaveErrorCodes.CC_Invalid);
1653
- }
1654
- this._handshake = !!options.handshake;
1655
- this._resetToDefault = !!options.resetToDefault;
1656
- if (!!options.resetToDefault) {
1657
- this._valueSize = 1;
1658
- this._valueFormat = safe_1.ConfigValueFormat.SignedInteger;
1659
- this._values = this._parameters.map(() => 0);
1660
- }
1661
- else {
1662
- this._valueSize = options.valueSize;
1663
- this._valueFormat = options.valueFormat
1664
- ?? safe_1.ConfigValueFormat.SignedInteger;
1665
- this._values = options.values;
1666
- }
1669
+ this._valueSize = options.valueSize;
1670
+ this._valueFormat = options.valueFormat
1671
+ ?? safe_1.ConfigValueFormat.SignedInteger;
1672
+ this._values = options.values;
1667
1673
  }
1668
1674
  }
1675
+ static from(_raw, _ctx) {
1676
+ // TODO: Deserialize payload
1677
+ throw new safe_1.ZWaveError(`${this.name}: deserialization not implemented`, safe_1.ZWaveErrorCodes.Deserialization_NotImplemented);
1678
+ // return new ConfigurationCCBulkSet({
1679
+ // nodeId: ctx.sourceNodeId,
1680
+ // });
1681
+ }
1669
1682
  _parameters;
1670
1683
  get parameters() {
1671
1684
  return this._parameters;
@@ -1690,7 +1703,7 @@ let ConfigurationCCBulkSet = class ConfigurationCCBulkSet extends ConfigurationC
1690
1703
  get handshake() {
1691
1704
  return this._handshake;
1692
1705
  }
1693
- serialize() {
1706
+ serialize(ctx) {
1694
1707
  const valueSize = this._resetToDefault ? 1 : this.valueSize;
1695
1708
  const payloadLength = 4 + valueSize * this.parameters.length;
1696
1709
  this.payload = Buffer.alloc(payloadLength, 0);
@@ -1716,9 +1729,9 @@ let ConfigurationCCBulkSet = class ConfigurationCCBulkSet extends ConfigurationC
1716
1729
  }
1717
1730
  }
1718
1731
  }
1719
- return super.serialize();
1732
+ return super.serialize(ctx);
1720
1733
  }
1721
- toLogEntry(host) {
1734
+ toLogEntry(ctx) {
1722
1735
  const message = {
1723
1736
  handshake: this.handshake,
1724
1737
  "reset to default": this.resetToDefault,
@@ -1730,7 +1743,7 @@ let ConfigurationCCBulkSet = class ConfigurationCCBulkSet extends ConfigurationC
1730
1743
  .join("");
1731
1744
  }
1732
1745
  return {
1733
- ...super.toLogEntry(host),
1746
+ ...super.toLogEntry(ctx),
1734
1747
  message,
1735
1748
  };
1736
1749
  }
@@ -1741,78 +1754,84 @@ exports.ConfigurationCCBulkSet = ConfigurationCCBulkSet = __decorate([
1741
1754
  (0, CommandClassDecorators_1.expectedCCResponse)(getResponseForBulkSet),
1742
1755
  (0, CommandClassDecorators_1.useSupervision)()
1743
1756
  ], ConfigurationCCBulkSet);
1744
- let ConfigurationCCBulkReport = class ConfigurationCCBulkReport extends ConfigurationCC {
1745
- constructor(host, options) {
1746
- super(host, options);
1757
+ let ConfigurationCCBulkReport = ConfigurationCCBulkReport_1 = class ConfigurationCCBulkReport extends ConfigurationCC {
1758
+ constructor(options) {
1759
+ super(options);
1760
+ // TODO: Check implementation:
1761
+ this.reportsToFollow = options.reportsToFollow;
1762
+ this.defaultValues = options.defaultValues;
1763
+ this.isHandshakeResponse = options.isHandshakeResponse;
1764
+ this.valueSize = options.valueSize;
1765
+ for (const [param, value] of Object.entries(options.values)) {
1766
+ this._values.set(parseInt(param), value);
1767
+ }
1768
+ }
1769
+ static from(raw, ctx) {
1747
1770
  // Ensure we received enough bytes for the preamble
1748
- (0, safe_1.validatePayload)(this.payload.length >= 5);
1749
- const firstParameter = this.payload.readUInt16BE(0);
1750
- const numParams = this.payload[2];
1751
- this._reportsToFollow = this.payload[3];
1752
- this._defaultValues = !!(this.payload[4] & 0b1000_0000);
1753
- this._isHandshakeResponse = !!(this.payload[4] & 0b0100_0000);
1754
- this._valueSize = this.payload[4] & 0b111;
1771
+ (0, safe_1.validatePayload)(raw.payload.length >= 5);
1772
+ const firstParameter = raw.payload.readUInt16BE(0);
1773
+ const numParams = raw.payload[2];
1774
+ const reportsToFollow = raw.payload[3];
1775
+ const defaultValues = !!(raw.payload[4] & 0b1000_0000);
1776
+ const isHandshakeResponse = !!(raw.payload[4] & 0b0100_0000);
1777
+ const valueSize = raw.payload[4] & 0b111;
1755
1778
  // Ensure the payload is long enough for all reported values
1756
- (0, safe_1.validatePayload)(this.payload.length >= 5 + numParams * this._valueSize);
1779
+ (0, safe_1.validatePayload)(raw.payload.length >= 5 + numParams * valueSize);
1780
+ const values = {};
1757
1781
  for (let i = 0; i < numParams; i++) {
1758
1782
  const param = firstParameter + i;
1759
- this._values.set(param,
1760
1783
  // Default to parsing the value as SignedInteger, like the specs say.
1761
1784
  // We try to re-interpret the value in persistValues()
1762
- parseValue(this.payload.subarray(5 + i * this.valueSize), this.valueSize, safe_1.ConfigValueFormat.SignedInteger));
1763
- }
1785
+ values[param] = parseValue(raw.payload.subarray(5 + i * valueSize), valueSize, safe_1.ConfigValueFormat.SignedInteger);
1786
+ }
1787
+ return new ConfigurationCCBulkReport_1({
1788
+ nodeId: ctx.sourceNodeId,
1789
+ reportsToFollow,
1790
+ defaultValues,
1791
+ isHandshakeResponse,
1792
+ valueSize,
1793
+ values,
1794
+ });
1764
1795
  }
1765
- persistValues(applHost) {
1766
- if (!super.persistValues(applHost))
1796
+ persistValues(ctx) {
1797
+ if (!super.persistValues(ctx))
1767
1798
  return false;
1768
1799
  // Store every received parameter
1769
1800
  // eslint-disable-next-line prefer-const
1770
1801
  for (let [parameter, value] of this._values.entries()) {
1771
1802
  // Check if the initial assumption of SignedInteger holds true
1772
- const oldParamInformation = this.getParamInformation(applHost, parameter);
1803
+ const oldParamInformation = this.getParamInformation(ctx, parameter);
1773
1804
  if (oldParamInformation.format != undefined
1774
1805
  && oldParamInformation.format
1775
1806
  !== safe_1.ConfigValueFormat.SignedInteger) {
1776
1807
  // Re-interpret the value with the new format
1777
- value = reInterpretSignedValue(value, this._valueSize, oldParamInformation.format);
1808
+ value = reInterpretSignedValue(value, this.valueSize, oldParamInformation.format);
1778
1809
  this._values.set(parameter, value);
1779
1810
  }
1780
- this.setValue(applHost, exports.ConfigurationCCValues.paramInformation(parameter), value);
1811
+ this.setValue(ctx, exports.ConfigurationCCValues.paramInformation(parameter), value);
1781
1812
  }
1782
1813
  return true;
1783
1814
  }
1784
- _reportsToFollow;
1785
- get reportsToFollow() {
1786
- return this._reportsToFollow;
1815
+ reportsToFollow;
1816
+ defaultValues;
1817
+ isHandshakeResponse;
1818
+ valueSize;
1819
+ _values = new Map();
1820
+ get values() {
1821
+ return this._values;
1787
1822
  }
1788
1823
  getPartialCCSessionId() {
1789
1824
  // We don't expect the applHost to merge CCs but we want to wait until all reports have been received
1790
1825
  return {};
1791
1826
  }
1792
1827
  expectMoreMessages() {
1793
- return this._reportsToFollow > 0;
1794
- }
1795
- _defaultValues;
1796
- get defaultValues() {
1797
- return this._defaultValues;
1798
- }
1799
- _isHandshakeResponse;
1800
- get isHandshakeResponse() {
1801
- return this._isHandshakeResponse;
1802
- }
1803
- _valueSize;
1804
- get valueSize() {
1805
- return this._valueSize;
1806
- }
1807
- _values = new Map();
1808
- get values() {
1809
- return this._values;
1828
+ return this.reportsToFollow > 0;
1810
1829
  }
1811
- toLogEntry(host) {
1830
+ toLogEntry(ctx) {
1812
1831
  const message = {
1813
- "handshake response": this._isHandshakeResponse,
1814
- "default values": this._defaultValues,
1815
- "value size": this._valueSize,
1832
+ "handshake response": this.isHandshakeResponse,
1833
+ "default values": this.defaultValues,
1834
+ "value size": this.valueSize,
1816
1835
  "reports to follow": this.reportsToFollow,
1817
1836
  };
1818
1837
  if (this._values.size > 0) {
@@ -1822,42 +1841,43 @@ let ConfigurationCCBulkReport = class ConfigurationCCBulkReport extends Configur
1822
1841
  .join("");
1823
1842
  }
1824
1843
  return {
1825
- ...super.toLogEntry(host),
1844
+ ...super.toLogEntry(ctx),
1826
1845
  message,
1827
1846
  };
1828
1847
  }
1829
1848
  };
1830
1849
  exports.ConfigurationCCBulkReport = ConfigurationCCBulkReport;
1831
- exports.ConfigurationCCBulkReport = ConfigurationCCBulkReport = __decorate([
1850
+ exports.ConfigurationCCBulkReport = ConfigurationCCBulkReport = ConfigurationCCBulkReport_1 = __decorate([
1832
1851
  (0, CommandClassDecorators_1.CCCommand)(_Types_1.ConfigurationCommand.BulkReport)
1833
1852
  ], ConfigurationCCBulkReport);
1834
1853
  let ConfigurationCCBulkGet = class ConfigurationCCBulkGet extends ConfigurationCC {
1835
- constructor(host, options) {
1836
- super(host, options);
1837
- if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
1838
- // TODO: Deserialize payload
1839
- throw new safe_1.ZWaveError(`${this.constructor.name}: deserialization not implemented`, safe_1.ZWaveErrorCodes.Deserialization_NotImplemented);
1840
- }
1841
- else {
1842
- this._parameters = options.parameters.sort();
1843
- if (!(0, safe_1.isConsecutiveArray)(this.parameters)) {
1844
- throw new safe_1.ZWaveError(`A ConfigurationCC.BulkGet can only be used for consecutive parameters`, safe_1.ZWaveErrorCodes.CC_Invalid);
1845
- }
1854
+ constructor(options) {
1855
+ super(options);
1856
+ this._parameters = options.parameters.sort();
1857
+ if (!(0, safe_1.isConsecutiveArray)(this.parameters)) {
1858
+ throw new safe_1.ZWaveError(`A ConfigurationCC.BulkGet can only be used for consecutive parameters`, safe_1.ZWaveErrorCodes.CC_Invalid);
1846
1859
  }
1847
1860
  }
1861
+ static from(_raw, _ctx) {
1862
+ // TODO: Deserialize payload
1863
+ throw new safe_1.ZWaveError(`${this.name}: deserialization not implemented`, safe_1.ZWaveErrorCodes.Deserialization_NotImplemented);
1864
+ // return new ConfigurationCCBulkGet({
1865
+ // nodeId: ctx.sourceNodeId,
1866
+ // });
1867
+ }
1848
1868
  _parameters;
1849
1869
  get parameters() {
1850
1870
  return this._parameters;
1851
1871
  }
1852
- serialize() {
1872
+ serialize(ctx) {
1853
1873
  this.payload = Buffer.allocUnsafe(3);
1854
1874
  this.payload.writeUInt16BE(this.parameters[0], 0);
1855
1875
  this.payload[2] = this.parameters.length;
1856
- return super.serialize();
1876
+ return super.serialize(ctx);
1857
1877
  }
1858
- toLogEntry(host) {
1878
+ toLogEntry(ctx) {
1859
1879
  return {
1860
- ...super.toLogEntry(host),
1880
+ ...super.toLogEntry(ctx),
1861
1881
  message: { parameters: this.parameters.join(", ") },
1862
1882
  };
1863
1883
  }
@@ -1867,38 +1887,42 @@ exports.ConfigurationCCBulkGet = ConfigurationCCBulkGet = __decorate([
1867
1887
  (0, CommandClassDecorators_1.CCCommand)(_Types_1.ConfigurationCommand.BulkGet),
1868
1888
  (0, CommandClassDecorators_1.expectedCCResponse)(ConfigurationCCBulkReport)
1869
1889
  ], ConfigurationCCBulkGet);
1870
- let ConfigurationCCNameReport = class ConfigurationCCNameReport extends ConfigurationCC {
1871
- constructor(host, options) {
1872
- super(host, options);
1873
- if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
1874
- // Parameter and # of reports must be present
1875
- (0, safe_1.validatePayload)(this.payload.length >= 3);
1876
- this.parameter = this.payload.readUInt16BE(0);
1877
- this.reportsToFollow = this.payload[2];
1878
- if (this.reportsToFollow > 0) {
1879
- // If more reports follow, the info must at least be one byte
1880
- (0, safe_1.validatePayload)(this.payload.length >= 4);
1881
- }
1882
- this.name = this.payload.subarray(3).toString("utf8");
1883
- }
1884
- else {
1885
- this.parameter = options.parameter;
1886
- this.name = options.name;
1887
- this.reportsToFollow = options.reportsToFollow;
1888
- }
1890
+ let ConfigurationCCNameReport = ConfigurationCCNameReport_1 = class ConfigurationCCNameReport extends ConfigurationCC {
1891
+ constructor(options) {
1892
+ super(options);
1893
+ this.parameter = options.parameter;
1894
+ this.name = options.name;
1895
+ this.reportsToFollow = options.reportsToFollow;
1896
+ }
1897
+ static from(raw, ctx) {
1898
+ // Parameter and # of reports must be present
1899
+ (0, safe_1.validatePayload)(raw.payload.length >= 3);
1900
+ const parameter = raw.payload.readUInt16BE(0);
1901
+ const reportsToFollow = raw.payload[2];
1902
+ if (reportsToFollow > 0) {
1903
+ // If more reports follow, the info must at least be one byte
1904
+ (0, safe_1.validatePayload)(raw.payload.length >= 4);
1905
+ }
1906
+ const name = raw.payload.subarray(3).toString("utf8");
1907
+ return new ConfigurationCCNameReport_1({
1908
+ nodeId: ctx.sourceNodeId,
1909
+ parameter,
1910
+ reportsToFollow,
1911
+ name,
1912
+ });
1889
1913
  }
1890
1914
  parameter;
1891
1915
  name;
1892
1916
  reportsToFollow;
1893
- persistValues(applHost) {
1894
- if (!super.persistValues(applHost))
1917
+ persistValues(ctx) {
1918
+ if (!super.persistValues(ctx))
1895
1919
  return false;
1896
1920
  // Bitfield parameters that are not documented in a config file
1897
1921
  // are split into multiple partial parameters. We need to set the name for
1898
1922
  // all of them.
1899
- const partialParams = this.getPartialParamInfos(applHost, this.parameter);
1923
+ const partialParams = this.getPartialParamInfos(ctx, this.parameter);
1900
1924
  if (partialParams.length === 0) {
1901
- this.extendParamInformation(applHost, this.parameter, undefined, {
1925
+ this.extendParamInformation(ctx, this.parameter, undefined, {
1902
1926
  label: this.name,
1903
1927
  });
1904
1928
  }
@@ -1913,20 +1937,20 @@ let ConfigurationCCNameReport = class ConfigurationCCNameReport extends Configur
1913
1937
  if (bitNumber != undefined) {
1914
1938
  label += ` (bit ${bitNumber})`;
1915
1939
  }
1916
- this.extendParamInformation(applHost, paramNumber, bitMask, {
1940
+ this.extendParamInformation(ctx, paramNumber, bitMask, {
1917
1941
  label,
1918
1942
  });
1919
1943
  }
1920
1944
  }
1921
1945
  return true;
1922
1946
  }
1923
- serialize() {
1947
+ serialize(ctx) {
1924
1948
  const nameBuffer = Buffer.from(this.name, "utf8");
1925
1949
  this.payload = Buffer.allocUnsafe(3 + nameBuffer.length);
1926
1950
  this.payload.writeUInt16BE(this.parameter, 0);
1927
1951
  this.payload[2] = this.reportsToFollow;
1928
1952
  nameBuffer.copy(this.payload, 3);
1929
- return super.serialize();
1953
+ return super.serialize(ctx);
1930
1954
  }
1931
1955
  getPartialCCSessionId() {
1932
1956
  // Distinguish sessions by the parameter number
@@ -1935,15 +1959,15 @@ let ConfigurationCCNameReport = class ConfigurationCCNameReport extends Configur
1935
1959
  expectMoreMessages() {
1936
1960
  return this.reportsToFollow > 0;
1937
1961
  }
1938
- mergePartialCCs(applHost, partials) {
1962
+ mergePartialCCs(partials, _ctx) {
1939
1963
  // Concat the name
1940
1964
  this.name = [...partials, this]
1941
1965
  .map((report) => report.name)
1942
1966
  .reduce((prev, cur) => prev + cur, "");
1943
1967
  }
1944
- toLogEntry(host) {
1968
+ toLogEntry(ctx) {
1945
1969
  return {
1946
- ...super.toLogEntry(host),
1970
+ ...super.toLogEntry(ctx),
1947
1971
  message: {
1948
1972
  "parameter #": this.parameter,
1949
1973
  name: this.name,
@@ -1953,72 +1977,78 @@ let ConfigurationCCNameReport = class ConfigurationCCNameReport extends Configur
1953
1977
  }
1954
1978
  };
1955
1979
  exports.ConfigurationCCNameReport = ConfigurationCCNameReport;
1956
- exports.ConfigurationCCNameReport = ConfigurationCCNameReport = __decorate([
1980
+ exports.ConfigurationCCNameReport = ConfigurationCCNameReport = ConfigurationCCNameReport_1 = __decorate([
1957
1981
  (0, CommandClassDecorators_1.CCCommand)(_Types_1.ConfigurationCommand.NameReport)
1958
1982
  ], ConfigurationCCNameReport);
1959
- let ConfigurationCCNameGet = class ConfigurationCCNameGet extends ConfigurationCC {
1960
- constructor(host, options) {
1961
- super(host, options);
1962
- if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
1963
- (0, safe_1.validatePayload)(this.payload.length >= 2);
1964
- this.parameter = this.payload.readUInt16BE(0);
1965
- }
1966
- else {
1967
- this.parameter = options.parameter;
1968
- }
1983
+ let ConfigurationCCNameGet = ConfigurationCCNameGet_1 = class ConfigurationCCNameGet extends ConfigurationCC {
1984
+ constructor(options) {
1985
+ super(options);
1986
+ this.parameter = options.parameter;
1987
+ }
1988
+ static from(raw, ctx) {
1989
+ (0, safe_1.validatePayload)(raw.payload.length >= 2);
1990
+ const parameter = raw.payload.readUInt16BE(0);
1991
+ return new ConfigurationCCNameGet_1({
1992
+ nodeId: ctx.sourceNodeId,
1993
+ parameter,
1994
+ });
1969
1995
  }
1970
1996
  parameter;
1971
- serialize() {
1997
+ serialize(ctx) {
1972
1998
  this.payload = Buffer.allocUnsafe(2);
1973
1999
  this.payload.writeUInt16BE(this.parameter, 0);
1974
- return super.serialize();
2000
+ return super.serialize(ctx);
1975
2001
  }
1976
- toLogEntry(host) {
2002
+ toLogEntry(ctx) {
1977
2003
  return {
1978
- ...super.toLogEntry(host),
2004
+ ...super.toLogEntry(ctx),
1979
2005
  message: { "parameter #": this.parameter },
1980
2006
  };
1981
2007
  }
1982
2008
  };
1983
2009
  exports.ConfigurationCCNameGet = ConfigurationCCNameGet;
1984
- exports.ConfigurationCCNameGet = ConfigurationCCNameGet = __decorate([
2010
+ exports.ConfigurationCCNameGet = ConfigurationCCNameGet = ConfigurationCCNameGet_1 = __decorate([
1985
2011
  (0, CommandClassDecorators_1.CCCommand)(_Types_1.ConfigurationCommand.NameGet),
1986
2012
  (0, CommandClassDecorators_1.expectedCCResponse)(ConfigurationCCNameReport)
1987
2013
  ], ConfigurationCCNameGet);
1988
- let ConfigurationCCInfoReport = class ConfigurationCCInfoReport extends ConfigurationCC {
1989
- constructor(host, options) {
1990
- super(host, options);
1991
- if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
1992
- // Parameter and # of reports must be present
1993
- (0, safe_1.validatePayload)(this.payload.length >= 3);
1994
- this.parameter = this.payload.readUInt16BE(0);
1995
- this.reportsToFollow = this.payload[2];
1996
- if (this.reportsToFollow > 0) {
1997
- // If more reports follow, the info must at least be one byte
1998
- (0, safe_1.validatePayload)(this.payload.length >= 4);
1999
- }
2000
- this.info = this.payload.subarray(3).toString("utf8");
2001
- }
2002
- else {
2003
- this.parameter = options.parameter;
2004
- this.info = options.info;
2005
- this.reportsToFollow = options.reportsToFollow;
2006
- }
2014
+ let ConfigurationCCInfoReport = ConfigurationCCInfoReport_1 = class ConfigurationCCInfoReport extends ConfigurationCC {
2015
+ constructor(options) {
2016
+ super(options);
2017
+ this.parameter = options.parameter;
2018
+ this.info = options.info;
2019
+ this.reportsToFollow = options.reportsToFollow;
2020
+ }
2021
+ static from(raw, ctx) {
2022
+ // Parameter and # of reports must be present
2023
+ (0, safe_1.validatePayload)(raw.payload.length >= 3);
2024
+ const parameter = raw.payload.readUInt16BE(0);
2025
+ const reportsToFollow = raw.payload[2];
2026
+ if (reportsToFollow > 0) {
2027
+ // If more reports follow, the info must at least be one byte
2028
+ (0, safe_1.validatePayload)(raw.payload.length >= 4);
2029
+ }
2030
+ const info = raw.payload.subarray(3).toString("utf8");
2031
+ return new ConfigurationCCInfoReport_1({
2032
+ nodeId: ctx.sourceNodeId,
2033
+ parameter,
2034
+ reportsToFollow,
2035
+ info,
2036
+ });
2007
2037
  }
2008
2038
  parameter;
2009
2039
  info;
2010
2040
  reportsToFollow;
2011
- persistValues(applHost) {
2012
- if (!super.persistValues(applHost))
2041
+ persistValues(ctx) {
2042
+ if (!super.persistValues(ctx))
2013
2043
  return false;
2014
2044
  // Bitfield parameters that are not documented in a config file
2015
2045
  // are split into multiple partial parameters. We need to set the description for
2016
2046
  // all of them. However, these can get very long, so we put the reported
2017
2047
  // description on the first partial param, and refer to it from the others
2018
- const partialParams = this.getPartialParamInfos(applHost, this.parameter).sort((a, b) => (a.propertyKey ?? 0)
2048
+ const partialParams = this.getPartialParamInfos(ctx, this.parameter).sort((a, b) => (a.propertyKey ?? 0)
2019
2049
  - (b.propertyKey ?? 0));
2020
2050
  if (partialParams.length === 0) {
2021
- this.extendParamInformation(applHost, this.parameter, undefined, {
2051
+ this.extendParamInformation(ctx, this.parameter, undefined, {
2022
2052
  description: this.info,
2023
2053
  });
2024
2054
  }
@@ -2031,27 +2061,27 @@ let ConfigurationCCInfoReport = class ConfigurationCCInfoReport extends Configur
2031
2061
  const description = firstParamLabel
2032
2062
  ? `Refer to ${firstParamLabel}`
2033
2063
  : this.info;
2034
- this.extendParamInformation(applHost, paramNumber, bitMask, {
2064
+ this.extendParamInformation(ctx, paramNumber, bitMask, {
2035
2065
  description,
2036
2066
  });
2037
2067
  // Then we store the name of the first param to refer to it on the
2038
2068
  // following partial params
2039
2069
  if (firstParamLabel == undefined) {
2040
2070
  firstParamLabel =
2041
- this.getParamInformation(applHost, paramNumber, bitMask)
2071
+ this.getParamInformation(ctx, paramNumber, bitMask)
2042
2072
  .label ?? `parameter ${paramNumber} - ${bitMask}`;
2043
2073
  }
2044
2074
  }
2045
2075
  }
2046
2076
  return true;
2047
2077
  }
2048
- serialize() {
2078
+ serialize(ctx) {
2049
2079
  const infoBuffer = Buffer.from(this.info, "utf8");
2050
2080
  this.payload = Buffer.allocUnsafe(3 + infoBuffer.length);
2051
2081
  this.payload.writeUInt16BE(this.parameter, 0);
2052
2082
  this.payload[2] = this.reportsToFollow;
2053
2083
  infoBuffer.copy(this.payload, 3);
2054
- return super.serialize();
2084
+ return super.serialize(ctx);
2055
2085
  }
2056
2086
  getPartialCCSessionId() {
2057
2087
  // Distinguish sessions by the parameter number
@@ -2060,15 +2090,15 @@ let ConfigurationCCInfoReport = class ConfigurationCCInfoReport extends Configur
2060
2090
  expectMoreMessages() {
2061
2091
  return this.reportsToFollow > 0;
2062
2092
  }
2063
- mergePartialCCs(applHost, partials) {
2093
+ mergePartialCCs(partials, _ctx) {
2064
2094
  // Concat the info
2065
2095
  this.info = [...partials, this]
2066
2096
  .map((report) => report.info)
2067
2097
  .reduce((prev, cur) => prev + cur, "");
2068
2098
  }
2069
- toLogEntry(host) {
2099
+ toLogEntry(ctx) {
2070
2100
  return {
2071
- ...super.toLogEntry(host),
2101
+ ...super.toLogEntry(ctx),
2072
2102
  message: {
2073
2103
  "parameter #": this.parameter,
2074
2104
  info: this.info,
@@ -2078,108 +2108,132 @@ let ConfigurationCCInfoReport = class ConfigurationCCInfoReport extends Configur
2078
2108
  }
2079
2109
  };
2080
2110
  exports.ConfigurationCCInfoReport = ConfigurationCCInfoReport;
2081
- exports.ConfigurationCCInfoReport = ConfigurationCCInfoReport = __decorate([
2111
+ exports.ConfigurationCCInfoReport = ConfigurationCCInfoReport = ConfigurationCCInfoReport_1 = __decorate([
2082
2112
  (0, CommandClassDecorators_1.CCCommand)(_Types_1.ConfigurationCommand.InfoReport)
2083
2113
  ], ConfigurationCCInfoReport);
2084
- let ConfigurationCCInfoGet = class ConfigurationCCInfoGet extends ConfigurationCC {
2085
- constructor(host, options) {
2086
- super(host, options);
2087
- if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
2088
- (0, safe_1.validatePayload)(this.payload.length >= 2);
2089
- this.parameter = this.payload.readUInt16BE(0);
2090
- }
2091
- else {
2092
- this.parameter = options.parameter;
2093
- }
2114
+ let ConfigurationCCInfoGet = ConfigurationCCInfoGet_1 = class ConfigurationCCInfoGet extends ConfigurationCC {
2115
+ constructor(options) {
2116
+ super(options);
2117
+ this.parameter = options.parameter;
2118
+ }
2119
+ static from(raw, ctx) {
2120
+ (0, safe_1.validatePayload)(raw.payload.length >= 2);
2121
+ const parameter = raw.payload.readUInt16BE(0);
2122
+ return new ConfigurationCCInfoGet_1({
2123
+ nodeId: ctx.sourceNodeId,
2124
+ parameter,
2125
+ });
2094
2126
  }
2095
2127
  parameter;
2096
- serialize() {
2128
+ serialize(ctx) {
2097
2129
  this.payload = Buffer.allocUnsafe(2);
2098
2130
  this.payload.writeUInt16BE(this.parameter, 0);
2099
- return super.serialize();
2131
+ return super.serialize(ctx);
2100
2132
  }
2101
- toLogEntry(host) {
2133
+ toLogEntry(ctx) {
2102
2134
  return {
2103
- ...super.toLogEntry(host),
2135
+ ...super.toLogEntry(ctx),
2104
2136
  message: { "parameter #": this.parameter },
2105
2137
  };
2106
2138
  }
2107
2139
  };
2108
2140
  exports.ConfigurationCCInfoGet = ConfigurationCCInfoGet;
2109
- exports.ConfigurationCCInfoGet = ConfigurationCCInfoGet = __decorate([
2141
+ exports.ConfigurationCCInfoGet = ConfigurationCCInfoGet = ConfigurationCCInfoGet_1 = __decorate([
2110
2142
  (0, CommandClassDecorators_1.CCCommand)(_Types_1.ConfigurationCommand.InfoGet),
2111
2143
  (0, CommandClassDecorators_1.expectedCCResponse)(ConfigurationCCInfoReport)
2112
2144
  ], ConfigurationCCInfoGet);
2113
- let ConfigurationCCPropertiesReport = class ConfigurationCCPropertiesReport extends ConfigurationCC {
2114
- constructor(host, options) {
2115
- super(host, options);
2116
- if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
2117
- (0, safe_1.validatePayload)(this.payload.length >= 3);
2118
- this.parameter = this.payload.readUInt16BE(0);
2119
- this.valueFormat = (this.payload[2] & 0b111000) >>> 3;
2120
- this.valueSize = this.payload[2] & 0b111;
2121
- // GH#1309 Some devices don't tell us the first parameter if we query #0
2122
- // Instead, they contain 0x000000
2123
- if (this.valueSize === 0 && this.payload.length < 5) {
2124
- this.nextParameter = 0;
2125
- return;
2126
- }
2127
- // Ensure the payload contains the two bytes for next parameter
2128
- const nextParameterOffset = 3 + 3 * this.valueSize;
2129
- (0, safe_1.validatePayload)(this.payload.length >= nextParameterOffset + 2);
2130
- if (this.valueSize > 0) {
2131
- if (this.valueFormat === safe_1.ConfigValueFormat.BitField) {
2132
- this.minValue = 0;
2133
- }
2134
- else {
2135
- this.minValue = parseValue(this.payload.subarray(3), this.valueSize, this.valueFormat);
2136
- }
2137
- this.maxValue = parseValue(this.payload.subarray(3 + this.valueSize), this.valueSize, this.valueFormat);
2138
- this.defaultValue = parseValue(this.payload.subarray(3 + 2 * this.valueSize), this.valueSize, this.valueFormat);
2145
+ let ConfigurationCCPropertiesReport = ConfigurationCCPropertiesReport_1 = class ConfigurationCCPropertiesReport extends ConfigurationCC {
2146
+ constructor(options) {
2147
+ super(options);
2148
+ this.parameter = options.parameter;
2149
+ this.valueSize = options.valueSize;
2150
+ this.valueFormat = options.valueFormat;
2151
+ if (this.valueSize > 0) {
2152
+ if (options.minValue == undefined) {
2153
+ throw new safe_1.ZWaveError("The minimum value must be set when the value size is non-zero", safe_1.ZWaveErrorCodes.Argument_Invalid);
2139
2154
  }
2140
- if (this.version < 4) {
2141
- // Read the last 2 bytes to work around nodes not omitting min/max value when their size is 0
2142
- this.nextParameter = this.payload.readUInt16BE(this.payload.length - 2);
2155
+ else if (options.maxValue == undefined) {
2156
+ throw new safe_1.ZWaveError("The maximum value must be set when the value size is non-zero", safe_1.ZWaveErrorCodes.Argument_Invalid);
2143
2157
  }
2144
- else {
2145
- this.nextParameter = this.payload.readUInt16BE(nextParameterOffset);
2146
- // Ensure the payload contains a byte for the 2nd option flags
2147
- (0, safe_1.validatePayload)(this.payload.length >= nextParameterOffset + 3);
2148
- const options1 = this.payload[2];
2149
- const options2 = this.payload[3 + 3 * this.valueSize + 2];
2150
- this.altersCapabilities = !!(options1 & 0b1000_0000);
2151
- this.isReadonly = !!(options1 & 0b0100_0000);
2152
- this.isAdvanced = !!(options2 & 0b1);
2153
- this.noBulkSupport = !!(options2 & 0b10);
2158
+ else if (options.defaultValue == undefined) {
2159
+ throw new safe_1.ZWaveError("The default value must be set when the value size is non-zero", safe_1.ZWaveErrorCodes.Argument_Invalid);
2154
2160
  }
2161
+ this.minValue = options.minValue;
2162
+ this.maxValue = options.maxValue;
2163
+ this.defaultValue = options.defaultValue;
2164
+ }
2165
+ this.nextParameter = options.nextParameter;
2166
+ this.altersCapabilities = options.altersCapabilities;
2167
+ this.isReadonly = options.isReadonly;
2168
+ this.isAdvanced = options.isAdvanced;
2169
+ this.noBulkSupport = options.noBulkSupport;
2170
+ }
2171
+ static from(raw, ctx) {
2172
+ (0, safe_1.validatePayload)(raw.payload.length >= 3);
2173
+ const parameter = raw.payload.readUInt16BE(0);
2174
+ const valueFormat = (raw.payload[2] & 0b111000)
2175
+ >>> 3;
2176
+ const valueSize = raw.payload[2] & 0b111;
2177
+ // GH#1309 Some devices don't tell us the first parameter if we query #0
2178
+ // Instead, they contain 0x000000
2179
+ let nextParameter;
2180
+ if (valueSize === 0 && raw.payload.length < 5) {
2181
+ nextParameter = 0;
2182
+ return new ConfigurationCCPropertiesReport_1({
2183
+ nodeId: ctx.sourceNodeId,
2184
+ parameter,
2185
+ valueFormat,
2186
+ valueSize,
2187
+ nextParameter,
2188
+ });
2155
2189
  }
2156
- else {
2157
- this.parameter = options.parameter;
2158
- this.valueSize = options.valueSize;
2159
- this.valueFormat = options.valueFormat;
2160
- if (this.valueSize > 0) {
2161
- if (options.minValue == undefined) {
2162
- throw new safe_1.ZWaveError("The minimum value must be set when the value size is non-zero", safe_1.ZWaveErrorCodes.Argument_Invalid);
2163
- }
2164
- else if (options.maxValue == undefined) {
2165
- throw new safe_1.ZWaveError("The maximum value must be set when the value size is non-zero", safe_1.ZWaveErrorCodes.Argument_Invalid);
2166
- }
2167
- else if (options.defaultValue == undefined) {
2168
- throw new safe_1.ZWaveError("The default value must be set when the value size is non-zero", safe_1.ZWaveErrorCodes.Argument_Invalid);
2169
- }
2170
- this.minValue = options.minValue;
2171
- this.maxValue = options.maxValue;
2172
- this.defaultValue = options.defaultValue;
2190
+ // Ensure the payload contains the two bytes for next parameter
2191
+ const nextParameterOffset = 3 + 3 * valueSize;
2192
+ (0, safe_1.validatePayload)(raw.payload.length >= nextParameterOffset + 2);
2193
+ let minValue;
2194
+ let maxValue;
2195
+ let defaultValue;
2196
+ if (valueSize > 0) {
2197
+ if (valueFormat === safe_1.ConfigValueFormat.BitField) {
2198
+ minValue = 0;
2173
2199
  }
2174
- this.nextParameter = options.nextParameter;
2175
- this.altersCapabilities = options.altersCapabilities;
2176
- this.isReadonly = options.isReadonly;
2177
- this.isAdvanced = options.isAdvanced;
2178
- this.noBulkSupport = options.noBulkSupport;
2179
- }
2200
+ else {
2201
+ minValue = parseValue(raw.payload.subarray(3), valueSize, valueFormat);
2202
+ }
2203
+ maxValue = parseValue(raw.payload.subarray(3 + valueSize), valueSize, valueFormat);
2204
+ defaultValue = parseValue(raw.payload.subarray(3 + 2 * valueSize), valueSize, valueFormat);
2205
+ }
2206
+ nextParameter = raw.payload.readUInt16BE(nextParameterOffset);
2207
+ let altersCapabilities;
2208
+ let isReadonly;
2209
+ let isAdvanced;
2210
+ let noBulkSupport;
2211
+ if (raw.payload.length >= nextParameterOffset + 3) {
2212
+ // V4 adds an options byte after the next parameter and two bits in byte 2
2213
+ const options1 = raw.payload[2];
2214
+ const options2 = raw.payload[3 + 3 * valueSize + 2];
2215
+ altersCapabilities = !!(options1 & 0b1000_0000);
2216
+ isReadonly = !!(options1 & 0b0100_0000);
2217
+ isAdvanced = !!(options2 & 0b1);
2218
+ noBulkSupport = !!(options2 & 0b10);
2219
+ }
2220
+ return new ConfigurationCCPropertiesReport_1({
2221
+ nodeId: ctx.sourceNodeId,
2222
+ parameter,
2223
+ valueFormat,
2224
+ valueSize,
2225
+ nextParameter,
2226
+ minValue,
2227
+ maxValue,
2228
+ defaultValue,
2229
+ altersCapabilities,
2230
+ isReadonly,
2231
+ isAdvanced,
2232
+ noBulkSupport,
2233
+ });
2180
2234
  }
2181
- persistValues(applHost) {
2182
- if (!super.persistValues(applHost))
2235
+ persistValues(ctx) {
2236
+ if (!super.persistValues(ctx))
2183
2237
  return false;
2184
2238
  // If we actually received parameter info, store it
2185
2239
  if (this.valueSize > 0) {
@@ -2197,14 +2251,14 @@ let ConfigurationCCPropertiesReport = class ConfigurationCCPropertiesReport exte
2197
2251
  };
2198
2252
  if (this.valueFormat !== safe_1.ConfigValueFormat.BitField) {
2199
2253
  // Do not override param information from a config file
2200
- if (!this.paramExistsInConfigFile(applHost, this.parameter)) {
2254
+ if (!this.paramExistsInConfigFile(ctx, this.parameter)) {
2201
2255
  const paramInfo = (0, safe_1.stripUndefined)({
2202
2256
  ...baseInfo,
2203
2257
  min: this.minValue,
2204
2258
  max: this.maxValue,
2205
2259
  default: this.defaultValue,
2206
2260
  });
2207
- this.extendParamInformation(applHost, this.parameter, undefined, paramInfo);
2261
+ this.extendParamInformation(ctx, this.parameter, undefined, paramInfo);
2208
2262
  }
2209
2263
  }
2210
2264
  else {
@@ -2216,14 +2270,14 @@ let ConfigurationCCPropertiesReport = class ConfigurationCCPropertiesReport exte
2216
2270
  // Only create partials that exist
2217
2271
  !!(mask & bits)
2218
2272
  // Do not override param information from a config file
2219
- && !this.paramExistsInConfigFile(applHost, this.parameter, mask)) {
2273
+ && !this.paramExistsInConfigFile(ctx, this.parameter, mask)) {
2220
2274
  const paramInfo = (0, safe_1.stripUndefined)({
2221
2275
  ...baseInfo,
2222
2276
  min: 0,
2223
2277
  max: 1,
2224
2278
  default: this.defaultValue & mask ? 1 : 0,
2225
2279
  });
2226
- this.extendParamInformation(applHost, this.parameter, mask, paramInfo);
2280
+ this.extendParamInformation(ctx, this.parameter, mask, paramInfo);
2227
2281
  }
2228
2282
  // We must use multiplication here, as bitwise shifting works on signed 32-bit integers in JS
2229
2283
  // which would create an infinite loop if maxValue === 0xffff_ffff
@@ -2244,7 +2298,7 @@ let ConfigurationCCPropertiesReport = class ConfigurationCCPropertiesReport exte
2244
2298
  isReadonly;
2245
2299
  isAdvanced;
2246
2300
  noBulkSupport;
2247
- serialize() {
2301
+ serialize(ctx) {
2248
2302
  this.payload = Buffer.allocUnsafe(3 // preamble
2249
2303
  + 3 * this.valueSize // min, max, default value
2250
2304
  + 2 // next parameter
@@ -2269,9 +2323,9 @@ let ConfigurationCCPropertiesReport = class ConfigurationCCPropertiesReport exte
2269
2323
  const options2 = (this.isAdvanced ? 0b1 : 0)
2270
2324
  | (this.noBulkSupport ? 0b10 : 0);
2271
2325
  this.payload[offset] = options2;
2272
- return super.serialize();
2326
+ return super.serialize(ctx);
2273
2327
  }
2274
- toLogEntry(host) {
2328
+ toLogEntry(ctx) {
2275
2329
  const message = {
2276
2330
  "parameter #": this.parameter,
2277
2331
  "next param #": this.nextParameter,
@@ -2300,41 +2354,43 @@ let ConfigurationCCPropertiesReport = class ConfigurationCCPropertiesReport exte
2300
2354
  message["bulk support"] = !this.noBulkSupport;
2301
2355
  }
2302
2356
  return {
2303
- ...super.toLogEntry(host),
2357
+ ...super.toLogEntry(ctx),
2304
2358
  message,
2305
2359
  };
2306
2360
  }
2307
2361
  };
2308
2362
  exports.ConfigurationCCPropertiesReport = ConfigurationCCPropertiesReport;
2309
- exports.ConfigurationCCPropertiesReport = ConfigurationCCPropertiesReport = __decorate([
2363
+ exports.ConfigurationCCPropertiesReport = ConfigurationCCPropertiesReport = ConfigurationCCPropertiesReport_1 = __decorate([
2310
2364
  (0, CommandClassDecorators_1.CCCommand)(_Types_1.ConfigurationCommand.PropertiesReport)
2311
2365
  ], ConfigurationCCPropertiesReport);
2312
- let ConfigurationCCPropertiesGet = class ConfigurationCCPropertiesGet extends ConfigurationCC {
2313
- constructor(host, options) {
2314
- super(host, options);
2315
- if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
2316
- (0, safe_1.validatePayload)(this.payload.length >= 2);
2317
- this.parameter = this.payload.readUInt16BE(0);
2318
- }
2319
- else {
2320
- this.parameter = options.parameter;
2321
- }
2366
+ let ConfigurationCCPropertiesGet = ConfigurationCCPropertiesGet_1 = class ConfigurationCCPropertiesGet extends ConfigurationCC {
2367
+ constructor(options) {
2368
+ super(options);
2369
+ this.parameter = options.parameter;
2370
+ }
2371
+ static from(raw, ctx) {
2372
+ (0, safe_1.validatePayload)(raw.payload.length >= 2);
2373
+ const parameter = raw.payload.readUInt16BE(0);
2374
+ return new ConfigurationCCPropertiesGet_1({
2375
+ nodeId: ctx.sourceNodeId,
2376
+ parameter,
2377
+ });
2322
2378
  }
2323
2379
  parameter;
2324
- serialize() {
2380
+ serialize(ctx) {
2325
2381
  this.payload = Buffer.allocUnsafe(2);
2326
2382
  this.payload.writeUInt16BE(this.parameter, 0);
2327
- return super.serialize();
2383
+ return super.serialize(ctx);
2328
2384
  }
2329
- toLogEntry(host) {
2385
+ toLogEntry(ctx) {
2330
2386
  return {
2331
- ...super.toLogEntry(host),
2387
+ ...super.toLogEntry(ctx),
2332
2388
  message: { "parameter #": this.parameter },
2333
2389
  };
2334
2390
  }
2335
2391
  };
2336
2392
  exports.ConfigurationCCPropertiesGet = ConfigurationCCPropertiesGet;
2337
- exports.ConfigurationCCPropertiesGet = ConfigurationCCPropertiesGet = __decorate([
2393
+ exports.ConfigurationCCPropertiesGet = ConfigurationCCPropertiesGet = ConfigurationCCPropertiesGet_1 = __decorate([
2338
2394
  (0, CommandClassDecorators_1.CCCommand)(_Types_1.ConfigurationCommand.PropertiesGet),
2339
2395
  (0, CommandClassDecorators_1.expectedCCResponse)(ConfigurationCCPropertiesReport)
2340
2396
  ], ConfigurationCCPropertiesGet);