@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 ThermostatSetpointCCSet_1, ThermostatSetpointCCReport_1, ThermostatSetpointCCGet_1, ThermostatSetpointCCCapabilitiesReport_1, ThermostatSetpointCCCapabilitiesGet_1, ThermostatSetpointCCSupportedReport_1;
8
9
  Object.defineProperty(exports, "__esModule", { value: true });
9
10
  exports.ThermostatSetpointCCSupportedGet = exports.ThermostatSetpointCCSupportedReport = exports.ThermostatSetpointCCCapabilitiesGet = exports.ThermostatSetpointCCCapabilitiesReport = exports.ThermostatSetpointCCGet = exports.ThermostatSetpointCCReport = exports.ThermostatSetpointCCSet = exports.ThermostatSetpointCC = exports.ThermostatSetpointCCAPI = exports.ThermostatSetpointCCValues = void 0;
10
11
  function __assertType(argName, typeName, boundHasError) {
@@ -54,9 +55,6 @@ exports.ThermostatSetpointCCValues = Object.freeze({
54
55
  ...Values_1.V.staticProperty("supportedSetpointTypes", undefined, {
55
56
  internal: true,
56
57
  }),
57
- ...Values_1.V.staticProperty("setpointTypesInterpretation", undefined, {
58
- internal: true,
59
- }),
60
58
  }),
61
59
  ...Values_1.V.defineDynamicCCValues(safe_1.CommandClasses["Thermostat Setpoint"], {
62
60
  ...Values_1.V.dynamicPropertyAndKeyWithName("setpoint", "setpoint", (setpointType) => setpointType, ({ property, propertyKey }) => property === "setpoint" && typeof propertyKey === "number", (setpointType) => ({
@@ -121,12 +119,12 @@ let ThermostatSetpointCCAPI = class ThermostatSetpointCCAPI extends API_1.CCAPI
121
119
  async get(setpointType) {
122
120
  __assertType("setpointType", "ThermostatSetpointType", __assertType__number.bind(void 0, setpointType));
123
121
  this.assertSupportsCommand(_Types_1.ThermostatSetpointCommand, _Types_1.ThermostatSetpointCommand.Get);
124
- const cc = new ThermostatSetpointCCGet(this.applHost, {
122
+ const cc = new ThermostatSetpointCCGet({
125
123
  nodeId: this.endpoint.nodeId,
126
- endpoint: this.endpoint.index,
124
+ endpointIndex: this.endpoint.index,
127
125
  setpointType,
128
126
  });
129
- const response = await this.applHost.sendCommand(cc, this.commandOptions);
127
+ const response = await this.host.sendCommand(cc, this.commandOptions);
130
128
  if (!response)
131
129
  return;
132
130
  if (response.type !== _Types_1.ThermostatSetpointType["N/A"]) {
@@ -143,24 +141,24 @@ let ThermostatSetpointCCAPI = class ThermostatSetpointCCAPI extends API_1.CCAPI
143
141
  __assertType("value", "number", __assertType__number.bind(void 0, value));
144
142
  __assertType("scale", "number", __assertType__number.bind(void 0, scale));
145
143
  this.assertSupportsCommand(_Types_1.ThermostatSetpointCommand, _Types_1.ThermostatSetpointCommand.Set);
146
- const cc = new ThermostatSetpointCCSet(this.applHost, {
144
+ const cc = new ThermostatSetpointCCSet({
147
145
  nodeId: this.endpoint.nodeId,
148
- endpoint: this.endpoint.index,
146
+ endpointIndex: this.endpoint.index,
149
147
  setpointType,
150
148
  value,
151
149
  scale,
152
150
  });
153
- return this.applHost.sendCommand(cc, this.commandOptions);
151
+ return this.host.sendCommand(cc, this.commandOptions);
154
152
  }
155
153
  async getCapabilities(setpointType) {
156
154
  __assertType("setpointType", "ThermostatSetpointType", __assertType__number.bind(void 0, setpointType));
157
155
  this.assertSupportsCommand(_Types_1.ThermostatSetpointCommand, _Types_1.ThermostatSetpointCommand.CapabilitiesGet);
158
- const cc = new ThermostatSetpointCCCapabilitiesGet(this.applHost, {
156
+ const cc = new ThermostatSetpointCCCapabilitiesGet({
159
157
  nodeId: this.endpoint.nodeId,
160
- endpoint: this.endpoint.index,
158
+ endpointIndex: this.endpoint.index,
161
159
  setpointType,
162
160
  });
163
- const response = await this.applHost.sendCommand(cc, this.commandOptions);
161
+ const response = await this.host.sendCommand(cc, this.commandOptions);
164
162
  if (response) {
165
163
  return (0, safe_2.pick)(response, [
166
164
  "minValue",
@@ -177,11 +175,11 @@ let ThermostatSetpointCCAPI = class ThermostatSetpointCCAPI extends API_1.CCAPI
177
175
  */
178
176
  async getSupportedSetpointTypes() {
179
177
  this.assertSupportsCommand(_Types_1.ThermostatSetpointCommand, _Types_1.ThermostatSetpointCommand.SupportedGet);
180
- const cc = new ThermostatSetpointCCSupportedGet(this.applHost, {
178
+ const cc = new ThermostatSetpointCCSupportedGet({
181
179
  nodeId: this.endpoint.nodeId,
182
- endpoint: this.endpoint.index,
180
+ endpointIndex: this.endpoint.index,
183
181
  });
184
- const response = await this.applHost.sendCommand(cc, this.commandOptions);
182
+ const response = await this.host.sendCommand(cc, this.commandOptions);
185
183
  return response?.supportedSetpointTypes;
186
184
  }
187
185
  };
@@ -190,77 +188,42 @@ exports.ThermostatSetpointCCAPI = ThermostatSetpointCCAPI = __decorate([
190
188
  (0, CommandClassDecorators_1.API)(safe_1.CommandClasses["Thermostat Setpoint"])
191
189
  ], ThermostatSetpointCCAPI);
192
190
  let ThermostatSetpointCC = class ThermostatSetpointCC extends CommandClass_1.CommandClass {
193
- translatePropertyKey(applHost, property, propertyKey) {
191
+ translatePropertyKey(ctx, property, propertyKey) {
194
192
  if (property === "setpoint") {
195
193
  return (0, safe_2.getEnumMemberName)(_Types_1.ThermostatSetpointType, propertyKey);
196
194
  }
197
195
  else {
198
- return super.translatePropertyKey(applHost, property, propertyKey);
196
+ return super.translatePropertyKey(ctx, property, propertyKey);
199
197
  }
200
198
  }
201
- async interview(applHost) {
202
- const node = this.getNode(applHost);
203
- const endpoint = this.getEndpoint(applHost);
204
- const api = API_1.CCAPI.create(safe_1.CommandClasses["Thermostat Setpoint"], applHost, endpoint).withOptions({
199
+ async interview(ctx) {
200
+ const node = this.getNode(ctx);
201
+ const endpoint = this.getEndpoint(ctx);
202
+ const api = API_1.CCAPI.create(safe_1.CommandClasses["Thermostat Setpoint"], ctx, endpoint).withOptions({
205
203
  priority: safe_1.MessagePriority.NodeQuery,
206
204
  });
207
- applHost.controllerLog.logNode(node.id, {
205
+ ctx.logNode(node.id, {
208
206
  endpoint: this.endpointIndex,
209
207
  message: `Interviewing ${this.ccName}...`,
210
208
  direction: "none",
211
209
  });
212
- if (this.version <= 2) {
213
- let setpointTypes;
214
- let interpretation;
215
- // Whether our tests changed the assumed bitmask interpretation
216
- let interpretationChanged = false;
217
- // Query the supported setpoint types
218
- applHost.controllerLog.logNode(node.id, {
219
- endpoint: this.endpointIndex,
220
- message: "retrieving supported setpoint types...",
221
- direction: "outbound",
222
- });
223
- const resp = await api.getSupportedSetpointTypes();
224
- if (!resp) {
225
- applHost.controllerLog.logNode(node.id, {
226
- endpoint: this.endpointIndex,
227
- message: "Querying supported setpoint types timed out, skipping interview...",
228
- level: "warn",
229
- });
230
- return;
231
- }
232
- setpointTypes = [...resp];
233
- interpretation = undefined; // we don't know yet which interpretation the device uses
234
- // If necessary, test which interpretation the device follows
235
- // Assume interpretation B
236
- // --> If setpoints 3,4,5 or 6 are supported, the assumption is wrong ==> A
237
- function switchToInterpretationA() {
238
- setpointTypes = setpointTypes.map((i) => thermostatSetpointTypeMap[i]);
239
- interpretation = "A";
240
- interpretationChanged = true;
241
- }
242
- if ([3, 4, 5, 6].some((type) => setpointTypes.includes(type))) {
243
- applHost.controllerLog.logNode(node.id, {
244
- endpoint: this.endpointIndex,
245
- message: "uses Thermostat Setpoint bitmap interpretation A",
246
- direction: "none",
247
- });
248
- switchToInterpretationA();
249
- }
250
- else {
251
- applHost.controllerLog.logNode(node.id, {
252
- endpoint: this.endpointIndex,
253
- message: "Thermostat Setpoint bitmap interpretation is unknown, assuming B for now",
254
- direction: "none",
255
- });
256
- }
210
+ if (api.version <= 2) {
211
+ // It has been found that early implementations of this Command Class applied two non-interoperable
212
+ // interpretations of the bit mask advertising the support for specific Setpoint Types in the Thermostat
213
+ // Setpoint Supported Report Command.
214
+ // A controlling node SHOULD determine the supported Setpoint Types of a version 1 and version 2
215
+ // supporting node by sending one Thermostat Setpoint Get Command at a time while incrementing
216
+ // the requested Setpoint Type.
217
+ // If the same Setpoint Type is advertised in the returned Thermostat Setpoint Report Command, the
218
+ // controlling node MUST conclude that the actual Setpoint Type is supported.
219
+ // If the Setpoint Type 0x00 (type N/A) is advertised in the returned Thermostat Setpoint Report
220
+ // Command, the controlling node MUST conclude that the actual Setpoint Type is not supported.
257
221
  // Now scan all endpoints. Each type we received a value for gets marked as supported
258
222
  const supportedSetpointTypes = [];
259
- for (let i = 0; i < setpointTypes.length; i++) {
260
- const type = setpointTypes[i];
223
+ for (let type = _Types_1.ThermostatSetpointType.Heating; type <= _Types_1.ThermostatSetpointType["Full Power"]; type++) {
261
224
  const setpointName = (0, safe_2.getEnumMemberName)(_Types_1.ThermostatSetpointType, type);
262
225
  // Every time, query the current value
263
- applHost.controllerLog.logNode(node.id, {
226
+ ctx.logNode(node.id, {
264
227
  endpoint: this.endpointIndex,
265
228
  message: `querying current value of setpoint ${setpointName}...`,
266
229
  direction: "outbound",
@@ -274,48 +237,24 @@ let ThermostatSetpointCC = class ThermostatSetpointCC extends CommandClass_1.Com
274
237
  logMessage =
275
238
  `received current value of setpoint ${setpointName}: ${setpoint.value} ${setpoint.scale.unit ?? ""}`;
276
239
  }
277
- else if (!interpretation) {
278
- // The setpoint type is not supported, switch to interpretation A
279
- applHost.controllerLog.logNode(node.id, {
280
- endpoint: this.endpointIndex,
281
- message: `the setpoint type ${type} is unsupported, switching to interpretation A`,
282
- direction: "none",
283
- });
284
- switchToInterpretationA();
285
- // retry the current type and scan the remaining types as A
286
- i--;
287
- continue;
288
- }
289
240
  else {
290
241
  // We're sure about the interpretation - this should not happen
291
- logMessage = `Setpoint ${setpointName} is not supported`;
242
+ logMessage = `setpoint ${setpointName} is not supported`;
292
243
  }
293
- applHost.controllerLog.logNode(node.id, {
244
+ ctx.logNode(node.id, {
294
245
  endpoint: this.endpointIndex,
295
246
  message: logMessage,
296
247
  direction: "inbound",
297
248
  });
298
249
  }
299
- // If we made an assumption and did not switch to interpretation A,
300
- // the device adheres to interpretation B
301
- if (!interpretation && !interpretationChanged) {
302
- // our assumption about interpretation B was correct
303
- interpretation = "B";
304
- interpretationChanged = true;
305
- }
306
- // Remember which setpoint types are actually supported, so we don't
307
- // need to do this guesswork again
308
- this.setValue(applHost, exports.ThermostatSetpointCCValues.supportedSetpointTypes, supportedSetpointTypes);
309
- // Also save the bitmap interpretation if we know it now
310
- if (interpretationChanged) {
311
- this.setValue(applHost, exports.ThermostatSetpointCCValues.setpointTypesInterpretation, interpretation);
312
- }
250
+ // Remember which setpoint types are actually supported
251
+ this.setValue(ctx, exports.ThermostatSetpointCCValues.supportedSetpointTypes, supportedSetpointTypes);
313
252
  }
314
253
  else {
315
254
  // Versions >= 3 adhere to bitmap interpretation A, so we can rely on getSupportedSetpointTypes
316
255
  // Query the supported setpoint types
317
256
  let setpointTypes = [];
318
- applHost.controllerLog.logNode(node.id, {
257
+ ctx.logNode(node.id, {
319
258
  endpoint: this.endpointIndex,
320
259
  message: "retrieving supported setpoint types...",
321
260
  direction: "outbound",
@@ -328,14 +267,14 @@ let ThermostatSetpointCC = class ThermostatSetpointCC extends CommandClass_1.Com
328
267
  .map((type) => (0, safe_2.getEnumMemberName)(_Types_1.ThermostatSetpointType, type))
329
268
  .map((name) => `· ${name}`)
330
269
  .join("\n");
331
- applHost.controllerLog.logNode(node.id, {
270
+ ctx.logNode(node.id, {
332
271
  endpoint: this.endpointIndex,
333
272
  message: logMessage,
334
273
  direction: "inbound",
335
274
  });
336
275
  }
337
276
  else {
338
- applHost.controllerLog.logNode(node.id, {
277
+ ctx.logNode(node.id, {
339
278
  endpoint: this.endpointIndex,
340
279
  message: "Querying supported setpoint types timed out, skipping interview...",
341
280
  level: "warn",
@@ -345,7 +284,7 @@ let ThermostatSetpointCC = class ThermostatSetpointCC extends CommandClass_1.Com
345
284
  for (const type of setpointTypes) {
346
285
  const setpointName = (0, safe_2.getEnumMemberName)(_Types_1.ThermostatSetpointType, type);
347
286
  // Find out the capabilities of this setpoint
348
- applHost.controllerLog.logNode(node.id, {
287
+ ctx.logNode(node.id, {
349
288
  endpoint: this.endpointIndex,
350
289
  message: `retrieving capabilities for setpoint ${setpointName}...`,
351
290
  direction: "outbound",
@@ -357,7 +296,7 @@ let ThermostatSetpointCC = class ThermostatSetpointCC extends CommandClass_1.Com
357
296
  const logMessage = `received capabilities for setpoint ${setpointName}:
358
297
  minimum value: ${setpointCaps.minValue} ${minValueUnit}
359
298
  maximum value: ${setpointCaps.maxValue} ${maxValueUnit}`;
360
- applHost.controllerLog.logNode(node.id, {
299
+ ctx.logNode(node.id, {
361
300
  endpoint: this.endpointIndex,
362
301
  message: logMessage,
363
302
  direction: "inbound",
@@ -365,23 +304,23 @@ maximum value: ${setpointCaps.maxValue} ${maxValueUnit}`;
365
304
  }
366
305
  }
367
306
  // Query the current value for all setpoint types
368
- await this.refreshValues(applHost);
307
+ await this.refreshValues(ctx);
369
308
  }
370
309
  // Remember that the interview is complete
371
- this.setInterviewComplete(applHost, true);
310
+ this.setInterviewComplete(ctx, true);
372
311
  }
373
- async refreshValues(applHost) {
374
- const node = this.getNode(applHost);
375
- const endpoint = this.getEndpoint(applHost);
376
- const api = API_1.CCAPI.create(safe_1.CommandClasses["Thermostat Setpoint"], applHost, endpoint).withOptions({
312
+ async refreshValues(ctx) {
313
+ const node = this.getNode(ctx);
314
+ const endpoint = this.getEndpoint(ctx);
315
+ const api = API_1.CCAPI.create(safe_1.CommandClasses["Thermostat Setpoint"], ctx, endpoint).withOptions({
377
316
  priority: safe_1.MessagePriority.NodeQuery,
378
317
  });
379
- const setpointTypes = this.getValue(applHost, exports.ThermostatSetpointCCValues.supportedSetpointTypes) ?? [];
318
+ const setpointTypes = this.getValue(ctx, exports.ThermostatSetpointCCValues.supportedSetpointTypes) ?? [];
380
319
  // Query each setpoint's current value
381
320
  for (const type of setpointTypes) {
382
321
  const setpointName = (0, safe_2.getEnumMemberName)(_Types_1.ThermostatSetpointType, type);
383
322
  // Every time, query the current value
384
- applHost.controllerLog.logNode(node.id, {
323
+ ctx.logNode(node.id, {
385
324
  endpoint: this.endpointIndex,
386
325
  message: `querying current value of setpoint ${setpointName}...`,
387
326
  direction: "outbound",
@@ -389,7 +328,7 @@ maximum value: ${setpointCaps.maxValue} ${maxValueUnit}`;
389
328
  const setpoint = await api.get(type);
390
329
  if (setpoint) {
391
330
  const logMessage = `received current value of setpoint ${setpointName}: ${setpoint.value} ${setpoint.scale.unit ?? ""}`;
392
- applHost.controllerLog.logNode(node.id, {
331
+ ctx.logNode(node.id, {
393
332
  endpoint: this.endpointIndex,
394
333
  message: logMessage,
395
334
  direction: "inbound",
@@ -404,40 +343,42 @@ exports.ThermostatSetpointCC = ThermostatSetpointCC = __decorate([
404
343
  (0, CommandClassDecorators_1.implementedVersion)(3),
405
344
  (0, CommandClassDecorators_1.ccValues)(exports.ThermostatSetpointCCValues)
406
345
  ], ThermostatSetpointCC);
407
- let ThermostatSetpointCCSet = class ThermostatSetpointCCSet extends ThermostatSetpointCC {
408
- constructor(host, options) {
409
- super(host, options);
410
- if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
411
- (0, safe_1.validatePayload)(this.payload.length >= 1);
412
- this.setpointType = this.payload[0] & 0b1111;
413
- // parseFloatWithScale does its own validation
414
- const { value, scale } = (0, safe_1.parseFloatWithScale)(this.payload.subarray(1));
415
- this.value = value;
416
- this.scale = scale;
417
- }
418
- else {
419
- this.setpointType = options.setpointType;
420
- this.value = options.value;
421
- this.scale = options.scale;
422
- }
346
+ let ThermostatSetpointCCSet = ThermostatSetpointCCSet_1 = class ThermostatSetpointCCSet extends ThermostatSetpointCC {
347
+ constructor(options) {
348
+ super(options);
349
+ this.setpointType = options.setpointType;
350
+ this.value = options.value;
351
+ this.scale = options.scale;
352
+ }
353
+ static from(raw, ctx) {
354
+ (0, safe_1.validatePayload)(raw.payload.length >= 1);
355
+ const setpointType = raw.payload[0] & 0b1111;
356
+ // parseFloatWithScale does its own validation
357
+ const { value, scale } = (0, safe_1.parseFloatWithScale)(raw.payload.subarray(1));
358
+ return new ThermostatSetpointCCSet_1({
359
+ nodeId: ctx.sourceNodeId,
360
+ setpointType,
361
+ value,
362
+ scale,
363
+ });
423
364
  }
424
365
  setpointType;
425
366
  value;
426
367
  scale;
427
- serialize() {
368
+ serialize(ctx) {
428
369
  // If a config file overwrites how the float should be encoded, use that information
429
- const override = this.host.getDeviceConfig?.(this.nodeId)
370
+ const override = ctx.getDeviceConfig?.(this.nodeId)
430
371
  ?.compat?.overrideFloatEncoding;
431
372
  this.payload = Buffer.concat([
432
373
  Buffer.from([this.setpointType & 0b1111]),
433
374
  (0, safe_1.encodeFloatWithScale)(this.value, this.scale, override),
434
375
  ]);
435
- return super.serialize();
376
+ return super.serialize(ctx);
436
377
  }
437
- toLogEntry(host) {
378
+ toLogEntry(ctx) {
438
379
  const scale = getScale(this.scale);
439
380
  return {
440
- ...super.toLogEntry(host),
381
+ ...super.toLogEntry(ctx),
441
382
  message: {
442
383
  "setpoint type": (0, safe_2.getEnumMemberName)(_Types_1.ThermostatSetpointType, this.setpointType),
443
384
  value: `${this.value} ${scale.unit}`,
@@ -446,65 +387,70 @@ let ThermostatSetpointCCSet = class ThermostatSetpointCCSet extends ThermostatSe
446
387
  }
447
388
  };
448
389
  exports.ThermostatSetpointCCSet = ThermostatSetpointCCSet;
449
- exports.ThermostatSetpointCCSet = ThermostatSetpointCCSet = __decorate([
390
+ exports.ThermostatSetpointCCSet = ThermostatSetpointCCSet = ThermostatSetpointCCSet_1 = __decorate([
450
391
  (0, CommandClassDecorators_1.CCCommand)(_Types_1.ThermostatSetpointCommand.Set),
451
392
  (0, CommandClassDecorators_1.useSupervision)()
452
393
  ], ThermostatSetpointCCSet);
453
- let ThermostatSetpointCCReport = class ThermostatSetpointCCReport extends ThermostatSetpointCC {
454
- constructor(host, options) {
455
- super(host, options);
456
- if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
457
- (0, safe_1.validatePayload)(this.payload.length >= 1);
458
- this.type = this.payload[0] & 0b1111;
459
- if (this.type === 0) {
460
- // Not supported
461
- this.value = 0;
462
- this.scale = 0;
463
- return;
464
- }
465
- // parseFloatWithScale does its own validation
466
- const { value, scale } = (0, safe_1.parseFloatWithScale)(this.payload.subarray(1));
467
- this.value = value;
468
- this.scale = scale;
469
- }
470
- else {
471
- this.type = options.type;
472
- this.value = options.value;
473
- this.scale = options.scale;
394
+ let ThermostatSetpointCCReport = ThermostatSetpointCCReport_1 = class ThermostatSetpointCCReport extends ThermostatSetpointCC {
395
+ constructor(options) {
396
+ super(options);
397
+ this.type = options.type;
398
+ this.value = options.value;
399
+ this.scale = options.scale;
400
+ }
401
+ static from(raw, ctx) {
402
+ (0, safe_1.validatePayload)(raw.payload.length >= 1);
403
+ const type = raw.payload[0] & 0b1111;
404
+ if (type === 0) {
405
+ // Not supported
406
+ return new ThermostatSetpointCCReport_1({
407
+ nodeId: ctx.sourceNodeId,
408
+ type,
409
+ value: 0,
410
+ scale: 0,
411
+ });
474
412
  }
413
+ // parseFloatWithScale does its own validation
414
+ const { value, scale } = (0, safe_1.parseFloatWithScale)(raw.payload.subarray(1));
415
+ return new ThermostatSetpointCCReport_1({
416
+ nodeId: ctx.sourceNodeId,
417
+ type,
418
+ value,
419
+ scale,
420
+ });
475
421
  }
476
- persistValues(applHost) {
477
- if (!super.persistValues(applHost))
422
+ persistValues(ctx) {
423
+ if (!super.persistValues(ctx))
478
424
  return false;
479
425
  const scale = getScale(this.scale);
480
426
  const setpointValue = exports.ThermostatSetpointCCValues.setpoint(this.type);
481
- const existingMetadata = this.getMetadata(applHost, setpointValue);
427
+ const existingMetadata = this.getMetadata(ctx, setpointValue);
482
428
  // Update the metadata when it is missing or the unit has changed
483
429
  if (existingMetadata?.unit !== scale.unit) {
484
- this.setMetadata(applHost, setpointValue, {
430
+ this.setMetadata(ctx, setpointValue, {
485
431
  ...(existingMetadata ?? setpointValue.meta),
486
432
  unit: scale.unit,
487
433
  });
488
434
  }
489
- this.setValue(applHost, setpointValue, this.value);
435
+ this.setValue(ctx, setpointValue, this.value);
490
436
  // Remember the device-preferred setpoint scale so it can be used in SET commands
491
- this.setValue(applHost, exports.ThermostatSetpointCCValues.setpointScale(this.type), scale.key);
437
+ this.setValue(ctx, exports.ThermostatSetpointCCValues.setpointScale(this.type), scale.key);
492
438
  return true;
493
439
  }
494
440
  type;
495
441
  scale;
496
442
  value;
497
- serialize() {
443
+ serialize(ctx) {
498
444
  this.payload = Buffer.concat([
499
445
  Buffer.from([this.type & 0b1111]),
500
446
  (0, safe_1.encodeFloatWithScale)(this.value, this.scale),
501
447
  ]);
502
- return super.serialize();
448
+ return super.serialize(ctx);
503
449
  }
504
- toLogEntry(host) {
450
+ toLogEntry(ctx) {
505
451
  const scale = getScale(this.scale);
506
452
  return {
507
- ...super.toLogEntry(host),
453
+ ...super.toLogEntry(ctx),
508
454
  message: {
509
455
  "setpoint type": (0, safe_2.getEnumMemberName)(_Types_1.ThermostatSetpointType, this.type),
510
456
  value: `${this.value} ${scale.unit}`,
@@ -513,32 +459,34 @@ let ThermostatSetpointCCReport = class ThermostatSetpointCCReport extends Thermo
513
459
  }
514
460
  };
515
461
  exports.ThermostatSetpointCCReport = ThermostatSetpointCCReport;
516
- exports.ThermostatSetpointCCReport = ThermostatSetpointCCReport = __decorate([
462
+ exports.ThermostatSetpointCCReport = ThermostatSetpointCCReport = ThermostatSetpointCCReport_1 = __decorate([
517
463
  (0, CommandClassDecorators_1.CCCommand)(_Types_1.ThermostatSetpointCommand.Report)
518
464
  ], ThermostatSetpointCCReport);
519
465
  function testResponseForThermostatSetpointGet(sent, received) {
520
466
  // We expect a Thermostat Setpoint Report that matches the requested setpoint type
521
467
  return received.type === sent.setpointType;
522
468
  }
523
- let ThermostatSetpointCCGet = class ThermostatSetpointCCGet extends ThermostatSetpointCC {
524
- constructor(host, options) {
525
- super(host, options);
526
- if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
527
- (0, safe_1.validatePayload)(this.payload.length >= 1);
528
- this.setpointType = this.payload[0] & 0b1111;
529
- }
530
- else {
531
- this.setpointType = options.setpointType;
532
- }
469
+ let ThermostatSetpointCCGet = ThermostatSetpointCCGet_1 = class ThermostatSetpointCCGet extends ThermostatSetpointCC {
470
+ constructor(options) {
471
+ super(options);
472
+ this.setpointType = options.setpointType;
473
+ }
474
+ static from(raw, ctx) {
475
+ (0, safe_1.validatePayload)(raw.payload.length >= 1);
476
+ const setpointType = raw.payload[0] & 0b1111;
477
+ return new ThermostatSetpointCCGet_1({
478
+ nodeId: ctx.sourceNodeId,
479
+ setpointType,
480
+ });
533
481
  }
534
482
  setpointType;
535
- serialize() {
483
+ serialize(ctx) {
536
484
  this.payload = Buffer.from([this.setpointType & 0b1111]);
537
- return super.serialize();
485
+ return super.serialize(ctx);
538
486
  }
539
- toLogEntry(host) {
487
+ toLogEntry(ctx) {
540
488
  return {
541
- ...super.toLogEntry(host),
489
+ ...super.toLogEntry(ctx),
542
490
  message: {
543
491
  "setpoint type": (0, safe_2.getEnumMemberName)(_Types_1.ThermostatSetpointType, this.setpointType),
544
492
  },
@@ -546,40 +494,40 @@ let ThermostatSetpointCCGet = class ThermostatSetpointCCGet extends ThermostatSe
546
494
  }
547
495
  };
548
496
  exports.ThermostatSetpointCCGet = ThermostatSetpointCCGet;
549
- exports.ThermostatSetpointCCGet = ThermostatSetpointCCGet = __decorate([
497
+ exports.ThermostatSetpointCCGet = ThermostatSetpointCCGet = ThermostatSetpointCCGet_1 = __decorate([
550
498
  (0, CommandClassDecorators_1.CCCommand)(_Types_1.ThermostatSetpointCommand.Get),
551
499
  (0, CommandClassDecorators_1.expectedCCResponse)(ThermostatSetpointCCReport, testResponseForThermostatSetpointGet)
552
500
  ], ThermostatSetpointCCGet);
553
- let ThermostatSetpointCCCapabilitiesReport = class ThermostatSetpointCCCapabilitiesReport extends ThermostatSetpointCC {
554
- constructor(host, options) {
555
- super(host, options);
556
- if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
557
- (0, safe_1.validatePayload)(this.payload.length >= 1);
558
- this.type = this.payload[0];
559
- let bytesRead;
560
- // parseFloatWithScale does its own validation
561
- ({
562
- value: this.minValue,
563
- scale: this.minValueScale,
564
- bytesRead,
565
- } = (0, safe_1.parseFloatWithScale)(this.payload.subarray(1)));
566
- ({ value: this.maxValue, scale: this.maxValueScale } =
567
- (0, safe_1.parseFloatWithScale)(this.payload.subarray(1 + bytesRead)));
568
- }
569
- else {
570
- this.type = options.type;
571
- this.minValue = options.minValue;
572
- this.minValueScale = options.minValueScale;
573
- this.maxValue = options.maxValue;
574
- this.maxValueScale = options.maxValueScale;
575
- }
501
+ let ThermostatSetpointCCCapabilitiesReport = ThermostatSetpointCCCapabilitiesReport_1 = class ThermostatSetpointCCCapabilitiesReport extends ThermostatSetpointCC {
502
+ constructor(options) {
503
+ super(options);
504
+ this.type = options.type;
505
+ this.minValue = options.minValue;
506
+ this.minValueScale = options.minValueScale;
507
+ this.maxValue = options.maxValue;
508
+ this.maxValueScale = options.maxValueScale;
509
+ }
510
+ static from(raw, ctx) {
511
+ (0, safe_1.validatePayload)(raw.payload.length >= 1);
512
+ const type = raw.payload[0];
513
+ // parseFloatWithScale does its own validation
514
+ const { value: minValue, scale: minValueScale, bytesRead, } = (0, safe_1.parseFloatWithScale)(raw.payload.subarray(1));
515
+ const { value: maxValue, scale: maxValueScale } = (0, safe_1.parseFloatWithScale)(raw.payload.subarray(1 + bytesRead));
516
+ return new ThermostatSetpointCCCapabilitiesReport_1({
517
+ nodeId: ctx.sourceNodeId,
518
+ type,
519
+ minValue,
520
+ minValueScale,
521
+ maxValue,
522
+ maxValueScale,
523
+ });
576
524
  }
577
- persistValues(applHost) {
578
- if (!super.persistValues(applHost))
525
+ persistValues(ctx) {
526
+ if (!super.persistValues(ctx))
579
527
  return false;
580
528
  // Predefine the metadata
581
529
  const setpointValue = exports.ThermostatSetpointCCValues.setpoint(this.type);
582
- this.setMetadata(applHost, setpointValue, {
530
+ this.setMetadata(ctx, setpointValue, {
583
531
  ...setpointValue.meta,
584
532
  min: this.minValue,
585
533
  max: this.maxValue,
@@ -593,17 +541,17 @@ let ThermostatSetpointCCCapabilitiesReport = class ThermostatSetpointCCCapabilit
593
541
  maxValue;
594
542
  minValueScale;
595
543
  maxValueScale;
596
- serialize() {
544
+ serialize(ctx) {
597
545
  const min = (0, safe_1.encodeFloatWithScale)(this.minValue, this.minValueScale);
598
546
  const max = (0, safe_1.encodeFloatWithScale)(this.maxValue, this.maxValueScale);
599
547
  this.payload = Buffer.concat([Buffer.from([this.type]), min, max]);
600
- return super.serialize();
548
+ return super.serialize(ctx);
601
549
  }
602
- toLogEntry(host) {
550
+ toLogEntry(ctx) {
603
551
  const minValueScale = getScale(this.minValueScale);
604
552
  const maxValueScale = getScale(this.maxValueScale);
605
553
  return {
606
- ...super.toLogEntry(host),
554
+ ...super.toLogEntry(ctx),
607
555
  message: {
608
556
  "setpoint type": (0, safe_2.getEnumMemberName)(_Types_1.ThermostatSetpointType, this.type),
609
557
  "min value": `${this.minValue} ${minValueScale.unit}`,
@@ -613,28 +561,30 @@ let ThermostatSetpointCCCapabilitiesReport = class ThermostatSetpointCCCapabilit
613
561
  }
614
562
  };
615
563
  exports.ThermostatSetpointCCCapabilitiesReport = ThermostatSetpointCCCapabilitiesReport;
616
- exports.ThermostatSetpointCCCapabilitiesReport = ThermostatSetpointCCCapabilitiesReport = __decorate([
564
+ exports.ThermostatSetpointCCCapabilitiesReport = ThermostatSetpointCCCapabilitiesReport = ThermostatSetpointCCCapabilitiesReport_1 = __decorate([
617
565
  (0, CommandClassDecorators_1.CCCommand)(_Types_1.ThermostatSetpointCommand.CapabilitiesReport)
618
566
  ], ThermostatSetpointCCCapabilitiesReport);
619
- let ThermostatSetpointCCCapabilitiesGet = class ThermostatSetpointCCCapabilitiesGet extends ThermostatSetpointCC {
620
- constructor(host, options) {
621
- super(host, options);
622
- if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
623
- (0, safe_1.validatePayload)(this.payload.length >= 1);
624
- this.setpointType = this.payload[0] & 0b1111;
625
- }
626
- else {
627
- this.setpointType = options.setpointType;
628
- }
567
+ let ThermostatSetpointCCCapabilitiesGet = ThermostatSetpointCCCapabilitiesGet_1 = class ThermostatSetpointCCCapabilitiesGet extends ThermostatSetpointCC {
568
+ constructor(options) {
569
+ super(options);
570
+ this.setpointType = options.setpointType;
571
+ }
572
+ static from(raw, ctx) {
573
+ (0, safe_1.validatePayload)(raw.payload.length >= 1);
574
+ const setpointType = raw.payload[0] & 0b1111;
575
+ return new ThermostatSetpointCCCapabilitiesGet_1({
576
+ nodeId: ctx.sourceNodeId,
577
+ setpointType,
578
+ });
629
579
  }
630
580
  setpointType;
631
- serialize() {
581
+ serialize(ctx) {
632
582
  this.payload = Buffer.from([this.setpointType & 0b1111]);
633
- return super.serialize();
583
+ return super.serialize(ctx);
634
584
  }
635
- toLogEntry(host) {
585
+ toLogEntry(ctx) {
636
586
  return {
637
- ...super.toLogEntry(host),
587
+ ...super.toLogEntry(ctx),
638
588
  message: {
639
589
  "setpoint type": (0, safe_2.getEnumMemberName)(_Types_1.ThermostatSetpointType, this.setpointType),
640
590
  },
@@ -642,56 +592,42 @@ let ThermostatSetpointCCCapabilitiesGet = class ThermostatSetpointCCCapabilities
642
592
  }
643
593
  };
644
594
  exports.ThermostatSetpointCCCapabilitiesGet = ThermostatSetpointCCCapabilitiesGet;
645
- exports.ThermostatSetpointCCCapabilitiesGet = ThermostatSetpointCCCapabilitiesGet = __decorate([
595
+ exports.ThermostatSetpointCCCapabilitiesGet = ThermostatSetpointCCCapabilitiesGet = ThermostatSetpointCCCapabilitiesGet_1 = __decorate([
646
596
  (0, CommandClassDecorators_1.CCCommand)(_Types_1.ThermostatSetpointCommand.CapabilitiesGet),
647
597
  (0, CommandClassDecorators_1.expectedCCResponse)(ThermostatSetpointCCCapabilitiesReport)
648
598
  ], ThermostatSetpointCCCapabilitiesGet);
649
- let ThermostatSetpointCCSupportedReport = class ThermostatSetpointCCSupportedReport extends ThermostatSetpointCC {
650
- constructor(host, options) {
651
- super(host, options);
652
- if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
653
- (0, safe_1.validatePayload)(this.payload.length >= 1);
654
- const bitMask = this.payload;
655
- const supported = (0, safe_1.parseBitMask)(bitMask, _Types_1.ThermostatSetpointType["N/A"]);
656
- if (this.version >= 3) {
657
- // Interpretation A
658
- this.supportedSetpointTypes = supported.map((i) => thermostatSetpointTypeMap[i]);
659
- }
660
- else {
661
- // It is unknown which interpretation the device complies to.
662
- // This must be tested during the interview
663
- this.supportedSetpointTypes = supported;
664
- }
665
- // TODO:
666
- // Some devices skip the gaps in the ThermostatSetpointType (Interpretation A), some don't (Interpretation B)
667
- // Devices with V3+ must comply with Interpretation A
668
- // It is RECOMMENDED that a controlling node determines supported Setpoint Types
669
- // by sending one Thermostat Setpoint Get Command at a time while incrementing
670
- // the requested Setpoint Type. If the same Setpoint Type is advertised in the
671
- // resulting Thermostat Setpoint Report Command, the controlling node MAY conclude
672
- // that the actual Setpoint Type is supported. If the Setpoint Type 0x00 (type N/A)
673
- // is advertised in the resulting Thermostat Setpoint Report Command, the controlling
674
- // node MUST conclude that the actual Setpoint Type is not supported.
675
- }
676
- else {
677
- if (options.supportedSetpointTypes.length === 0) {
678
- throw new safe_1.ZWaveError(`At least one setpoint type must be supported`, safe_1.ZWaveErrorCodes.Argument_Invalid);
679
- }
680
- this.supportedSetpointTypes = options.supportedSetpointTypes;
599
+ let ThermostatSetpointCCSupportedReport = ThermostatSetpointCCSupportedReport_1 = class ThermostatSetpointCCSupportedReport extends ThermostatSetpointCC {
600
+ constructor(options) {
601
+ super(options);
602
+ if (options.supportedSetpointTypes.length === 0) {
603
+ throw new safe_1.ZWaveError(`At least one setpoint type must be supported`, safe_1.ZWaveErrorCodes.Argument_Invalid);
681
604
  }
605
+ this.supportedSetpointTypes = options.supportedSetpointTypes;
606
+ }
607
+ static from(raw, ctx) {
608
+ (0, safe_1.validatePayload)(raw.payload.length >= 1);
609
+ const bitMask = raw.payload;
610
+ const supported = (0, safe_1.parseBitMask)(bitMask, _Types_1.ThermostatSetpointType["N/A"]);
611
+ // We use this command only when we are sure that bitmask interpretation A is used
612
+ // FIXME: Figure out if we can do this without the CC version
613
+ const supportedSetpointTypes = supported.map((i) => thermostatSetpointTypeMap[i]);
614
+ return new ThermostatSetpointCCSupportedReport_1({
615
+ nodeId: ctx.sourceNodeId,
616
+ supportedSetpointTypes,
617
+ });
682
618
  }
683
619
  supportedSetpointTypes;
684
- serialize() {
620
+ serialize(ctx) {
685
621
  this.payload = (0, safe_1.encodeBitMask)(
686
622
  // Encode as interpretation A
687
623
  this.supportedSetpointTypes
688
624
  .map((t) => thermostatSetpointTypeMap.indexOf(t))
689
625
  .filter((t) => t !== -1), undefined, _Types_1.ThermostatSetpointType["N/A"]);
690
- return super.serialize();
626
+ return super.serialize(ctx);
691
627
  }
692
- toLogEntry(host) {
628
+ toLogEntry(ctx) {
693
629
  return {
694
- ...super.toLogEntry(host),
630
+ ...super.toLogEntry(ctx),
695
631
  message: {
696
632
  "supported setpoint types": this.supportedSetpointTypes
697
633
  .map((t) => `\n· ${(0, safe_2.getEnumMemberName)(_Types_1.ThermostatSetpointType, t)}`)
@@ -704,7 +640,7 @@ exports.ThermostatSetpointCCSupportedReport = ThermostatSetpointCCSupportedRepor
704
640
  __decorate([
705
641
  (0, CommandClassDecorators_1.ccValue)(exports.ThermostatSetpointCCValues.supportedSetpointTypes)
706
642
  ], ThermostatSetpointCCSupportedReport.prototype, "supportedSetpointTypes", void 0);
707
- exports.ThermostatSetpointCCSupportedReport = ThermostatSetpointCCSupportedReport = __decorate([
643
+ exports.ThermostatSetpointCCSupportedReport = ThermostatSetpointCCSupportedReport = ThermostatSetpointCCSupportedReport_1 = __decorate([
708
644
  (0, CommandClassDecorators_1.CCCommand)(_Types_1.ThermostatSetpointCommand.SupportedReport)
709
645
  ], ThermostatSetpointCCSupportedReport);
710
646
  let ThermostatSetpointCCSupportedGet = class ThermostatSetpointCCSupportedGet extends ThermostatSetpointCC {