@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 IndicatorCCSet_1, IndicatorCCReport_1, IndicatorCCGet_1, IndicatorCCSupportedReport_1, IndicatorCCSupportedGet_1, IndicatorCCDescriptionReport_1, IndicatorCCDescriptionGet_1;
8
9
  Object.defineProperty(exports, "__esModule", { value: true });
9
10
  exports.IndicatorCCDescriptionGet = exports.IndicatorCCDescriptionReport = exports.IndicatorCCSupportedGet = exports.IndicatorCCSupportedReport = exports.IndicatorCCGet = exports.IndicatorCCReport = exports.IndicatorCCSet = exports.IndicatorCC = exports.IndicatorCCAPI = exports.IndicatorCCValues = void 0;
10
11
  function __assertType(argName, typeName, boundHasError) {
@@ -93,7 +94,7 @@ const __assertType__su__number_sa__5_ea_5_5_5_eu = $o => {
93
94
  }
94
95
  return su__number_sa__5_ea_5_5_5_eu($o);
95
96
  };
96
- const __assertType__IndicatorCCReportSpecificOptions = $o => {
97
+ const __assertType__IndicatorCCReportOptions = $o => {
97
98
  function _number($o) {
98
99
  return typeof $o !== "number" ? {} : null;
99
100
  }
@@ -352,7 +353,7 @@ exports.IndicatorCCValues = Object.freeze({
352
353
  /**
353
354
  * Looks up the configured metadata for the given indicator and property
354
355
  */
355
- function getIndicatorMetadata(configManager, indicatorId, propertyId, overrideIndicatorLabel) {
356
+ function getIndicatorMetadata(indicatorId, propertyId, overrideIndicatorLabel) {
356
357
  const label = overrideIndicatorLabel
357
358
  || getIndicatorName(indicatorId);
358
359
  const prop = (0, safe_1.getIndicatorProperty)(propertyId);
@@ -433,7 +434,7 @@ let IndicatorCCAPI = class IndicatorCCAPI extends API_1.CCAPI {
433
434
  && typeof propertyKey === "number") {
434
435
  const indicatorId = property;
435
436
  const propertyId = propertyKey;
436
- const expectedType = getIndicatorMetadata(this.applHost.configManager, indicatorId, propertyId).type;
437
+ const expectedType = getIndicatorMetadata(indicatorId, propertyId).type;
437
438
  // V2+ value
438
439
  if (typeof value !== expectedType) {
439
440
  (0, API_1.throwWrongValueType)(this.ccId, property, expectedType, typeof value);
@@ -470,12 +471,12 @@ let IndicatorCCAPI = class IndicatorCCAPI extends API_1.CCAPI {
470
471
  async get(indicatorId) {
471
472
  __assertType("indicatorId", "(optional) number", __assertType__optional_number.bind(void 0, indicatorId));
472
473
  this.assertSupportsCommand(_Types_1.IndicatorCommand, _Types_1.IndicatorCommand.Get);
473
- const cc = new IndicatorCCGet(this.applHost, {
474
+ const cc = new IndicatorCCGet({
474
475
  nodeId: this.endpoint.nodeId,
475
- endpoint: this.endpoint.index,
476
+ endpointIndex: this.endpoint.index,
476
477
  indicatorId,
477
478
  });
478
- const response = await this.applHost.sendCommand(cc, this.commandOptions);
479
+ const response = await this.host.sendCommand(cc, this.commandOptions);
479
480
  if (!response)
480
481
  return;
481
482
  if (response.values)
@@ -485,32 +486,41 @@ let IndicatorCCAPI = class IndicatorCCAPI extends API_1.CCAPI {
485
486
  async set(value) {
486
487
  __assertType("value", undefined, __assertType__su__number_sa__5_ea_5_5_5_eu.bind(void 0, value));
487
488
  this.assertSupportsCommand(_Types_1.IndicatorCommand, _Types_1.IndicatorCommand.Set);
488
- const cc = new IndicatorCCSet(this.applHost, {
489
+ if (this.version === 1 && typeof value !== "number") {
490
+ throw new safe_1.ZWaveError(`Node ${this.endpoint
491
+ .nodeId} only supports IndicatorCC V1 which requires a single value to be set`, safe_1.ZWaveErrorCodes.Argument_Invalid);
492
+ }
493
+ else if (this.version >= 2
494
+ && (0, typeguards_1.isArray)(value)
495
+ && value.length > MAX_INDICATOR_OBJECTS) {
496
+ throw new safe_1.ZWaveError(`Only ${MAX_INDICATOR_OBJECTS} indicator values can be set at a time!`, safe_1.ZWaveErrorCodes.Argument_Invalid);
497
+ }
498
+ const cc = new IndicatorCCSet({
489
499
  nodeId: this.endpoint.nodeId,
490
- endpoint: this.endpoint.index,
500
+ endpointIndex: this.endpoint.index,
491
501
  ...(typeof value === "number" ? { value } : { values: value }),
492
502
  });
493
- return this.applHost.sendCommand(cc, this.commandOptions);
503
+ return this.host.sendCommand(cc, this.commandOptions);
494
504
  }
495
505
  async sendReport(options) {
496
- __assertType("options", "IndicatorCCReportSpecificOptions", __assertType__IndicatorCCReportSpecificOptions.bind(void 0, options));
506
+ __assertType("options", "IndicatorCCReportOptions", __assertType__IndicatorCCReportOptions.bind(void 0, options));
497
507
  this.assertSupportsCommand(_Types_1.IndicatorCommand, _Types_1.IndicatorCommand.Report);
498
- const cc = new IndicatorCCReport(this.applHost, {
508
+ const cc = new IndicatorCCReport({
499
509
  nodeId: this.endpoint.nodeId,
500
- endpoint: this.endpoint.index,
510
+ endpointIndex: this.endpoint.index,
501
511
  ...options,
502
512
  });
503
- await this.applHost.sendCommand(cc, this.commandOptions);
513
+ await this.host.sendCommand(cc, this.commandOptions);
504
514
  }
505
515
  async getSupported(indicatorId) {
506
516
  __assertType("indicatorId", "number", __assertType__number.bind(void 0, indicatorId));
507
517
  this.assertSupportsCommand(_Types_1.IndicatorCommand, _Types_1.IndicatorCommand.SupportedGet);
508
- const cc = new IndicatorCCSupportedGet(this.applHost, {
518
+ const cc = new IndicatorCCSupportedGet({
509
519
  nodeId: this.endpoint.nodeId,
510
- endpoint: this.endpoint.index,
520
+ endpointIndex: this.endpoint.index,
511
521
  indicatorId,
512
522
  });
513
- const response = await this.applHost.sendCommand(cc, this.commandOptions);
523
+ const response = await this.host.sendCommand(cc, this.commandOptions);
514
524
  if (response) {
515
525
  return {
516
526
  // Include the actual indicator ID if 0x00 was requested
@@ -527,26 +537,26 @@ let IndicatorCCAPI = class IndicatorCCAPI extends API_1.CCAPI {
527
537
  __assertType("supportedProperties", undefined, __assertType__sa__number_ea_2.bind(void 0, supportedProperties));
528
538
  __assertType("nextIndicatorId", "number", __assertType__number.bind(void 0, nextIndicatorId));
529
539
  this.assertSupportsCommand(_Types_1.IndicatorCommand, _Types_1.IndicatorCommand.SupportedReport);
530
- const cc = new IndicatorCCSupportedReport(this.applHost, {
540
+ const cc = new IndicatorCCSupportedReport({
531
541
  nodeId: this.endpoint.nodeId,
532
- endpoint: this.endpoint.index,
542
+ endpointIndex: this.endpoint.index,
533
543
  indicatorId,
534
544
  supportedProperties,
535
545
  nextIndicatorId,
536
546
  });
537
- await this.applHost.sendCommand(cc, this.commandOptions);
547
+ await this.host.sendCommand(cc, this.commandOptions);
538
548
  }
539
549
  async reportDescription(indicatorId, description) {
540
550
  __assertType("indicatorId", "number", __assertType__number.bind(void 0, indicatorId));
541
551
  __assertType("description", "string", __assertType__string.bind(void 0, description));
542
552
  this.assertSupportsCommand(_Types_1.IndicatorCommand, _Types_1.IndicatorCommand.DescriptionReport);
543
- const cc = new IndicatorCCDescriptionReport(this.applHost, {
553
+ const cc = new IndicatorCCDescriptionReport({
544
554
  nodeId: this.endpoint.nodeId,
545
- endpoint: this.endpoint.index,
555
+ endpointIndex: this.endpoint.index,
546
556
  indicatorId,
547
557
  description,
548
558
  });
549
- await this.applHost.sendCommand(cc, this.commandOptions);
559
+ await this.host.sendCommand(cc, this.commandOptions);
550
560
  }
551
561
  /**
552
562
  * Instructs the node to identify itself. Available starting with V3 of this CC.
@@ -599,7 +609,7 @@ let IndicatorCCAPI = class IndicatorCCAPI extends API_1.CCAPI {
599
609
  timeout = parsed;
600
610
  }
601
611
  }
602
- const supportedPropertyIDs = IndicatorCC.getSupportedPropertyIDsCached(this.applHost, this.endpoint, indicatorId);
612
+ const supportedPropertyIDs = IndicatorCC.getSupportedPropertyIDsCached(this.host, this.endpoint, indicatorId);
603
613
  const objects = [];
604
614
  if (timeout) {
605
615
  const hours = timeout.hours ?? 0;
@@ -669,12 +679,12 @@ let IndicatorCCAPI = class IndicatorCCAPI extends API_1.CCAPI {
669
679
  async getDescription(indicatorId) {
670
680
  __assertType("indicatorId", "number", __assertType__number.bind(void 0, indicatorId));
671
681
  this.assertSupportsCommand(_Types_1.IndicatorCommand, _Types_1.IndicatorCommand.DescriptionGet);
672
- const cc = new IndicatorCCDescriptionGet(this.applHost, {
682
+ const cc = new IndicatorCCDescriptionGet({
673
683
  nodeId: this.endpoint.nodeId,
674
- endpoint: this.endpoint.index,
684
+ endpointIndex: this.endpoint.index,
675
685
  indicatorId,
676
686
  });
677
- const response = await this.applHost.sendCommand(cc, this.commandOptions);
687
+ const response = await this.host.sendCommand(cc, this.commandOptions);
678
688
  return response?.description;
679
689
  }
680
690
  };
@@ -683,19 +693,19 @@ exports.IndicatorCCAPI = IndicatorCCAPI = __decorate([
683
693
  (0, CommandClassDecorators_1.API)(safe_1.CommandClasses.Indicator)
684
694
  ], IndicatorCCAPI);
685
695
  let IndicatorCC = class IndicatorCC extends CommandClass_1.CommandClass {
686
- async interview(applHost) {
687
- const node = this.getNode(applHost);
688
- const endpoint = this.getEndpoint(applHost);
689
- const api = API_1.CCAPI.create(safe_1.CommandClasses.Indicator, applHost, endpoint).withOptions({
696
+ async interview(ctx) {
697
+ const node = this.getNode(ctx);
698
+ const endpoint = this.getEndpoint(ctx);
699
+ const api = API_1.CCAPI.create(safe_1.CommandClasses.Indicator, ctx, endpoint).withOptions({
690
700
  priority: safe_1.MessagePriority.NodeQuery,
691
701
  });
692
- applHost.controllerLog.logNode(node.id, {
702
+ ctx.logNode(node.id, {
693
703
  endpoint: this.endpointIndex,
694
704
  message: `Interviewing ${this.ccName}...`,
695
705
  direction: "none",
696
706
  });
697
- if (this.version > 1) {
698
- applHost.controllerLog.logNode(node.id, {
707
+ if (api.version > 1) {
708
+ ctx.logNode(node.id, {
699
709
  endpoint: this.endpointIndex,
700
710
  message: "scanning supported indicator IDs...",
701
711
  direction: "outbound",
@@ -706,7 +716,7 @@ let IndicatorCC = class IndicatorCC extends CommandClass_1.CommandClass {
706
716
  do {
707
717
  const supportedResponse = await api.getSupported(curId);
708
718
  if (!supportedResponse) {
709
- applHost.controllerLog.logNode(node.id, {
719
+ ctx.logNode(node.id, {
710
720
  endpoint: this.endpointIndex,
711
721
  message: "Time out while scanning supported indicator IDs, skipping interview...",
712
722
  level: "warn",
@@ -717,18 +727,18 @@ let IndicatorCC = class IndicatorCC extends CommandClass_1.CommandClass {
717
727
  curId = supportedResponse.nextIndicatorId;
718
728
  } while (curId !== 0x00);
719
729
  // The IDs are not stored by the report CCs so store them here once we have all of them
720
- this.setValue(applHost, exports.IndicatorCCValues.supportedIndicatorIds, supportedIndicatorIds);
730
+ this.setValue(ctx, exports.IndicatorCCValues.supportedIndicatorIds, supportedIndicatorIds);
721
731
  const logMessage = `supported indicator IDs: ${supportedIndicatorIds.join(", ")}`;
722
- applHost.controllerLog.logNode(node.id, {
732
+ ctx.logNode(node.id, {
723
733
  endpoint: this.endpointIndex,
724
734
  message: logMessage,
725
735
  direction: "inbound",
726
736
  });
727
- if (this.version >= 4) {
737
+ if (api.version >= 4) {
728
738
  const manufacturerDefinedIndicatorIds = supportedIndicatorIds
729
739
  .filter((id) => isManufacturerDefinedIndicator(id));
730
740
  if (manufacturerDefinedIndicatorIds.length > 0) {
731
- applHost.controllerLog.logNode(node.id, {
741
+ ctx.logNode(node.id, {
732
742
  endpoint: this.endpointIndex,
733
743
  message: "retrieving description for manufacturer-defined indicator IDs...",
734
744
  direction: "outbound",
@@ -740,18 +750,18 @@ let IndicatorCC = class IndicatorCC extends CommandClass_1.CommandClass {
740
750
  }
741
751
  }
742
752
  // Query current values
743
- await this.refreshValues(applHost);
753
+ await this.refreshValues(ctx);
744
754
  // Remember that the interview is complete
745
- this.setInterviewComplete(applHost, true);
755
+ this.setInterviewComplete(ctx, true);
746
756
  }
747
- async refreshValues(applHost) {
748
- const node = this.getNode(applHost);
749
- const endpoint = this.getEndpoint(applHost);
750
- const api = API_1.CCAPI.create(safe_1.CommandClasses.Indicator, applHost, endpoint).withOptions({
757
+ async refreshValues(ctx) {
758
+ const node = this.getNode(ctx);
759
+ const endpoint = this.getEndpoint(ctx);
760
+ const api = API_1.CCAPI.create(safe_1.CommandClasses.Indicator, ctx, endpoint).withOptions({
751
761
  priority: safe_1.MessagePriority.NodeQuery,
752
762
  });
753
- if (this.version === 1) {
754
- applHost.controllerLog.logNode(node.id, {
763
+ if (api.version === 1) {
764
+ ctx.logNode(node.id, {
755
765
  endpoint: this.endpointIndex,
756
766
  message: "requesting current indicator value...",
757
767
  direction: "outbound",
@@ -759,9 +769,9 @@ let IndicatorCC = class IndicatorCC extends CommandClass_1.CommandClass {
759
769
  await api.get();
760
770
  }
761
771
  else {
762
- const supportedIndicatorIds = this.getValue(applHost, exports.IndicatorCCValues.supportedIndicatorIds) ?? [];
772
+ const supportedIndicatorIds = this.getValue(ctx, exports.IndicatorCCValues.supportedIndicatorIds) ?? [];
763
773
  for (const indicatorId of supportedIndicatorIds) {
764
- applHost.controllerLog.logNode(node.id, {
774
+ ctx.logNode(node.id, {
765
775
  endpoint: this.endpointIndex,
766
776
  message: `requesting current indicator value (id = ${(0, safe_2.num2hex)(indicatorId)})...`,
767
777
  direction: "outbound",
@@ -770,7 +780,7 @@ let IndicatorCC = class IndicatorCC extends CommandClass_1.CommandClass {
770
780
  }
771
781
  }
772
782
  }
773
- translatePropertyKey(applHost, property, propertyKey) {
783
+ translatePropertyKey(ctx, property, propertyKey) {
774
784
  if (property === "value") {
775
785
  // CC version 1 only has a single value that doesn't need to be translated
776
786
  return undefined;
@@ -782,26 +792,26 @@ let IndicatorCC = class IndicatorCC extends CommandClass_1.CommandClass {
782
792
  if (prop)
783
793
  return prop.label;
784
794
  }
785
- return super.translatePropertyKey(applHost, property, propertyKey);
795
+ return super.translatePropertyKey(ctx, property, propertyKey);
786
796
  }
787
- translateProperty(applHost, property, propertyKey) {
797
+ translateProperty(ctx, property, propertyKey) {
788
798
  if (typeof property === "number" && typeof propertyKey === "number") {
789
799
  // The indicator corresponds to our property
790
800
  if (property in safe_1.Indicator)
791
801
  return safe_1.Indicator[property];
792
802
  }
793
- return super.translateProperty(applHost, property, propertyKey);
803
+ return super.translateProperty(ctx, property, propertyKey);
794
804
  }
795
- supportsV2Indicators(applHost) {
805
+ supportsV2Indicators(ctx) {
796
806
  // First test if there are any indicator ids defined
797
- const supportedIndicatorIds = this.getValue(applHost, exports.IndicatorCCValues.supportedIndicatorIds);
807
+ const supportedIndicatorIds = this.getValue(ctx, exports.IndicatorCCValues.supportedIndicatorIds);
798
808
  if (!supportedIndicatorIds?.length)
799
809
  return false;
800
810
  // Then test if there are any property ids defined
801
- return supportedIndicatorIds.some((indicatorId) => !!this.getValue(applHost, exports.IndicatorCCValues.supportedPropertyIDs(indicatorId))?.length);
811
+ return supportedIndicatorIds.some((indicatorId) => !!this.getValue(ctx, exports.IndicatorCCValues.supportedPropertyIDs(indicatorId))?.length);
802
812
  }
803
- static getSupportedPropertyIDsCached(applHost, endpoint, indicatorId) {
804
- return applHost
813
+ static getSupportedPropertyIDsCached(ctx, endpoint, indicatorId) {
814
+ return ctx
805
815
  .getValueDB(endpoint.nodeId)
806
816
  .getValue(exports.IndicatorCCValues.supportedPropertyIDs(indicatorId).endpoint(endpoint.index));
807
817
  }
@@ -812,55 +822,47 @@ exports.IndicatorCC = IndicatorCC = __decorate([
812
822
  (0, CommandClassDecorators_1.implementedVersion)(4),
813
823
  (0, CommandClassDecorators_1.ccValues)(exports.IndicatorCCValues)
814
824
  ], IndicatorCC);
815
- let IndicatorCCSet = class IndicatorCCSet extends IndicatorCC {
816
- constructor(host, options) {
817
- super(host, options);
818
- if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
819
- (0, safe_1.validatePayload)(this.payload.length >= 1);
820
- const objCount = this.payload.length >= 2
821
- ? this.payload[1] & 0b11111
822
- : 0;
823
- if (objCount === 0) {
824
- this.indicator0Value = this.payload[0];
825
- }
826
- else {
827
- (0, safe_1.validatePayload)(this.payload.length >= 2 + 3 * objCount);
828
- this.values = [];
829
- for (let i = 0; i < objCount; i++) {
830
- const offset = 2 + 3 * i;
831
- const value = {
832
- indicatorId: this.payload[offset],
833
- propertyId: this.payload[offset + 1],
834
- value: this.payload[offset + 2],
835
- };
836
- this.values.push(value);
837
- }
838
- }
825
+ let IndicatorCCSet = IndicatorCCSet_1 = class IndicatorCCSet extends IndicatorCC {
826
+ constructor(options) {
827
+ super(options);
828
+ if ("value" in options) {
829
+ this.indicator0Value = options.value;
839
830
  }
840
831
  else {
841
- if (this.version === 1) {
842
- if (!("value" in options)) {
843
- throw new safe_1.ZWaveError(`Node ${this
844
- .nodeId} only supports IndicatorCC V1 which requires a single value to be set`, safe_1.ZWaveErrorCodes.Argument_Invalid);
845
- }
846
- this.indicator0Value = options.value;
847
- }
848
- else {
849
- if ("value" in options) {
850
- this.indicator0Value = options.value;
851
- }
852
- else {
853
- if (options.values.length > MAX_INDICATOR_OBJECTS) {
854
- throw new safe_1.ZWaveError(`Only ${MAX_INDICATOR_OBJECTS} indicator values can be set at a time!`, safe_1.ZWaveErrorCodes.Argument_Invalid);
855
- }
856
- this.values = options.values;
857
- }
858
- }
832
+ this.values = options.values;
833
+ }
834
+ }
835
+ static from(raw, ctx) {
836
+ (0, safe_1.validatePayload)(raw.payload.length >= 1);
837
+ const objCount = raw.payload.length >= 2
838
+ ? raw.payload[1] & 0b11111
839
+ : 0;
840
+ if (objCount === 0) {
841
+ const indicator0Value = raw.payload[0];
842
+ return new IndicatorCCSet_1({
843
+ nodeId: ctx.sourceNodeId,
844
+ value: indicator0Value,
845
+ });
846
+ }
847
+ (0, safe_1.validatePayload)(raw.payload.length >= 2 + 3 * objCount);
848
+ const values = [];
849
+ for (let i = 0; i < objCount; i++) {
850
+ const offset = 2 + 3 * i;
851
+ const value = {
852
+ indicatorId: raw.payload[offset],
853
+ propertyId: raw.payload[offset + 1],
854
+ value: raw.payload[offset + 2],
855
+ };
856
+ values.push(value);
859
857
  }
858
+ return new IndicatorCCSet_1({
859
+ nodeId: ctx.sourceNodeId,
860
+ values,
861
+ });
860
862
  }
861
863
  indicator0Value;
862
864
  values;
863
- serialize() {
865
+ serialize(ctx) {
864
866
  if (this.values != undefined) {
865
867
  // V2+
866
868
  this.payload = Buffer.alloc(2 + 3 * this.values.length, 0);
@@ -883,9 +885,9 @@ let IndicatorCCSet = class IndicatorCCSet extends IndicatorCC {
883
885
  // V1
884
886
  this.payload = Buffer.from([this.indicator0Value ?? 0]);
885
887
  }
886
- return super.serialize();
888
+ return super.serialize(ctx);
887
889
  }
888
- toLogEntry(host) {
890
+ toLogEntry(ctx) {
889
891
  const message = {};
890
892
  if (this.indicator0Value != undefined) {
891
893
  message["indicator 0 value"] = this.indicator0Value;
@@ -899,91 +901,95 @@ let IndicatorCCSet = class IndicatorCCSet extends IndicatorCC {
899
901
  .join("")}`;
900
902
  }
901
903
  return {
902
- ...super.toLogEntry(host),
904
+ ...super.toLogEntry(ctx),
903
905
  message,
904
906
  };
905
907
  }
906
908
  };
907
909
  exports.IndicatorCCSet = IndicatorCCSet;
908
- exports.IndicatorCCSet = IndicatorCCSet = __decorate([
910
+ exports.IndicatorCCSet = IndicatorCCSet = IndicatorCCSet_1 = __decorate([
909
911
  (0, CommandClassDecorators_1.CCCommand)(_Types_1.IndicatorCommand.Set),
910
912
  (0, CommandClassDecorators_1.useSupervision)()
911
913
  ], IndicatorCCSet);
912
- let IndicatorCCReport = class IndicatorCCReport extends IndicatorCC {
913
- constructor(host, options) {
914
- super(host, options);
915
- if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
916
- (0, safe_1.validatePayload)(this.payload.length >= 1);
917
- const objCount = this.payload.length >= 2
918
- ? this.payload[1] & 0b11111
919
- : 0;
920
- if (objCount === 0) {
921
- this.indicator0Value = this.payload[0];
922
- }
923
- else {
924
- (0, safe_1.validatePayload)(this.payload.length >= 2 + 3 * objCount);
925
- this.values = [];
926
- for (let i = 0; i < objCount; i++) {
927
- const offset = 2 + 3 * i;
928
- const value = {
929
- indicatorId: this.payload[offset],
930
- propertyId: this.payload[offset + 1],
931
- value: this.payload[offset + 2],
932
- };
933
- this.values.push(value);
934
- }
935
- // TODO: Think if we want this:
936
- // // If not all Property IDs are included in the command for the actual Indicator ID,
937
- // // a controlling node MUST assume non-specified Property IDs values to be 0x00.
938
- // const indicatorId = this.values[0].indicatorId;
939
- // const supportedIndicatorProperties =
940
- // valueDB.getValue<number[]>(
941
- // getSupportedPropertyIDsValueID(
942
- // this.endpointIndex,
943
- // indicatorId,
944
- // ),
945
- // ) ?? [];
946
- // // Find out which ones are missing
947
- // const missingIndicatorProperties = supportedIndicatorProperties.filter(
948
- // prop =>
949
- // !this.values!.find(({ propertyId }) => prop === propertyId),
950
- // );
951
- // // And assume they are 0 (false)
952
- // for (const missing of missingIndicatorProperties) {
953
- // this.setIndicatorValue({
954
- // indicatorId,
955
- // propertyId: missing,
956
- // value: 0,
957
- // });
958
- // }
959
- }
914
+ let IndicatorCCReport = IndicatorCCReport_1 = class IndicatorCCReport extends IndicatorCC {
915
+ constructor(options) {
916
+ super(options);
917
+ if ("value" in options) {
918
+ this.indicator0Value = options.value;
960
919
  }
961
- else {
962
- if ("value" in options) {
963
- this.indicator0Value = options.value;
964
- }
965
- else if ("values" in options) {
966
- if (options.values.length > MAX_INDICATOR_OBJECTS) {
967
- throw new safe_1.ZWaveError(`Only ${MAX_INDICATOR_OBJECTS} indicator values can be set at a time!`, safe_1.ZWaveErrorCodes.Argument_Invalid);
968
- }
969
- this.values = options.values;
920
+ else if ("values" in options) {
921
+ if (options.values.length > MAX_INDICATOR_OBJECTS) {
922
+ throw new safe_1.ZWaveError(`Only ${MAX_INDICATOR_OBJECTS} indicator values can be set at a time!`, safe_1.ZWaveErrorCodes.Argument_Invalid);
970
923
  }
924
+ this.values = options.values;
971
925
  }
972
926
  }
973
- persistValues(applHost) {
974
- if (!super.persistValues(applHost))
927
+ static from(raw, ctx) {
928
+ (0, safe_1.validatePayload)(raw.payload.length >= 1);
929
+ const objCount = raw.payload.length >= 2
930
+ ? raw.payload[1] & 0b11111
931
+ : 0;
932
+ if (objCount === 0) {
933
+ const indicator0Value = raw.payload[0];
934
+ return new IndicatorCCReport_1({
935
+ nodeId: ctx.sourceNodeId,
936
+ value: indicator0Value,
937
+ });
938
+ }
939
+ (0, safe_1.validatePayload)(raw.payload.length >= 2 + 3 * objCount);
940
+ const values = [];
941
+ for (let i = 0; i < objCount; i++) {
942
+ const offset = 2 + 3 * i;
943
+ const value = {
944
+ indicatorId: raw.payload[offset],
945
+ propertyId: raw.payload[offset + 1],
946
+ value: raw.payload[offset + 2],
947
+ };
948
+ values.push(value);
949
+ }
950
+ return new IndicatorCCReport_1({
951
+ nodeId: ctx.sourceNodeId,
952
+ values,
953
+ });
954
+ // TODO: Think if we want this:
955
+ // // If not all Property IDs are included in the command for the actual Indicator ID,
956
+ // // a controlling node MUST assume non-specified Property IDs values to be 0x00.
957
+ // const indicatorId = this.values[0].indicatorId;
958
+ // const supportedIndicatorProperties =
959
+ // valueDB.getValue<number[]>(
960
+ // getSupportedPropertyIDsValueID(
961
+ // this.endpointIndex,
962
+ // indicatorId,
963
+ // ),
964
+ // ) ?? [];
965
+ // // Find out which ones are missing
966
+ // const missingIndicatorProperties = supportedIndicatorProperties.filter(
967
+ // prop =>
968
+ // !this.values!.find(({ propertyId }) => prop === propertyId),
969
+ // );
970
+ // // And assume they are 0 (false)
971
+ // for (const missing of missingIndicatorProperties) {
972
+ // this.setIndicatorValue({
973
+ // indicatorId,
974
+ // propertyId: missing,
975
+ // value: 0,
976
+ // });
977
+ // }
978
+ }
979
+ persistValues(ctx) {
980
+ if (!super.persistValues(ctx))
975
981
  return false;
976
982
  if (this.indicator0Value != undefined) {
977
- if (!this.supportsV2Indicators(applHost)) {
983
+ if (!this.supportsV2Indicators(ctx)) {
978
984
  // Publish the value
979
985
  const valueV1 = exports.IndicatorCCValues.valueV1;
980
- this.setMetadata(applHost, valueV1);
981
- this.setValue(applHost, valueV1, this.indicator0Value);
986
+ this.setMetadata(ctx, valueV1);
987
+ this.setValue(ctx, valueV1, this.indicator0Value);
982
988
  }
983
989
  else {
984
990
  if (this.isSinglecast()) {
985
991
  // Don't!
986
- applHost.controllerLog.logNode(this.nodeId, {
992
+ ctx.logNode(this.nodeId, {
987
993
  message: `ignoring V1 indicator report because the node supports V2 indicators`,
988
994
  direction: "none",
989
995
  endpoint: this.endpointIndex,
@@ -994,7 +1000,7 @@ let IndicatorCCReport = class IndicatorCCReport extends IndicatorCC {
994
1000
  else if (this.values) {
995
1001
  // Store the simple values first
996
1002
  for (const value of this.values) {
997
- this.setIndicatorValue(applHost, value);
1003
+ this.setIndicatorValue(ctx, value);
998
1004
  }
999
1005
  // Then group values into the convenience properties
1000
1006
  // ... timeout
@@ -1007,29 +1013,29 @@ let IndicatorCCReport = class IndicatorCCReport extends IndicatorCC {
1007
1013
  timeoutString += `${timeout.minutes}m`;
1008
1014
  if (timeout?.seconds)
1009
1015
  timeoutString += `${timeout.seconds}s`;
1010
- this.setValue(applHost, exports.IndicatorCCValues.timeout, timeoutString);
1016
+ this.setValue(ctx, exports.IndicatorCCValues.timeout, timeoutString);
1011
1017
  }
1012
1018
  }
1013
1019
  return true;
1014
1020
  }
1015
1021
  indicator0Value;
1016
1022
  values;
1017
- setIndicatorValue(applHost, value) {
1023
+ setIndicatorValue(ctx, value) {
1018
1024
  // Manufacturer-defined indicators may need a custom label
1019
1025
  const overrideIndicatorLabel = isManufacturerDefinedIndicator(value.indicatorId)
1020
- ? this.getValue(applHost, exports.IndicatorCCValues.indicatorDescription(value.indicatorId))
1026
+ ? this.getValue(ctx, exports.IndicatorCCValues.indicatorDescription(value.indicatorId))
1021
1027
  : undefined;
1022
- const metadata = getIndicatorMetadata(applHost.configManager, value.indicatorId, value.propertyId, overrideIndicatorLabel);
1028
+ const metadata = getIndicatorMetadata(value.indicatorId, value.propertyId, overrideIndicatorLabel);
1023
1029
  // Some values need to be converted
1024
1030
  if (metadata.type === "boolean") {
1025
1031
  value.value = !!value.value;
1026
1032
  }
1027
1033
  // Publish the value
1028
1034
  const valueV2 = exports.IndicatorCCValues.valueV2(value.indicatorId, value.propertyId);
1029
- this.setMetadata(applHost, valueV2, metadata);
1030
- this.setValue(applHost, valueV2, value.value);
1035
+ this.setMetadata(ctx, valueV2, metadata);
1036
+ this.setValue(ctx, valueV2, value.value);
1031
1037
  }
1032
- serialize() {
1038
+ serialize(ctx) {
1033
1039
  if (this.values != undefined) {
1034
1040
  // V2+
1035
1041
  this.payload = Buffer.alloc(2 + 3 * this.values.length, 0);
@@ -1052,9 +1058,9 @@ let IndicatorCCReport = class IndicatorCCReport extends IndicatorCC {
1052
1058
  // V1
1053
1059
  this.payload = Buffer.from([this.indicator0Value ?? 0]);
1054
1060
  }
1055
- return super.serialize();
1061
+ return super.serialize(ctx);
1056
1062
  }
1057
- toLogEntry(host) {
1063
+ toLogEntry(ctx) {
1058
1064
  const message = {};
1059
1065
  if (this.indicator0Value != undefined) {
1060
1066
  message["indicator 0 value"] = this.indicator0Value;
@@ -1068,37 +1074,40 @@ let IndicatorCCReport = class IndicatorCCReport extends IndicatorCC {
1068
1074
  .join("")}`;
1069
1075
  }
1070
1076
  return {
1071
- ...super.toLogEntry(host),
1077
+ ...super.toLogEntry(ctx),
1072
1078
  message,
1073
1079
  };
1074
1080
  }
1075
1081
  };
1076
1082
  exports.IndicatorCCReport = IndicatorCCReport;
1077
- exports.IndicatorCCReport = IndicatorCCReport = __decorate([
1083
+ exports.IndicatorCCReport = IndicatorCCReport = IndicatorCCReport_1 = __decorate([
1078
1084
  (0, CommandClassDecorators_1.CCCommand)(_Types_1.IndicatorCommand.Report)
1079
1085
  ], IndicatorCCReport);
1080
- let IndicatorCCGet = class IndicatorCCGet extends IndicatorCC {
1081
- constructor(host, options) {
1082
- super(host, options);
1083
- if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
1084
- if (this.payload.length > 0) {
1085
- this.indicatorId = this.payload[0];
1086
- }
1087
- }
1088
- else {
1089
- this.indicatorId = options.indicatorId;
1086
+ let IndicatorCCGet = IndicatorCCGet_1 = class IndicatorCCGet extends IndicatorCC {
1087
+ constructor(options) {
1088
+ super(options);
1089
+ this.indicatorId = options.indicatorId;
1090
+ }
1091
+ static from(raw, ctx) {
1092
+ let indicatorId;
1093
+ if (raw.payload.length > 0) {
1094
+ indicatorId = raw.payload[0];
1090
1095
  }
1096
+ return new IndicatorCCGet_1({
1097
+ nodeId: ctx.sourceNodeId,
1098
+ indicatorId,
1099
+ });
1091
1100
  }
1092
1101
  indicatorId;
1093
- serialize() {
1102
+ serialize(ctx) {
1094
1103
  if (this.indicatorId != undefined) {
1095
1104
  this.payload = Buffer.from([this.indicatorId]);
1096
1105
  }
1097
- return super.serialize();
1106
+ return super.serialize(ctx);
1098
1107
  }
1099
- toLogEntry(host) {
1108
+ toLogEntry(ctx) {
1100
1109
  return {
1101
- ...super.toLogEntry(host),
1110
+ ...super.toLogEntry(ctx),
1102
1111
  message: {
1103
1112
  indicator: getIndicatorName(this.indicatorId),
1104
1113
  },
@@ -1106,46 +1115,51 @@ let IndicatorCCGet = class IndicatorCCGet extends IndicatorCC {
1106
1115
  }
1107
1116
  };
1108
1117
  exports.IndicatorCCGet = IndicatorCCGet;
1109
- exports.IndicatorCCGet = IndicatorCCGet = __decorate([
1118
+ exports.IndicatorCCGet = IndicatorCCGet = IndicatorCCGet_1 = __decorate([
1110
1119
  (0, CommandClassDecorators_1.CCCommand)(_Types_1.IndicatorCommand.Get),
1111
1120
  (0, CommandClassDecorators_1.expectedCCResponse)(IndicatorCCReport)
1112
1121
  ], IndicatorCCGet);
1113
- let IndicatorCCSupportedReport = class IndicatorCCSupportedReport extends IndicatorCC {
1114
- constructor(host, options) {
1115
- super(host, options);
1116
- if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
1117
- (0, safe_1.validatePayload)(this.payload.length >= 3);
1118
- this.indicatorId = this.payload[0];
1119
- this.nextIndicatorId = this.payload[1];
1120
- const bitMaskLength = this.payload[2] & 0b11111;
1121
- if (bitMaskLength === 0) {
1122
- this.supportedProperties = [];
1123
- }
1124
- else {
1125
- (0, safe_1.validatePayload)(this.payload.length >= 3 + bitMaskLength);
1126
- // The bit mask starts at 0, but bit 0 is not used
1127
- this.supportedProperties = (0, safe_1.parseBitMask)(this.payload.subarray(3, 3 + bitMaskLength), 0).filter((v) => v !== 0);
1128
- }
1122
+ let IndicatorCCSupportedReport = IndicatorCCSupportedReport_1 = class IndicatorCCSupportedReport extends IndicatorCC {
1123
+ constructor(options) {
1124
+ super(options);
1125
+ this.indicatorId = options.indicatorId;
1126
+ this.nextIndicatorId = options.nextIndicatorId;
1127
+ this.supportedProperties = options.supportedProperties;
1128
+ }
1129
+ static from(raw, ctx) {
1130
+ (0, safe_1.validatePayload)(raw.payload.length >= 3);
1131
+ const indicatorId = raw.payload[0];
1132
+ const nextIndicatorId = raw.payload[1];
1133
+ const bitMaskLength = raw.payload[2] & 0b11111;
1134
+ let supportedProperties;
1135
+ if (bitMaskLength === 0) {
1136
+ supportedProperties = [];
1129
1137
  }
1130
1138
  else {
1131
- this.indicatorId = options.indicatorId;
1132
- this.nextIndicatorId = options.nextIndicatorId;
1133
- this.supportedProperties = options.supportedProperties;
1139
+ (0, safe_1.validatePayload)(raw.payload.length >= 3 + bitMaskLength);
1140
+ // The bit mask starts at 0, but bit 0 is not used
1141
+ supportedProperties = (0, safe_1.parseBitMask)(raw.payload.subarray(3, 3 + bitMaskLength), 0).filter((v) => v !== 0);
1134
1142
  }
1143
+ return new IndicatorCCSupportedReport_1({
1144
+ nodeId: ctx.sourceNodeId,
1145
+ indicatorId,
1146
+ nextIndicatorId,
1147
+ supportedProperties,
1148
+ });
1135
1149
  }
1136
- persistValues(applHost) {
1137
- if (!super.persistValues(applHost))
1150
+ persistValues(ctx) {
1151
+ if (!super.persistValues(ctx))
1138
1152
  return false;
1139
1153
  if (this.indicatorId !== 0x00) {
1140
1154
  // Remember which property IDs are supported
1141
- this.setValue(applHost, exports.IndicatorCCValues.supportedPropertyIDs(this.indicatorId), this.supportedProperties);
1155
+ this.setValue(ctx, exports.IndicatorCCValues.supportedPropertyIDs(this.indicatorId), this.supportedProperties);
1142
1156
  }
1143
1157
  return true;
1144
1158
  }
1145
1159
  indicatorId;
1146
1160
  nextIndicatorId;
1147
1161
  supportedProperties;
1148
- serialize() {
1162
+ serialize(ctx) {
1149
1163
  const bitmask = this.supportedProperties.length > 0
1150
1164
  ? (0, safe_1.encodeBitMask)(this.supportedProperties, undefined, 0)
1151
1165
  : Buffer.from([]);
@@ -1157,11 +1171,11 @@ let IndicatorCCSupportedReport = class IndicatorCCSupportedReport extends Indica
1157
1171
  ]),
1158
1172
  bitmask,
1159
1173
  ]);
1160
- return super.serialize();
1174
+ return super.serialize(ctx);
1161
1175
  }
1162
- toLogEntry(host) {
1176
+ toLogEntry(ctx) {
1163
1177
  return {
1164
- ...super.toLogEntry(host),
1178
+ ...super.toLogEntry(ctx),
1165
1179
  message: {
1166
1180
  indicator: getIndicatorName(this.indicatorId),
1167
1181
  "supported properties": `${this.supportedProperties
@@ -1174,31 +1188,33 @@ let IndicatorCCSupportedReport = class IndicatorCCSupportedReport extends Indica
1174
1188
  }
1175
1189
  };
1176
1190
  exports.IndicatorCCSupportedReport = IndicatorCCSupportedReport;
1177
- exports.IndicatorCCSupportedReport = IndicatorCCSupportedReport = __decorate([
1191
+ exports.IndicatorCCSupportedReport = IndicatorCCSupportedReport = IndicatorCCSupportedReport_1 = __decorate([
1178
1192
  (0, CommandClassDecorators_1.CCCommand)(_Types_1.IndicatorCommand.SupportedReport)
1179
1193
  ], IndicatorCCSupportedReport);
1180
1194
  function testResponseForIndicatorSupportedGet(sent, received) {
1181
1195
  return sent.indicatorId === 0 || received.indicatorId === sent.indicatorId;
1182
1196
  }
1183
- let IndicatorCCSupportedGet = class IndicatorCCSupportedGet extends IndicatorCC {
1184
- constructor(host, options) {
1185
- super(host, options);
1186
- if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
1187
- (0, safe_1.validatePayload)(this.payload.length >= 1);
1188
- this.indicatorId = this.payload[0];
1189
- }
1190
- else {
1191
- this.indicatorId = options.indicatorId;
1192
- }
1197
+ let IndicatorCCSupportedGet = IndicatorCCSupportedGet_1 = class IndicatorCCSupportedGet extends IndicatorCC {
1198
+ constructor(options) {
1199
+ super(options);
1200
+ this.indicatorId = options.indicatorId;
1201
+ }
1202
+ static from(raw, ctx) {
1203
+ (0, safe_1.validatePayload)(raw.payload.length >= 1);
1204
+ const indicatorId = raw.payload[0];
1205
+ return new IndicatorCCSupportedGet_1({
1206
+ nodeId: ctx.sourceNodeId,
1207
+ indicatorId,
1208
+ });
1193
1209
  }
1194
1210
  indicatorId;
1195
- serialize() {
1211
+ serialize(ctx) {
1196
1212
  this.payload = Buffer.from([this.indicatorId]);
1197
- return super.serialize();
1213
+ return super.serialize(ctx);
1198
1214
  }
1199
- toLogEntry(host) {
1215
+ toLogEntry(ctx) {
1200
1216
  return {
1201
- ...super.toLogEntry(host),
1217
+ ...super.toLogEntry(ctx),
1202
1218
  message: {
1203
1219
  indicator: getIndicatorName(this.indicatorId),
1204
1220
  },
@@ -1206,48 +1222,51 @@ let IndicatorCCSupportedGet = class IndicatorCCSupportedGet extends IndicatorCC
1206
1222
  }
1207
1223
  };
1208
1224
  exports.IndicatorCCSupportedGet = IndicatorCCSupportedGet;
1209
- exports.IndicatorCCSupportedGet = IndicatorCCSupportedGet = __decorate([
1225
+ exports.IndicatorCCSupportedGet = IndicatorCCSupportedGet = IndicatorCCSupportedGet_1 = __decorate([
1210
1226
  (0, CommandClassDecorators_1.CCCommand)(_Types_1.IndicatorCommand.SupportedGet),
1211
1227
  (0, CommandClassDecorators_1.expectedCCResponse)(IndicatorCCSupportedReport, testResponseForIndicatorSupportedGet)
1212
1228
  ], IndicatorCCSupportedGet);
1213
- let IndicatorCCDescriptionReport = class IndicatorCCDescriptionReport extends IndicatorCC {
1214
- constructor(host, options) {
1215
- super(host, options);
1216
- if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
1217
- (0, safe_1.validatePayload)(this.payload.length >= 2);
1218
- this.indicatorId = this.payload[0];
1219
- const descrptionLength = this.payload[1];
1220
- (0, safe_1.validatePayload)(this.payload.length >= 2 + descrptionLength);
1221
- this.description = this.payload
1222
- .subarray(2, 2 + descrptionLength)
1223
- .toString("utf8");
1224
- }
1225
- else {
1226
- this.indicatorId = options.indicatorId;
1227
- this.description = options.description;
1228
- }
1229
+ let IndicatorCCDescriptionReport = IndicatorCCDescriptionReport_1 = class IndicatorCCDescriptionReport extends IndicatorCC {
1230
+ constructor(options) {
1231
+ super(options);
1232
+ this.indicatorId = options.indicatorId;
1233
+ this.description = options.description;
1234
+ }
1235
+ static from(raw, ctx) {
1236
+ (0, safe_1.validatePayload)(raw.payload.length >= 2);
1237
+ const indicatorId = raw.payload[0];
1238
+ const descrptionLength = raw.payload[1];
1239
+ (0, safe_1.validatePayload)(raw.payload.length >= 2 + descrptionLength);
1240
+ const description = raw.payload
1241
+ .subarray(2, 2 + descrptionLength)
1242
+ .toString("utf8");
1243
+ return new IndicatorCCDescriptionReport_1({
1244
+ nodeId: ctx.sourceNodeId,
1245
+ indicatorId,
1246
+ description,
1247
+ });
1229
1248
  }
1230
1249
  indicatorId;
1231
1250
  description;
1232
- persistValues(applHost) {
1233
- if (!super.persistValues(applHost))
1251
+ persistValues(ctx) {
1252
+ if (!super.persistValues(ctx))
1234
1253
  return false;
1235
1254
  if (this.description) {
1236
- this.setValue(applHost, exports.IndicatorCCValues.indicatorDescription(this.indicatorId), this.description);
1255
+ this.setValue(ctx, exports.IndicatorCCValues.indicatorDescription(this.indicatorId), this.description);
1237
1256
  }
1238
1257
  return true;
1239
1258
  }
1240
- serialize() {
1259
+ serialize(ctx) {
1241
1260
  const description = Buffer.from(this.description, "utf8");
1242
1261
  this.payload = Buffer.concat([
1243
1262
  Buffer.from([this.indicatorId, description.length]),
1244
1263
  description,
1245
1264
  ]);
1246
- return super.serialize();
1265
+ return super.serialize(ctx);
1247
1266
  }
1248
- toLogEntry(host) {
1267
+ toLogEntry(ctx) {
1249
1268
  return {
1250
- ...super.toLogEntry(host),
1269
+ ...super.toLogEntry(ctx),
1251
1270
  message: {
1252
1271
  "indicator ID": this.indicatorId,
1253
1272
  description: this.description || "(none)",
@@ -1256,34 +1275,36 @@ let IndicatorCCDescriptionReport = class IndicatorCCDescriptionReport extends In
1256
1275
  }
1257
1276
  };
1258
1277
  exports.IndicatorCCDescriptionReport = IndicatorCCDescriptionReport;
1259
- exports.IndicatorCCDescriptionReport = IndicatorCCDescriptionReport = __decorate([
1278
+ exports.IndicatorCCDescriptionReport = IndicatorCCDescriptionReport = IndicatorCCDescriptionReport_1 = __decorate([
1260
1279
  (0, CommandClassDecorators_1.CCCommand)(_Types_1.IndicatorCommand.DescriptionReport)
1261
1280
  ], IndicatorCCDescriptionReport);
1262
1281
  function testResponseForIndicatorDescriptionGet(sent, received) {
1263
1282
  return received.indicatorId === sent.indicatorId;
1264
1283
  }
1265
- let IndicatorCCDescriptionGet = class IndicatorCCDescriptionGet extends IndicatorCC {
1266
- constructor(host, options) {
1267
- super(host, options);
1268
- if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
1269
- (0, safe_1.validatePayload)(this.payload.length >= 1);
1270
- this.indicatorId = this.payload[0];
1271
- }
1272
- else {
1273
- this.indicatorId = options.indicatorId;
1274
- if (!isManufacturerDefinedIndicator(this.indicatorId)) {
1275
- throw new safe_1.ZWaveError("The indicator ID must be between 0x80 and 0x9f", safe_1.ZWaveErrorCodes.Argument_Invalid);
1276
- }
1284
+ let IndicatorCCDescriptionGet = IndicatorCCDescriptionGet_1 = class IndicatorCCDescriptionGet extends IndicatorCC {
1285
+ constructor(options) {
1286
+ super(options);
1287
+ this.indicatorId = options.indicatorId;
1288
+ if (!isManufacturerDefinedIndicator(this.indicatorId)) {
1289
+ throw new safe_1.ZWaveError("The indicator ID must be between 0x80 and 0x9f", safe_1.ZWaveErrorCodes.Argument_Invalid);
1277
1290
  }
1278
1291
  }
1292
+ static from(raw, ctx) {
1293
+ (0, safe_1.validatePayload)(raw.payload.length >= 1);
1294
+ const indicatorId = raw.payload[0];
1295
+ return new IndicatorCCDescriptionGet_1({
1296
+ nodeId: ctx.sourceNodeId,
1297
+ indicatorId,
1298
+ });
1299
+ }
1279
1300
  indicatorId;
1280
- serialize() {
1301
+ serialize(ctx) {
1281
1302
  this.payload = Buffer.from([this.indicatorId]);
1282
- return super.serialize();
1303
+ return super.serialize(ctx);
1283
1304
  }
1284
- toLogEntry(host) {
1305
+ toLogEntry(ctx) {
1285
1306
  return {
1286
- ...super.toLogEntry(host),
1307
+ ...super.toLogEntry(ctx),
1287
1308
  message: {
1288
1309
  "indicator ID": this.indicatorId,
1289
1310
  },
@@ -1291,7 +1312,7 @@ let IndicatorCCDescriptionGet = class IndicatorCCDescriptionGet extends Indicato
1291
1312
  }
1292
1313
  };
1293
1314
  exports.IndicatorCCDescriptionGet = IndicatorCCDescriptionGet;
1294
- exports.IndicatorCCDescriptionGet = IndicatorCCDescriptionGet = __decorate([
1315
+ exports.IndicatorCCDescriptionGet = IndicatorCCDescriptionGet = IndicatorCCDescriptionGet_1 = __decorate([
1295
1316
  (0, CommandClassDecorators_1.CCCommand)(_Types_1.IndicatorCommand.DescriptionGet),
1296
1317
  (0, CommandClassDecorators_1.expectedCCResponse)(IndicatorCCDescriptionReport, testResponseForIndicatorDescriptionGet)
1297
1318
  ], IndicatorCCDescriptionGet);