@zwave-js/cc 15.27.1 → 15.29.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 (327) hide show
  1. package/build/cjs/cc/AlarmSensorCC.js.map +2 -2
  2. package/build/cjs/cc/AssociationCC.js +6 -5
  3. package/build/cjs/cc/AssociationCC.js.map +2 -2
  4. package/build/cjs/cc/AssociationGroupInfoCC.js +5 -5
  5. package/build/cjs/cc/AssociationGroupInfoCC.js.map +2 -2
  6. package/build/cjs/cc/BarrierOperatorCC.js.map +2 -2
  7. package/build/cjs/cc/BasicCC.d.ts +4 -1
  8. package/build/cjs/cc/BasicCC.js +18 -0
  9. package/build/cjs/cc/BasicCC.js.map +3 -3
  10. package/build/cjs/cc/BasicWindowCoveringCC.js.map +2 -2
  11. package/build/cjs/cc/BatteryCC.js +18 -4
  12. package/build/cjs/cc/BatteryCC.js.map +2 -2
  13. package/build/cjs/cc/BinarySensorCC.js +5 -1
  14. package/build/cjs/cc/BinarySensorCC.js.map +2 -2
  15. package/build/cjs/cc/BinarySwitchCC.d.ts +4 -1
  16. package/build/cjs/cc/BinarySwitchCC.js +18 -0
  17. package/build/cjs/cc/BinarySwitchCC.js.map +3 -3
  18. package/build/cjs/cc/CRC16CC.d.ts +3 -2
  19. package/build/cjs/cc/CRC16CC.js +7 -1
  20. package/build/cjs/cc/CRC16CC.js.map +3 -3
  21. package/build/cjs/cc/CentralSceneCC.js.map +2 -2
  22. package/build/cjs/cc/ClimateControlScheduleCC.js.map +2 -2
  23. package/build/cjs/cc/ClockCC.js.map +2 -2
  24. package/build/cjs/cc/ColorSwitchCC.js +1 -4
  25. package/build/cjs/cc/ColorSwitchCC.js.map +2 -2
  26. package/build/cjs/cc/ConfigurationCC.js +16 -8
  27. package/build/cjs/cc/ConfigurationCC.js.map +2 -2
  28. package/build/cjs/cc/DeviceResetLocallyCC.js.map +2 -2
  29. package/build/cjs/cc/DoorLockCC.js +1 -1
  30. package/build/cjs/cc/DoorLockCC.js.map +2 -2
  31. package/build/cjs/cc/EntryControlCC.js.map +2 -2
  32. package/build/cjs/cc/FirmwareUpdateMetaDataCC.js +4 -16
  33. package/build/cjs/cc/FirmwareUpdateMetaDataCC.js.map +2 -2
  34. package/build/cjs/cc/HumidityControlSetpointCC.js +10 -4
  35. package/build/cjs/cc/HumidityControlSetpointCC.js.map +2 -2
  36. package/build/cjs/cc/IndicatorCC.js +5 -8
  37. package/build/cjs/cc/IndicatorCC.js.map +2 -2
  38. package/build/cjs/cc/IrrigationCC.js.map +2 -2
  39. package/build/cjs/cc/ManufacturerProprietaryCC.js.map +2 -2
  40. package/build/cjs/cc/ManufacturerSpecificCC._validateArgs.d.ts +1 -0
  41. package/build/cjs/cc/ManufacturerSpecificCC._validateArgs.js +13 -0
  42. package/build/cjs/cc/ManufacturerSpecificCC._validateArgs.js.map +2 -2
  43. package/build/cjs/cc/ManufacturerSpecificCC.d.ts +6 -4
  44. package/build/cjs/cc/ManufacturerSpecificCC.js +41 -8
  45. package/build/cjs/cc/ManufacturerSpecificCC.js.map +2 -2
  46. package/build/cjs/cc/MeterCC.js +18 -29
  47. package/build/cjs/cc/MeterCC.js.map +2 -2
  48. package/build/cjs/cc/MultiChannelAssociationCC.js +11 -7
  49. package/build/cjs/cc/MultiChannelAssociationCC.js.map +2 -2
  50. package/build/cjs/cc/MultiChannelCC.d.ts +3 -1
  51. package/build/cjs/cc/MultiChannelCC.js +21 -10
  52. package/build/cjs/cc/MultiChannelCC.js.map +3 -3
  53. package/build/cjs/cc/MultilevelSensorCC.js.map +2 -2
  54. package/build/cjs/cc/MultilevelSwitchCC.d.ts +5 -1
  55. package/build/cjs/cc/MultilevelSwitchCC.js +30 -0
  56. package/build/cjs/cc/MultilevelSwitchCC.js.map +3 -3
  57. package/build/cjs/cc/NotificationCC.js +29 -11
  58. package/build/cjs/cc/NotificationCC.js.map +2 -2
  59. package/build/cjs/cc/PowerlevelCC.js.map +1 -1
  60. package/build/cjs/cc/ProtectionCC.js +2 -0
  61. package/build/cjs/cc/ProtectionCC.js.map +2 -2
  62. package/build/cjs/cc/SceneActuatorConfigurationCC.js.map +2 -2
  63. package/build/cjs/cc/SceneControllerConfigurationCC.js.map +2 -2
  64. package/build/cjs/cc/ScheduleEntryLockCC.js.map +2 -2
  65. package/build/cjs/cc/Security2CC.d.ts +2 -1
  66. package/build/cjs/cc/Security2CC.js +31 -3
  67. package/build/cjs/cc/Security2CC.js.map +2 -2
  68. package/build/cjs/cc/SecurityCC.d.ts +3 -2
  69. package/build/cjs/cc/SecurityCC.js +7 -6
  70. package/build/cjs/cc/SecurityCC.js.map +2 -2
  71. package/build/cjs/cc/SoundSwitchCC.js +6 -6
  72. package/build/cjs/cc/SoundSwitchCC.js.map +2 -2
  73. package/build/cjs/cc/SupervisionCC.d.ts +2 -1
  74. package/build/cjs/cc/SupervisionCC.js +6 -0
  75. package/build/cjs/cc/SupervisionCC.js.map +3 -3
  76. package/build/cjs/cc/ThermostatFanModeCC.js.map +2 -2
  77. package/build/cjs/cc/ThermostatModeCC.js +1 -3
  78. package/build/cjs/cc/ThermostatModeCC.js.map +2 -2
  79. package/build/cjs/cc/ThermostatOperatingStateCC.js.map +2 -2
  80. package/build/cjs/cc/ThermostatSetpointCC.d.ts +4 -1
  81. package/build/cjs/cc/ThermostatSetpointCC.js +18 -0
  82. package/build/cjs/cc/ThermostatSetpointCC.js.map +3 -3
  83. package/build/cjs/cc/TimeCC.js.map +2 -2
  84. package/build/cjs/cc/TransportServiceCC.js.map +2 -2
  85. package/build/cjs/cc/UserCodeCC.js +3 -6
  86. package/build/cjs/cc/UserCodeCC.js.map +2 -2
  87. package/build/cjs/cc/UserCredentialCC.js +8 -6
  88. package/build/cjs/cc/UserCredentialCC.js.map +2 -2
  89. package/build/cjs/cc/VersionCC.js.map +2 -2
  90. package/build/cjs/cc/WindowCoveringCC.js +5 -1
  91. package/build/cjs/cc/WindowCoveringCC.js.map +2 -2
  92. package/build/cjs/cc/ZWaveProtocolCC.js +3 -11
  93. package/build/cjs/cc/ZWaveProtocolCC.js.map +2 -2
  94. package/build/cjs/cc/_CCValues.generated.d.ts +4 -4
  95. package/build/cjs/cc/_CCValues.generated.js +1 -1
  96. package/build/cjs/cc/_CCValues.generated.js.map +2 -2
  97. package/build/cjs/cc/index.d.ts +179 -179
  98. package/build/cjs/cc/index.js.map +1 -1
  99. package/build/cjs/cc/manufacturerProprietary/Decorators.js.map +2 -2
  100. package/build/cjs/lib/API.d.ts +3 -2
  101. package/build/cjs/lib/API.js.map +2 -2
  102. package/build/cjs/lib/CommandClass.d.ts +23 -1
  103. package/build/cjs/lib/CommandClass.js +63 -15
  104. package/build/cjs/lib/CommandClass.js.map +3 -3
  105. package/build/cjs/lib/CommandClassDecorators.js.map +2 -2
  106. package/build/cjs/lib/EncapsulatingCommandClass.js.map +2 -2
  107. package/build/cjs/lib/NotificationEventPayload.js.map +2 -2
  108. package/build/cjs/lib/Security2/Extension.js +1 -4
  109. package/build/cjs/lib/Security2/Extension.js.map +2 -2
  110. package/build/cjs/lib/Security2/shared.js.map +2 -2
  111. package/build/cjs/lib/SetValueResult.js.map +1 -1
  112. package/build/cjs/lib/Values.d.ts +1 -1
  113. package/build/cjs/lib/Values.js.map +2 -2
  114. package/build/cjs/lib/_CCAPI.generated.js.map +1 -1
  115. package/build/cjs/lib/_Types.d.ts +34 -30
  116. package/build/cjs/lib/_Types.js +7 -0
  117. package/build/cjs/lib/_Types.js.map +3 -3
  118. package/build/cjs/lib/serializers.js +1 -4
  119. package/build/cjs/lib/serializers.js.map +2 -2
  120. package/build/cjs/lib/utils.js.map +2 -2
  121. package/build/esm/cc/AlarmSensorCC.d.ts.map +1 -1
  122. package/build/esm/cc/AlarmSensorCC.js +1 -2
  123. package/build/esm/cc/AlarmSensorCC.js.map +1 -1
  124. package/build/esm/cc/AssociationCC.d.ts.map +1 -1
  125. package/build/esm/cc/AssociationCC.js +8 -7
  126. package/build/esm/cc/AssociationCC.js.map +1 -1
  127. package/build/esm/cc/AssociationGroupInfoCC.d.ts.map +1 -1
  128. package/build/esm/cc/AssociationGroupInfoCC.js +11 -12
  129. package/build/esm/cc/AssociationGroupInfoCC.js.map +1 -1
  130. package/build/esm/cc/BarrierOperatorCC.d.ts.map +1 -1
  131. package/build/esm/cc/BarrierOperatorCC.js +10 -9
  132. package/build/esm/cc/BarrierOperatorCC.js.map +1 -1
  133. package/build/esm/cc/BasicCC.d.ts +4 -1
  134. package/build/esm/cc/BasicCC.d.ts.map +1 -1
  135. package/build/esm/cc/BasicCC.js +30 -7
  136. package/build/esm/cc/BasicCC.js.map +1 -1
  137. package/build/esm/cc/BasicWindowCoveringCC.d.ts.map +1 -1
  138. package/build/esm/cc/BasicWindowCoveringCC.js +2 -5
  139. package/build/esm/cc/BasicWindowCoveringCC.js.map +1 -1
  140. package/build/esm/cc/BatteryCC.d.ts.map +1 -1
  141. package/build/esm/cc/BatteryCC.js +17 -14
  142. package/build/esm/cc/BatteryCC.js.map +1 -1
  143. package/build/esm/cc/BinarySensorCC.d.ts.map +1 -1
  144. package/build/esm/cc/BinarySensorCC.js +12 -7
  145. package/build/esm/cc/BinarySensorCC.js.map +1 -1
  146. package/build/esm/cc/BinarySwitchCC.d.ts +4 -1
  147. package/build/esm/cc/BinarySwitchCC.d.ts.map +1 -1
  148. package/build/esm/cc/BinarySwitchCC.js +31 -6
  149. package/build/esm/cc/BinarySwitchCC.js.map +1 -1
  150. package/build/esm/cc/CRC16CC.d.ts +3 -2
  151. package/build/esm/cc/CRC16CC.d.ts.map +1 -1
  152. package/build/esm/cc/CRC16CC.js +10 -4
  153. package/build/esm/cc/CRC16CC.js.map +1 -1
  154. package/build/esm/cc/CentralSceneCC.d.ts.map +1 -1
  155. package/build/esm/cc/CentralSceneCC.js +2 -1
  156. package/build/esm/cc/CentralSceneCC.js.map +1 -1
  157. package/build/esm/cc/ClimateControlScheduleCC.d.ts.map +1 -1
  158. package/build/esm/cc/ClimateControlScheduleCC.js +6 -2
  159. package/build/esm/cc/ClimateControlScheduleCC.js.map +1 -1
  160. package/build/esm/cc/ClockCC.d.ts.map +1 -1
  161. package/build/esm/cc/ClockCC.js +6 -2
  162. package/build/esm/cc/ClockCC.js.map +1 -1
  163. package/build/esm/cc/ColorSwitchCC.d.ts.map +1 -1
  164. package/build/esm/cc/ColorSwitchCC.js +17 -20
  165. package/build/esm/cc/ColorSwitchCC.js.map +1 -1
  166. package/build/esm/cc/ConfigurationCC.d.ts.map +1 -1
  167. package/build/esm/cc/ConfigurationCC.js +37 -33
  168. package/build/esm/cc/ConfigurationCC.js.map +1 -1
  169. package/build/esm/cc/DeviceResetLocallyCC.d.ts.map +1 -1
  170. package/build/esm/cc/DeviceResetLocallyCC.js +1 -2
  171. package/build/esm/cc/DeviceResetLocallyCC.js.map +1 -1
  172. package/build/esm/cc/DoorLockCC.d.ts.map +1 -1
  173. package/build/esm/cc/DoorLockCC.js +26 -30
  174. package/build/esm/cc/DoorLockCC.js.map +1 -1
  175. package/build/esm/cc/EntryControlCC.d.ts.map +1 -1
  176. package/build/esm/cc/EntryControlCC.js +10 -7
  177. package/build/esm/cc/EntryControlCC.js.map +1 -1
  178. package/build/esm/cc/FirmwareUpdateMetaDataCC.d.ts.map +1 -1
  179. package/build/esm/cc/FirmwareUpdateMetaDataCC.js +15 -27
  180. package/build/esm/cc/FirmwareUpdateMetaDataCC.js.map +1 -1
  181. package/build/esm/cc/HumidityControlSetpointCC.d.ts.map +1 -1
  182. package/build/esm/cc/HumidityControlSetpointCC.js +8 -9
  183. package/build/esm/cc/HumidityControlSetpointCC.js.map +1 -1
  184. package/build/esm/cc/IndicatorCC.d.ts.map +1 -1
  185. package/build/esm/cc/IndicatorCC.js +27 -42
  186. package/build/esm/cc/IndicatorCC.js.map +1 -1
  187. package/build/esm/cc/IrrigationCC.d.ts.map +1 -1
  188. package/build/esm/cc/IrrigationCC.js +8 -6
  189. package/build/esm/cc/IrrigationCC.js.map +1 -1
  190. package/build/esm/cc/ManufacturerProprietaryCC.d.ts.map +1 -1
  191. package/build/esm/cc/ManufacturerProprietaryCC.js +1 -2
  192. package/build/esm/cc/ManufacturerProprietaryCC.js.map +1 -1
  193. package/build/esm/cc/ManufacturerSpecificCC._validateArgs.d.ts +1 -0
  194. package/build/esm/cc/ManufacturerSpecificCC._validateArgs.d.ts.map +1 -1
  195. package/build/esm/cc/ManufacturerSpecificCC._validateArgs.js +10 -0
  196. package/build/esm/cc/ManufacturerSpecificCC._validateArgs.js.map +1 -1
  197. package/build/esm/cc/ManufacturerSpecificCC.d.ts +6 -4
  198. package/build/esm/cc/ManufacturerSpecificCC.d.ts.map +1 -1
  199. package/build/esm/cc/ManufacturerSpecificCC.js +54 -17
  200. package/build/esm/cc/ManufacturerSpecificCC.js.map +1 -1
  201. package/build/esm/cc/MeterCC.d.ts.map +1 -1
  202. package/build/esm/cc/MeterCC.js +28 -38
  203. package/build/esm/cc/MeterCC.js.map +1 -1
  204. package/build/esm/cc/MultiChannelAssociationCC.d.ts.map +1 -1
  205. package/build/esm/cc/MultiChannelAssociationCC.js +15 -20
  206. package/build/esm/cc/MultiChannelAssociationCC.js.map +1 -1
  207. package/build/esm/cc/MultiChannelCC.d.ts +3 -1
  208. package/build/esm/cc/MultiChannelCC.d.ts.map +1 -1
  209. package/build/esm/cc/MultiChannelCC.js +28 -22
  210. package/build/esm/cc/MultiChannelCC.js.map +1 -1
  211. package/build/esm/cc/MultilevelSensorCC.d.ts.map +1 -1
  212. package/build/esm/cc/MultilevelSensorCC.js +11 -11
  213. package/build/esm/cc/MultilevelSensorCC.js.map +1 -1
  214. package/build/esm/cc/MultilevelSwitchCC.d.ts +5 -1
  215. package/build/esm/cc/MultilevelSwitchCC.d.ts.map +1 -1
  216. package/build/esm/cc/MultilevelSwitchCC.js +56 -16
  217. package/build/esm/cc/MultilevelSwitchCC.js.map +1 -1
  218. package/build/esm/cc/NotificationCC.d.ts.map +1 -1
  219. package/build/esm/cc/NotificationCC.js +66 -55
  220. package/build/esm/cc/NotificationCC.js.map +1 -1
  221. package/build/esm/cc/PowerlevelCC.d.ts.map +1 -1
  222. package/build/esm/cc/ProtectionCC.d.ts.map +1 -1
  223. package/build/esm/cc/ProtectionCC.js +13 -9
  224. package/build/esm/cc/ProtectionCC.js.map +1 -1
  225. package/build/esm/cc/SceneActuatorConfigurationCC.d.ts.map +1 -1
  226. package/build/esm/cc/SceneActuatorConfigurationCC.js +5 -8
  227. package/build/esm/cc/SceneActuatorConfigurationCC.js.map +1 -1
  228. package/build/esm/cc/SceneControllerConfigurationCC.d.ts.map +1 -1
  229. package/build/esm/cc/SceneControllerConfigurationCC.js +10 -16
  230. package/build/esm/cc/SceneControllerConfigurationCC.js.map +1 -1
  231. package/build/esm/cc/ScheduleEntryLockCC.d.ts.map +1 -1
  232. package/build/esm/cc/ScheduleEntryLockCC.js +13 -20
  233. package/build/esm/cc/ScheduleEntryLockCC.js.map +1 -1
  234. package/build/esm/cc/Security2CC.d.ts +2 -1
  235. package/build/esm/cc/Security2CC.d.ts.map +1 -1
  236. package/build/esm/cc/Security2CC.js +68 -32
  237. package/build/esm/cc/Security2CC.js.map +1 -1
  238. package/build/esm/cc/SecurityCC.d.ts +3 -2
  239. package/build/esm/cc/SecurityCC.d.ts.map +1 -1
  240. package/build/esm/cc/SecurityCC.js +16 -11
  241. package/build/esm/cc/SecurityCC.js.map +1 -1
  242. package/build/esm/cc/SoundSwitchCC.js +2 -2
  243. package/build/esm/cc/SoundSwitchCC.js.map +1 -1
  244. package/build/esm/cc/SupervisionCC.d.ts +2 -1
  245. package/build/esm/cc/SupervisionCC.d.ts.map +1 -1
  246. package/build/esm/cc/SupervisionCC.js +13 -6
  247. package/build/esm/cc/SupervisionCC.js.map +1 -1
  248. package/build/esm/cc/ThermostatFanModeCC.d.ts.map +1 -1
  249. package/build/esm/cc/ThermostatFanModeCC.js +1 -2
  250. package/build/esm/cc/ThermostatFanModeCC.js.map +1 -1
  251. package/build/esm/cc/ThermostatModeCC.d.ts.map +1 -1
  252. package/build/esm/cc/ThermostatModeCC.js +1 -3
  253. package/build/esm/cc/ThermostatModeCC.js.map +1 -1
  254. package/build/esm/cc/ThermostatOperatingStateCC.d.ts.map +1 -1
  255. package/build/esm/cc/ThermostatOperatingStateCC.js +1 -2
  256. package/build/esm/cc/ThermostatOperatingStateCC.js.map +1 -1
  257. package/build/esm/cc/ThermostatSetpointCC.d.ts +4 -1
  258. package/build/esm/cc/ThermostatSetpointCC.d.ts.map +1 -1
  259. package/build/esm/cc/ThermostatSetpointCC.js +31 -19
  260. package/build/esm/cc/ThermostatSetpointCC.js.map +1 -1
  261. package/build/esm/cc/TimeCC.d.ts.map +1 -1
  262. package/build/esm/cc/TimeCC.js +6 -2
  263. package/build/esm/cc/TimeCC.js.map +1 -1
  264. package/build/esm/cc/TransportServiceCC.d.ts.map +1 -1
  265. package/build/esm/cc/TransportServiceCC.js +8 -8
  266. package/build/esm/cc/TransportServiceCC.js.map +1 -1
  267. package/build/esm/cc/UserCodeCC.d.ts.map +1 -1
  268. package/build/esm/cc/UserCodeCC.js +23 -30
  269. package/build/esm/cc/UserCodeCC.js.map +1 -1
  270. package/build/esm/cc/UserCredentialCC.d.ts.map +1 -1
  271. package/build/esm/cc/UserCredentialCC.js +49 -60
  272. package/build/esm/cc/UserCredentialCC.js.map +1 -1
  273. package/build/esm/cc/VersionCC.js +3 -3
  274. package/build/esm/cc/VersionCC.js.map +1 -1
  275. package/build/esm/cc/WindowCoveringCC.d.ts.map +1 -1
  276. package/build/esm/cc/WindowCoveringCC.js +10 -9
  277. package/build/esm/cc/WindowCoveringCC.js.map +1 -1
  278. package/build/esm/cc/ZWaveProtocolCC.d.ts.map +1 -1
  279. package/build/esm/cc/ZWaveProtocolCC.js +5 -26
  280. package/build/esm/cc/ZWaveProtocolCC.js.map +1 -1
  281. package/build/esm/cc/_CCValues.generated.d.ts +4 -4
  282. package/build/esm/cc/_CCValues.generated.d.ts.map +1 -1
  283. package/build/esm/cc/_CCValues.generated.js +638 -679
  284. package/build/esm/cc/_CCValues.generated.js.map +1 -1
  285. package/build/esm/cc/index.d.ts +179 -179
  286. package/build/esm/cc/index.d.ts.map +1 -1
  287. package/build/esm/cc/index.js +124 -124
  288. package/build/esm/cc/index.js.map +1 -1
  289. package/build/esm/cc/manufacturerProprietary/Decorators.d.ts.map +1 -1
  290. package/build/esm/cc/manufacturerProprietary/Decorators.js.map +1 -1
  291. package/build/esm/lib/API.d.ts +3 -2
  292. package/build/esm/lib/API.d.ts.map +1 -1
  293. package/build/esm/lib/API.js +1 -1
  294. package/build/esm/lib/API.js.map +1 -1
  295. package/build/esm/lib/CommandClass.d.ts +23 -1
  296. package/build/esm/lib/CommandClass.d.ts.map +1 -1
  297. package/build/esm/lib/CommandClass.js +61 -20
  298. package/build/esm/lib/CommandClass.js.map +1 -1
  299. package/build/esm/lib/CommandClassDecorators.d.ts.map +1 -1
  300. package/build/esm/lib/CommandClassDecorators.js +1 -2
  301. package/build/esm/lib/CommandClassDecorators.js.map +1 -1
  302. package/build/esm/lib/EncapsulatingCommandClass.d.ts.map +1 -1
  303. package/build/esm/lib/EncapsulatingCommandClass.js.map +1 -1
  304. package/build/esm/lib/NotificationEventPayload.d.ts.map +1 -1
  305. package/build/esm/lib/NotificationEventPayload.js.map +1 -1
  306. package/build/esm/lib/Security2/Extension.d.ts.map +1 -1
  307. package/build/esm/lib/Security2/Extension.js +2 -6
  308. package/build/esm/lib/Security2/Extension.js.map +1 -1
  309. package/build/esm/lib/Security2/shared.d.ts.map +1 -1
  310. package/build/esm/lib/Security2/shared.js.map +1 -1
  311. package/build/esm/lib/SetValueResult.d.ts.map +1 -1
  312. package/build/esm/lib/Values.d.ts +1 -1
  313. package/build/esm/lib/Values.d.ts.map +1 -1
  314. package/build/esm/lib/Values.js.map +1 -1
  315. package/build/esm/lib/_CCAPI.generated.d.ts.map +1 -1
  316. package/build/esm/lib/_Types.d.ts +34 -30
  317. package/build/esm/lib/_Types.d.ts.map +1 -1
  318. package/build/esm/lib/_Types.js +5 -0
  319. package/build/esm/lib/_Types.js.map +1 -1
  320. package/build/esm/lib/serializers.d.ts.map +1 -1
  321. package/build/esm/lib/serializers.js +1 -4
  322. package/build/esm/lib/serializers.js.map +1 -1
  323. package/build/esm/lib/traits.d.ts.map +1 -1
  324. package/build/esm/lib/utils.d.ts.map +1 -1
  325. package/build/esm/lib/utils.js +25 -31
  326. package/build/esm/lib/utils.js.map +1 -1
  327. package/package.json +7 -7
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src_gen/cc/SupervisionCC.ts"],
4
- "sourcesContent": ["import { CommandClasses, Duration, EncapsulationFlags, type EndpointId, type GetEndpoint, type GetNode, type GetValueDB, type MaybeNotKnown, type MessageOrCCLogEntry, MessagePriority, type MessageRecord, type NodeId, type SinglecastCC, type SupervisionResult, SupervisionStatus, type SupportsCC, TransmitOptions, type WithAddress, ZWaveError, ZWaveErrorCodes, isTransmissionError, validatePayload, } from \"@zwave-js/core\";\nimport { Bytes, getEnumMemberName } from \"@zwave-js/shared\";\nimport { PhysicalCCAPI } from \"../lib/API.js\";\nimport { type CCRaw, CommandClass } from \"../lib/CommandClass.js\";\nimport { API, CCCommand, commandClass, expectedCCResponse, implementedVersion, shouldUseSupervision, } from \"../lib/CommandClassDecorators.js\";\nimport { V } from \"../lib/Values.js\";\nimport { SupervisionCommand } from \"../lib/_Types.js\";\nimport type { CCEncodingContext, CCParsingContext } from \"../lib/traits.js\";\nimport { SupervisionCCValues } from \"./_CCValues.generated.js\";\nexport { SupervisionCCValues };\n// @noSetValueAPI - This CC has no values to set\n// @noInterview - This CC is only used for encapsulation\n// Encapsulation CCs are used internally and too frequently that we\n// want to pay the cost of validating each call\n/* eslint-disable @zwave-js/ccapi-validate-args */\n@API(CommandClasses.Supervision)\nexport class SupervisionCCAPI extends PhysicalCCAPI {\n public supportsCommand(cmd: SupervisionCommand): MaybeNotKnown<boolean> {\n switch (cmd) {\n case SupervisionCommand.Get:\n case SupervisionCommand.Report:\n return true; // This is mandatory\n }\n return super.supportsCommand(cmd);\n }\n public async sendReport(options: SupervisionCCReportOptions & {\n encapsulationFlags?: EncapsulationFlags;\n lowPriority?: boolean;\n }): Promise<void> {\n // Here we don't assert support - some devices only half-support Supervision, so we treat them\n // as if they don't support it. We still need to be able to respond to the Get command though.\n const { encapsulationFlags = EncapsulationFlags.None, lowPriority = false, ...cmdOptions } = options;\n const cc = new SupervisionCCReport({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n ...cmdOptions,\n });\n // The report must be sent back with the same encapsulation order\n cc.encapsulationFlags = encapsulationFlags;\n try {\n await this.host.sendCommand(cc, {\n ...this.commandOptions,\n // Supervision Reports must be prioritized over normal messages\n priority: lowPriority\n ? MessagePriority.ImmediateLow\n : MessagePriority.Immediate,\n // But we don't want to wait for an ACK because this can lock up the network for seconds\n // if the target node is asleep or unreachable\n transmitOptions: TransmitOptions.DEFAULT_NOACK,\n // Only try sending the report once. If it fails, the node will ask again\n maxSendAttempts: 1,\n // Don't keep the transaction alive to verify S2 delivery, or receiving\n // other commands from the node may interfere with it\n s2VerifyDelivery: false,\n });\n }\n catch (e) {\n if (isTransmissionError(e)) {\n // Swallow errors related to transmission failures\n return;\n }\n else {\n // Pass other errors through\n throw e;\n }\n }\n }\n}\n@commandClass(CommandClasses.Supervision)\n@implementedVersion(2)\nexport class SupervisionCC extends CommandClass {\n declare ccCommand: SupervisionCommand;\n // Force singlecast for the supervision CC\n declare nodeId: number;\n /** Tests if a command should be supervised and thus requires encapsulation */\n public static requiresEncapsulation(cc: CommandClass): boolean {\n return (!!(cc.encapsulationFlags & EncapsulationFlags.Supervision)\n && !(cc instanceof SupervisionCCGet)\n && !(cc instanceof SupervisionCCReport));\n }\n /** Encapsulates a command that targets a specific endpoint */\n public static encapsulate(cc: CommandClass, sessionId: number, requestStatusUpdates: boolean = true): SupervisionCCGet {\n if (!cc.isSinglecast()) {\n throw new ZWaveError(`Supervision is only possible for singlecast commands!`, ZWaveErrorCodes.Argument_Invalid);\n }\n const ret = new SupervisionCCGet({\n nodeId: cc.nodeId,\n // Supervision CC is wrapped inside MultiChannel CCs, so the endpoint must be copied\n endpointIndex: cc.endpointIndex,\n encapsulated: cc,\n sessionId,\n requestStatusUpdates,\n });\n // Copy the encapsulation flags from the encapsulated command\n // but omit Supervision, since we're doing that right now\n ret.encapsulationFlags = cc.encapsulationFlags\n & ~EncapsulationFlags.Supervision;\n return ret;\n }\n /**\n * Given a CC instance, this returns the Supervision session ID which is used for this command.\n * Returns `undefined` when there is no session ID or the command was sent as multicast.\n */\n public static getSessionId(command: CommandClass): number | undefined {\n if (command.isEncapsulatedWith(CommandClasses.Supervision, SupervisionCommand.Get)) {\n const supervisionEncapsulation = command.getEncapsulatingCC(CommandClasses.Supervision, SupervisionCommand.Get) as SupervisionCCGet;\n if (supervisionEncapsulation.frameType !== \"broadcast\"\n && supervisionEncapsulation.frameType !== \"multicast\") {\n return supervisionEncapsulation.sessionId;\n }\n }\n }\n /**\n * Returns whether a node supports the given CC with Supervision encapsulation.\n */\n public static getCCSupportedWithSupervision(ctx: GetValueDB, endpoint: EndpointId, ccId: CommandClasses): boolean {\n // By default assume supervision is supported for all CCs, unless we've remembered one not to be\n return (ctx\n .getValueDB(endpoint.nodeId)\n .getValue(SupervisionCCValues.ccSupported(ccId).endpoint(endpoint.index)) ?? true);\n }\n /**\n * Remembers whether a node supports the given CC with Supervision encapsulation.\n */\n public static setCCSupportedWithSupervision(ctx: GetValueDB, endpoint: EndpointId, ccId: CommandClasses, supported: boolean): void {\n ctx\n .getValueDB(endpoint.nodeId)\n .setValue(SupervisionCCValues.ccSupported(ccId).endpoint(endpoint.index), supported);\n }\n /** Returns whether this is a valid command to send supervised */\n public static mayUseSupervision<T extends CommandClass>(ctx: GetValueDB & GetNode<NodeId & SupportsCC & GetEndpoint<EndpointId>>, command: T): command is SinglecastCC<T> {\n // Supervision may only be used for singlecast CCs that expect no response\n // The specs mention that Supervision CAN be used for S2 multicast, but conveniently fail to explain how to respond to that.\n if (!command.isSinglecast())\n return false;\n if (command.expectsCCResponse(ctx))\n return false;\n // with a valid node and endpoint\n const node = command.getNode(ctx);\n if (!node)\n return false;\n const endpoint = command.getEndpoint(ctx);\n if (!endpoint)\n return false;\n // and only if ...\n return (\n // ... the node supports it\n node.supportsCC(CommandClasses.Supervision)\n // ... the command is marked as \"should use supervision\"\n && shouldUseSupervision(command)\n // ... and we haven't previously determined that the node doesn't properly support it\n && SupervisionCC.getCCSupportedWithSupervision(ctx, endpoint, command.ccId));\n }\n}\n// @publicAPI\nexport type SupervisionCCReportOptions = {\n moreUpdatesFollow: boolean;\n requestWakeUpOnDemand?: boolean;\n sessionId: number;\n} & ({\n status: SupervisionStatus.Working;\n duration: Duration;\n} | {\n status: SupervisionStatus.NoSupport | SupervisionStatus.Fail | SupervisionStatus.Success;\n});\n@CCCommand(SupervisionCommand.Report)\nexport class SupervisionCCReport extends SupervisionCC {\n public constructor(options: WithAddress<SupervisionCCReportOptions>) {\n super(options);\n this.moreUpdatesFollow = options.moreUpdatesFollow;\n this.requestWakeUpOnDemand = !!options.requestWakeUpOnDemand;\n this.sessionId = options.sessionId;\n this.status = options.status;\n if (options.status === SupervisionStatus.Working) {\n this.duration = options.duration;\n }\n else {\n this.duration = new Duration(0, \"seconds\");\n }\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): SupervisionCCReport {\n validatePayload(raw.payload.length >= 3);\n const moreUpdatesFollow = !!(raw.payload[0] & 128);\n const requestWakeUpOnDemand = !!(raw.payload[0] & 64);\n const sessionId = raw.payload[0] & 0b111111;\n const status: SupervisionStatus = raw.payload[1];\n if (status === SupervisionStatus.Working) {\n const duration = Duration.parseReport(raw.payload[2])\n ?? new Duration(0, \"seconds\");\n return new this({\n nodeId: ctx.sourceNodeId,\n moreUpdatesFollow,\n requestWakeUpOnDemand,\n sessionId,\n status,\n duration,\n });\n }\n else {\n return new this({\n nodeId: ctx.sourceNodeId,\n moreUpdatesFollow,\n requestWakeUpOnDemand,\n sessionId,\n status,\n });\n }\n }\n public readonly moreUpdatesFollow: boolean;\n public readonly requestWakeUpOnDemand: boolean;\n public readonly sessionId: number;\n public readonly status: SupervisionStatus;\n public readonly duration: Duration | undefined;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.concat([\n [\n (this.moreUpdatesFollow ? 128 : 0)\n | (this.requestWakeUpOnDemand ? 64 : 0)\n | (this.sessionId & 0b111111),\n this.status,\n ],\n ]);\n if (this.duration) {\n this.payload = Bytes.concat([\n this.payload,\n [this.duration.serializeReport()],\n ]);\n }\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const message: MessageRecord = {\n \"session id\": this.sessionId,\n \"more updates follow\": this.moreUpdatesFollow,\n status: getEnumMemberName(SupervisionStatus, this.status),\n };\n if (this.duration) {\n message.duration = this.duration.toString();\n }\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n public toSupervisionResult(): SupervisionResult {\n if (this.status === SupervisionStatus.Working) {\n return {\n status: this.status,\n remainingDuration: this.duration!,\n };\n }\n else {\n return {\n status: this.status,\n };\n }\n }\n}\n// @publicAPI\nexport interface SupervisionCCGetOptions {\n requestStatusUpdates: boolean;\n encapsulated: CommandClass;\n sessionId: number;\n}\nfunction testResponseForSupervisionCCGet(sent: SupervisionCCGet, received: SupervisionCCReport) {\n return received.sessionId === sent.sessionId;\n}\n@CCCommand(SupervisionCommand.Get)\n@expectedCCResponse(SupervisionCCReport, testResponseForSupervisionCCGet)\nexport class SupervisionCCGet extends SupervisionCC {\n public constructor(options: WithAddress<SupervisionCCGetOptions>) {\n super(options);\n this.sessionId = options.sessionId;\n this.requestStatusUpdates = options.requestStatusUpdates;\n this.encapsulated = options.encapsulated;\n // Supervision is inside MultiChannel CCs, so the endpoint must be copied\n this.encapsulated.endpointIndex = this.endpointIndex;\n this.encapsulated.encapsulatingCC = this as any;\n }\n public static async from(raw: CCRaw, ctx: CCParsingContext): Promise<SupervisionCCGet> {\n validatePayload(raw.payload.length >= 3);\n const requestStatusUpdates = !!(raw.payload[0] & 128);\n const sessionId = raw.payload[0] & 0b111111;\n const encapsulated = await CommandClass.parse(raw.payload.subarray(2), ctx);\n return new this({\n nodeId: ctx.sourceNodeId,\n requestStatusUpdates,\n sessionId,\n encapsulated,\n });\n }\n public requestStatusUpdates: boolean;\n public sessionId: number;\n public encapsulated: CommandClass;\n public async serialize(ctx: CCEncodingContext): Promise<Bytes> {\n const encapCC = await this.encapsulated.serialize(ctx);\n this.payload = Bytes.concat([\n [\n (this.requestStatusUpdates ? 128 : 0)\n | (this.sessionId & 0b111111),\n encapCC.length,\n ],\n encapCC,\n ]);\n return super.serialize(ctx);\n }\n protected computeEncapsulationOverhead(): number {\n // Supervision CC adds two bytes (control byte + cc length)\n return super.computeEncapsulationOverhead() + 2;\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"session id\": this.sessionId,\n \"request updates\": this.requestStatusUpdates,\n },\n };\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kBAAqZ;AACrZ,oBAAyC;AACzC,iBAA8B;AAC9B,0BAAyC;AACzC,oCAA4G;AAE5G,mBAAmC;AAEnC,gCAAoC;IAQvB,oBAAgB,MAAA;8BAD5B,mCAAI,2BAAe,WAAW,CAAC;;;;oBACM;wCAAA,YAAa;WAAA;;;;;;;;AAAnD,qCAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,0CAAA,YAAA,uBAAA;;IACF,gBAAgB,KAAuB;AAC1C,cAAQ,KAAK;QACT,KAAK,gCAAmB;QACxB,KAAK,gCAAmB;AACpB,iBAAO;MACf;AACA,aAAO,MAAM,gBAAgB,GAAG;IACpC;IACO,MAAM,WAAW,SAGv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MAAM,KAC5B,KAAK,YAAY;UACxB,QAAQ;;QAEZ;OACH;AACD,aAAO,MAAM,UAAU,GAAG;IAC9B;IACU,+BAA4B;AAElC,aAAO,MAAM,6BAA4B,IAAK;IAClD;IACO,WAAW,KAAgB;AAC9B,aAAO;QACH,GAAG,MAAM,WAAW,GAAG;QACvB,SAAS;UACL,cAAc,KAAK;UACnB,mBAAmB,KAAK;;;IAGpC;;;;",
6
- "names": ["SupervisionCC"]
4
+ "sourcesContent": ["import { CommandClasses, Duration, EncapsulationFlags, type EndpointId, type GetEndpoint, type GetNode, type GetValueDB, type MaybeNotKnown, type MessageOrCCLogEntry, MessagePriority, type MessageRecord, type NodeId, type SinglecastCC, type SupervisionResult, SupervisionStatus, type SupportsCC, TransmitOptions, type WithAddress, ZWaveError, ZWaveErrorCodes, isTransmissionError, validatePayload, } from \"@zwave-js/core\";\nimport { Bytes, getEnumMemberName } from \"@zwave-js/shared\";\nimport { PhysicalCCAPI } from \"../lib/API.js\";\nimport { type CCRaw, CommandClass, CommandRelation, } from \"../lib/CommandClass.js\";\nimport { API, CCCommand, commandClass, expectedCCResponse, implementedVersion, shouldUseSupervision, } from \"../lib/CommandClassDecorators.js\";\nimport { V } from \"../lib/Values.js\";\nimport { SupervisionCommand } from \"../lib/_Types.js\";\nimport type { CCEncodingContext, CCParsingContext } from \"../lib/traits.js\";\nimport { SupervisionCCValues } from \"./_CCValues.generated.js\";\nexport { SupervisionCCValues };\n// @noSetValueAPI - This CC has no values to set\n// @noInterview - This CC is only used for encapsulation\n// Encapsulation CCs are used internally and too frequently that we\n// want to pay the cost of validating each call\n/* eslint-disable @zwave-js/ccapi-validate-args */\n@API(CommandClasses.Supervision)\nexport class SupervisionCCAPI extends PhysicalCCAPI {\n public supportsCommand(cmd: SupervisionCommand): MaybeNotKnown<boolean> {\n switch (cmd) {\n case SupervisionCommand.Get:\n case SupervisionCommand.Report:\n return true; // This is mandatory\n }\n return super.supportsCommand(cmd);\n }\n public async sendReport(options: SupervisionCCReportOptions & {\n encapsulationFlags?: EncapsulationFlags;\n lowPriority?: boolean;\n }): Promise<void> {\n // Here we don't assert support - some devices only half-support Supervision, so we treat them\n // as if they don't support it. We still need to be able to respond to the Get command though.\n const { encapsulationFlags = EncapsulationFlags.None, lowPriority = false, ...cmdOptions } = options;\n const cc = new SupervisionCCReport({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n ...cmdOptions,\n });\n // The report must be sent back with the same encapsulation order\n cc.encapsulationFlags = encapsulationFlags;\n try {\n await this.host.sendCommand(cc, {\n ...this.commandOptions,\n // Supervision Reports must be prioritized over normal messages\n priority: lowPriority\n ? MessagePriority.ImmediateLow\n : MessagePriority.Immediate,\n // But we don't want to wait for an ACK because this can lock up the network for seconds\n // if the target node is asleep or unreachable\n transmitOptions: TransmitOptions.DEFAULT_NOACK,\n // Only try sending the report once. If it fails, the node will ask again\n maxSendAttempts: 1,\n // Don't keep the transaction alive to verify S2 delivery, or receiving\n // other commands from the node may interfere with it\n s2VerifyDelivery: false,\n });\n }\n catch (e) {\n if (isTransmissionError(e)) {\n // Swallow errors related to transmission failures\n return;\n }\n else {\n // Pass other errors through\n throw e;\n }\n }\n }\n}\n@commandClass(CommandClasses.Supervision)\n@implementedVersion(2)\nexport class SupervisionCC extends CommandClass {\n declare ccCommand: SupervisionCommand;\n // Force singlecast for the supervision CC\n declare nodeId: number;\n /** Tests if a command should be supervised and thus requires encapsulation */\n public static requiresEncapsulation(cc: CommandClass): boolean {\n return (!!(cc.encapsulationFlags & EncapsulationFlags.Supervision)\n && !(cc instanceof SupervisionCCGet)\n && !(cc instanceof SupervisionCCReport));\n }\n /** Encapsulates a command that targets a specific endpoint */\n public static encapsulate(cc: CommandClass, sessionId: number, requestStatusUpdates: boolean = true): SupervisionCCGet {\n if (!cc.isSinglecast()) {\n throw new ZWaveError(`Supervision is only possible for singlecast commands!`, ZWaveErrorCodes.Argument_Invalid);\n }\n const ret = new SupervisionCCGet({\n nodeId: cc.nodeId,\n // Supervision CC is wrapped inside MultiChannel CCs, so the endpoint must be copied\n endpointIndex: cc.endpointIndex,\n encapsulated: cc,\n sessionId,\n requestStatusUpdates,\n });\n // Copy the encapsulation flags from the encapsulated command\n // but omit Supervision, since we're doing that right now\n ret.encapsulationFlags =\n cc.encapsulationFlags & ~EncapsulationFlags.Supervision;\n return ret;\n }\n /**\n * Given a CC instance, this returns the Supervision session ID which is used for this command.\n * Returns `undefined` when there is no session ID or the command was sent as multicast.\n */\n public static getSessionId(command: CommandClass): number | undefined {\n if (command.isEncapsulatedWith(CommandClasses.Supervision, SupervisionCommand.Get)) {\n const supervisionEncapsulation = command.getEncapsulatingCC(CommandClasses.Supervision, SupervisionCommand.Get) as SupervisionCCGet;\n if (supervisionEncapsulation.frameType !== \"broadcast\"\n && supervisionEncapsulation.frameType !== \"multicast\") {\n return supervisionEncapsulation.sessionId;\n }\n }\n }\n /**\n * Returns whether a node supports the given CC with Supervision encapsulation.\n */\n public static getCCSupportedWithSupervision(ctx: GetValueDB, endpoint: EndpointId, ccId: CommandClasses): boolean {\n // By default assume supervision is supported for all CCs, unless we've remembered one not to be\n return (ctx\n .getValueDB(endpoint.nodeId)\n .getValue(SupervisionCCValues.ccSupported(ccId).endpoint(endpoint.index)) ?? true);\n }\n /**\n * Remembers whether a node supports the given CC with Supervision encapsulation.\n */\n public static setCCSupportedWithSupervision(ctx: GetValueDB, endpoint: EndpointId, ccId: CommandClasses, supported: boolean): void {\n ctx.getValueDB(endpoint.nodeId).setValue(SupervisionCCValues.ccSupported(ccId).endpoint(endpoint.index), supported);\n }\n /** Returns whether this is a valid command to send supervised */\n public static mayUseSupervision<T extends CommandClass>(ctx: GetValueDB & GetNode<NodeId & SupportsCC & GetEndpoint<EndpointId>>, command: T): command is SinglecastCC<T> {\n // Supervision may only be used for singlecast CCs that expect no response\n // The specs mention that Supervision CAN be used for S2 multicast, but conveniently fail to explain how to respond to that.\n if (!command.isSinglecast())\n return false;\n if (command.expectsCCResponse(ctx))\n return false;\n // with a valid node and endpoint\n const node = command.getNode(ctx);\n if (!node)\n return false;\n const endpoint = command.getEndpoint(ctx);\n if (!endpoint)\n return false;\n // and only if ...\n return (\n // ... the node supports it\n node.supportsCC(CommandClasses.Supervision)\n // ... the command is marked as \"should use supervision\"\n && shouldUseSupervision(command)\n // ... and we haven't previously determined that the node doesn't properly support it\n && SupervisionCC.getCCSupportedWithSupervision(ctx, endpoint, command.ccId));\n }\n}\n// @publicAPI\nexport type SupervisionCCReportOptions = {\n moreUpdatesFollow: boolean;\n requestWakeUpOnDemand?: boolean;\n sessionId: number;\n} & ({\n status: SupervisionStatus.Working;\n duration: Duration;\n} | {\n status: SupervisionStatus.NoSupport | SupervisionStatus.Fail | SupervisionStatus.Success;\n});\n@CCCommand(SupervisionCommand.Report)\nexport class SupervisionCCReport extends SupervisionCC {\n public constructor(options: WithAddress<SupervisionCCReportOptions>) {\n super(options);\n this.moreUpdatesFollow = options.moreUpdatesFollow;\n this.requestWakeUpOnDemand = !!options.requestWakeUpOnDemand;\n this.sessionId = options.sessionId;\n this.status = options.status;\n if (options.status === SupervisionStatus.Working) {\n this.duration = options.duration;\n }\n else {\n this.duration = new Duration(0, \"seconds\");\n }\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): SupervisionCCReport {\n validatePayload(raw.payload.length >= 3);\n const moreUpdatesFollow = !!(raw.payload[0] & 128);\n const requestWakeUpOnDemand = !!(raw.payload[0] & 64);\n const sessionId = raw.payload[0] & 0b111111;\n const status: SupervisionStatus = raw.payload[1];\n if (status === SupervisionStatus.Working) {\n const duration = Duration.parseReport(raw.payload[2])\n ?? new Duration(0, \"seconds\");\n return new this({\n nodeId: ctx.sourceNodeId,\n moreUpdatesFollow,\n requestWakeUpOnDemand,\n sessionId,\n status,\n duration,\n });\n }\n else {\n return new this({\n nodeId: ctx.sourceNodeId,\n moreUpdatesFollow,\n requestWakeUpOnDemand,\n sessionId,\n status,\n });\n }\n }\n public readonly moreUpdatesFollow: boolean;\n public readonly requestWakeUpOnDemand: boolean;\n public readonly sessionId: number;\n public readonly status: SupervisionStatus;\n public readonly duration: Duration | undefined;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.concat([\n [\n (this.moreUpdatesFollow ? 128 : 0)\n | (this.requestWakeUpOnDemand ? 64 : 0)\n | (this.sessionId & 0b111111),\n this.status,\n ],\n ]);\n if (this.duration) {\n this.payload = Bytes.concat([\n this.payload,\n [this.duration.serializeReport()],\n ]);\n }\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const message: MessageRecord = {\n \"session id\": this.sessionId,\n \"more updates follow\": this.moreUpdatesFollow,\n status: getEnumMemberName(SupervisionStatus, this.status),\n };\n if (this.duration) {\n message.duration = this.duration.toString();\n }\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n public toSupervisionResult(): SupervisionResult {\n if (this.status === SupervisionStatus.Working) {\n return {\n status: this.status,\n remainingDuration: this.duration!,\n };\n }\n else {\n return {\n status: this.status,\n };\n }\n }\n}\n// @publicAPI\nexport interface SupervisionCCGetOptions {\n requestStatusUpdates: boolean;\n encapsulated: CommandClass;\n sessionId: number;\n}\nfunction testResponseForSupervisionCCGet(sent: SupervisionCCGet, received: SupervisionCCReport) {\n return received.sessionId === sent.sessionId;\n}\n@CCCommand(SupervisionCommand.Get)\n@expectedCCResponse(SupervisionCCReport, testResponseForSupervisionCCGet)\nexport class SupervisionCCGet extends SupervisionCC {\n public constructor(options: WithAddress<SupervisionCCGetOptions>) {\n super(options);\n this.sessionId = options.sessionId;\n this.requestStatusUpdates = options.requestStatusUpdates;\n this.encapsulated = options.encapsulated;\n // Supervision is inside MultiChannel CCs, so the endpoint must be copied\n this.encapsulated.endpointIndex = this.endpointIndex;\n this.encapsulated.encapsulatingCC = this as any;\n }\n public static async from(raw: CCRaw, ctx: CCParsingContext): Promise<SupervisionCCGet> {\n validatePayload(raw.payload.length >= 3);\n const requestStatusUpdates = !!(raw.payload[0] & 128);\n const sessionId = raw.payload[0] & 0b111111;\n const encapsulated = await CommandClass.parse(raw.payload.subarray(2), ctx);\n return new this({\n nodeId: ctx.sourceNodeId,\n requestStatusUpdates,\n sessionId,\n encapsulated,\n });\n }\n public requestStatusUpdates: boolean;\n public sessionId: number;\n public encapsulated: CommandClass;\n protected override determineRelation(other: CommandClass): CommandRelation {\n if (other instanceof SupervisionCCGet\n // Requesting status updates changes the expected response flow,\n // so commands with different flags must not be related\n && this.requestStatusUpdates === other.requestStatusUpdates) {\n return this.encapsulated.getRelationTo(other.encapsulated);\n }\n return CommandRelation.Unrelated;\n }\n public async serialize(ctx: CCEncodingContext): Promise<Bytes> {\n const encapCC = await this.encapsulated.serialize(ctx);\n this.payload = Bytes.concat([\n [\n (this.requestStatusUpdates ? 128 : 0)\n | (this.sessionId & 0b111111),\n encapCC.length,\n ],\n encapCC,\n ]);\n return super.serialize(ctx);\n }\n protected computeEncapsulationOverhead(): number {\n // Supervision CC adds two bytes (control byte + cc length)\n return super.computeEncapsulationOverhead() + 2;\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"session id\": this.sessionId,\n \"request updates\": this.requestStatusUpdates,\n },\n };\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kBAAqZ;AACrZ,oBAAyC;AACzC,iBAA8B;AAC9B,0BAA2D;AAC3D,oCAA4G;AAE5G,mBAAmC;AAEnC,gCAAoC;IAQvB,oBAAgB,MAAA;8BAD5B,mCAAI,2BAAe,WAAW,CAAC;;;;oBACM;wCAAA,YAAa;WAAA;;;;;;;;AAAnD,qCAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,0CAAA,YAAA,uBAAA;;IACF,gBAAgB,KAAuB;AAC1C,cAAQ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AAkB,OAAmB;AACpD,UAAI,iBAAiBC,qBAGd,KAAK,yBAAyB,MAAM,sBAAsB;AAC7D,eAAO,KAAK,aAAa,cAAc,MAAM,YAAY;MAC7D;AACA,aAAO,oCAAgB;IAC3B;IACO,MAAM,UAAU,KAAsB;AACzC,YAAM,UAAU,MAAM,KAAK,aAAa,UAAU,GAAG;AACrD,WAAK,UAAU,oBAAM,OAAO;QACxB;WACK,KAAK,uBAAuB,MAAM,KAC5B,KAAK,YAAY;UACxB,QAAQ;;QAEZ;OACH;AACD,aAAO,MAAM,UAAU,GAAG;IAC9B;IACU,+BAA4B;AAElC,aAAO,MAAM,6BAA4B,IAAK;IAClD;IACO,WAAW,KAAgB;AAC9B,aAAO;QACH,GAAG,MAAM,WAAW,GAAG;QACvB,SAAS;UACL,cAAc,KAAK;UACnB,mBAAmB,KAAK;;;IAGpC;;;;",
6
+ "names": ["SupervisionCC", "SupervisionCCGet"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src_gen/cc/ThermostatFanModeCC.ts"],
4
- "sourcesContent": ["import * as __validateArgs from \"./ThermostatFanModeCC._validateArgs.js\";\nconst { validateArgs_ThermostatFanModeCCAPI_set } = __validateArgs;\nimport { CommandClasses, type GetValueDB, type MaybeNotKnown, type MessageOrCCLogEntry, MessagePriority, type MessageRecord, type SupervisionResult, ValueMetadata, type WithAddress, ZWaveError, ZWaveErrorCodes, enumValuesToMetadataStates, logList, logText, parseBitMask, supervisedCommandSucceeded, validatePayload, } from \"@zwave-js/core\";\nimport { Bytes, getEnumMemberName, pick } from \"@zwave-js/shared\";\nimport { CCAPI, POLL_VALUE, type PollValueImplementation, SET_VALUE, type SetValueImplementation, throwUnsupportedProperty, throwWrongValueType, } from \"../lib/API.js\";\nimport { type CCRaw, CommandClass, type InterviewContext, type PersistValuesContext, type RefreshValuesContext, type RefreshValuesOptions, } from \"../lib/CommandClass.js\";\nimport { API, CCCommand, ccValueProperty, ccValues, commandClass, expectedCCResponse, implementedVersion, useSupervision, } from \"../lib/CommandClassDecorators.js\";\nimport { V } from \"../lib/Values.js\";\nimport { ThermostatFanMode, ThermostatFanModeCommand } from \"../lib/_Types.js\";\nimport type { CCEncodingContext, CCParsingContext } from \"../lib/traits.js\";\nimport { ThermostatFanModeCCValues } from \"./_CCValues.generated.js\";\nexport { ThermostatFanModeCCValues };\n@API(CommandClasses[\"Thermostat Fan Mode\"])\nexport class ThermostatFanModeCCAPI extends CCAPI {\n public supportsCommand(cmd: ThermostatFanModeCommand): MaybeNotKnown<boolean> {\n switch (cmd) {\n case ThermostatFanModeCommand.Get:\n case ThermostatFanModeCommand.SupportedGet:\n return this.isSinglecast();\n case ThermostatFanModeCommand.Set:\n return true; // This is mandatory\n }\n return super.supportsCommand(cmd);\n }\n protected override get [SET_VALUE](): SetValueImplementation {\n return async function (this: ThermostatFanModeCCAPI, { property }, value) {\n const valueDB = this.getValueDB();\n let result: SupervisionResult | undefined;\n if (property === \"mode\") {\n if (typeof value !== \"number\") {\n throwWrongValueType(this.ccId, property, \"number\", typeof value);\n }\n // Preserve the value of the \"off\" flag\n const off = valueDB.getValue<boolean>(ThermostatFanModeCCValues.turnedOff.endpoint(this.endpoint.index));\n result = await this.set(value, off);\n }\n else if (property === \"off\") {\n if (typeof value !== \"boolean\") {\n throwWrongValueType(this.ccId, property, \"boolean\", typeof value);\n }\n const mode = valueDB.getValue<ThermostatFanMode>(ThermostatFanModeCCValues.fanMode.endpoint(this.endpoint.index));\n if (mode == undefined) {\n throw new ZWaveError(`The \"off\" property cannot be changed before the fan mode is known!`, ZWaveErrorCodes.Argument_Invalid);\n }\n result = await this.set(mode, value);\n }\n else {\n throwUnsupportedProperty(this.ccId, property);\n }\n // Verify the current value after a delay, unless the command was supervised and successful\n if (this.isSinglecast() && !supervisedCommandSucceeded(result)) {\n // TODO: Ideally this would be a short delay, but some thermostats like Remotec ZXT-600\n // aren't able to handle the GET this quickly.\n this.schedulePoll({ property }, value);\n }\n return result;\n };\n }\n protected get [POLL_VALUE](): PollValueImplementation {\n return async function (this: ThermostatFanModeCCAPI, { property }) {\n switch (property) {\n case \"mode\":\n case \"off\":\n return (await this.get())?.[property];\n default:\n throwUnsupportedProperty(this.ccId, property);\n }\n };\n }\n // oxlint-disable-next-line typescript/explicit-module-boundary-types\n public async get() {\n this.assertSupportsCommand(ThermostatFanModeCommand, ThermostatFanModeCommand.Get);\n const cc = new ThermostatFanModeCCGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<ThermostatFanModeCCReport>(cc, this.commandOptions);\n if (response) {\n return pick(response, [\"mode\", \"off\"]);\n }\n }\n @validateArgs_ThermostatFanModeCCAPI_set()\n public async set(mode: ThermostatFanMode, off?: boolean): Promise<SupervisionResult | undefined> {\n this.assertSupportsCommand(ThermostatFanModeCommand, ThermostatFanModeCommand.Set);\n const cc = new ThermostatFanModeCCSet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n mode,\n off,\n });\n return this.host.sendCommand(cc, this.commandOptions);\n }\n public async getSupportedModes(): Promise<MaybeNotKnown<readonly ThermostatFanMode[]>> {\n this.assertSupportsCommand(ThermostatFanModeCommand, ThermostatFanModeCommand.SupportedGet);\n const cc = new ThermostatFanModeCCSupportedGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<ThermostatFanModeCCSupportedReport>(cc, this.commandOptions);\n return response?.supportedModes;\n }\n}\n@commandClass(CommandClasses[\"Thermostat Fan Mode\"])\n@implementedVersion(5)\n@ccValues(ThermostatFanModeCCValues)\nexport class ThermostatFanModeCC extends CommandClass {\n declare ccCommand: ThermostatFanModeCommand;\n public async interview(ctx: InterviewContext): Promise<void> {\n const node = this.getNode(ctx)!;\n const endpoint = this.getEndpoint(ctx)!;\n const api = CCAPI.create(CommandClasses[\"Thermostat Fan Mode\"], ctx, endpoint).withOptions({\n priority: MessagePriority.NodeQuery,\n tag: \"interview\",\n });\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `Interviewing ${this.ccName}...`,\n direction: \"none\",\n });\n // First query the possible modes to set the metadata\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"querying supported thermostat fan modes...\",\n direction: \"outbound\",\n });\n const supportedModes = await api.getSupportedModes();\n if (supportedModes) {\n const logMessage = logText(\"received supported thermostat fan modes:\", {\n nested: logList(supportedModes.map((mode) => getEnumMemberName(ThermostatFanMode, mode))),\n });\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: logMessage,\n direction: \"inbound\",\n });\n }\n else {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"Querying supported thermostat fan modes timed out, skipping interview...\",\n });\n return;\n }\n await this.refreshValues(ctx, { tag: \"interview\" });\n // Remember that the interview is complete\n this.setInterviewComplete(ctx, true);\n }\n public async refreshValues(ctx: RefreshValuesContext, options?: RefreshValuesOptions): Promise<void> {\n const node = this.getNode(ctx)!;\n const endpoint = this.getEndpoint(ctx)!;\n const api = CCAPI.create(CommandClasses[\"Thermostat Fan Mode\"], ctx, endpoint).withOptions({\n priority: options?.priority ?? MessagePriority.NodeQuery,\n tag: options?.tag,\n });\n // Query the current status\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"querying current thermostat fan mode...\",\n direction: \"outbound\",\n });\n const currentStatus = await api.get();\n if (currentStatus) {\n let logMessage = `received current thermostat fan mode: ${getEnumMemberName(ThermostatFanMode, currentStatus.mode)}`;\n if (currentStatus.off != undefined) {\n logMessage += ` (turned off)`;\n }\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: logMessage,\n direction: \"inbound\",\n });\n }\n }\n}\n// @publicAPI\nexport interface ThermostatFanModeCCSetOptions {\n mode: ThermostatFanMode;\n off?: boolean;\n}\n@CCCommand(ThermostatFanModeCommand.Set)\n@useSupervision()\nexport class ThermostatFanModeCCSet extends ThermostatFanModeCC {\n public constructor(options: WithAddress<ThermostatFanModeCCSetOptions>) {\n super(options);\n this.mode = options.mode;\n this.off = options.off;\n }\n public static from(_raw: CCRaw, _ctx: CCParsingContext): ThermostatFanModeCCSet {\n // TODO: Deserialize payload\n throw new ZWaveError(`${this.name}: deserialization not implemented`, ZWaveErrorCodes.Deserialization_NotImplemented);\n // return new ThermostatFanModeCCSet({\n // \tnodeId: ctx.sourceNodeId,\n // });\n }\n public mode: ThermostatFanMode;\n public off: boolean | undefined;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([\n (this.off ? 128 : 0)\n | (this.mode & 0b1111),\n ]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const message: MessageRecord = {\n mode: getEnumMemberName(ThermostatFanMode, this.mode),\n };\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n}\n// @publicAPI\nexport interface ThermostatFanModeCCReportOptions {\n mode: ThermostatFanMode;\n off?: boolean;\n}\n@CCCommand(ThermostatFanModeCommand.Report)\n@ccValueProperty(\"mode\", ThermostatFanModeCCValues.fanMode)\n@ccValueProperty(\"off\", ThermostatFanModeCCValues.turnedOff)\nexport class ThermostatFanModeCCReport extends ThermostatFanModeCC {\n public constructor(options: WithAddress<ThermostatFanModeCCReportOptions>) {\n super(options);\n // TODO: Check implementation:\n this.mode = options.mode;\n this.off = options.off;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ThermostatFanModeCCReport {\n validatePayload(raw.payload.length >= 1);\n const mode: ThermostatFanMode = raw.payload[0] & 0b1111;\n // V3+\n const off = !!(raw.payload[0] & 128);\n return new this({\n nodeId: ctx.sourceNodeId,\n mode,\n off,\n });\n }\n public readonly mode: ThermostatFanMode;\n public readonly off: boolean | undefined;\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const message: MessageRecord = {\n mode: getEnumMemberName(ThermostatFanMode, this.mode),\n };\n if (this.off != undefined) {\n message.off = this.off;\n }\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n}\n@CCCommand(ThermostatFanModeCommand.Get)\n@expectedCCResponse(ThermostatFanModeCCReport)\nexport class ThermostatFanModeCCGet extends ThermostatFanModeCC {\n}\n// @publicAPI\nexport interface ThermostatFanModeCCSupportedReportOptions {\n supportedModes: ThermostatFanMode[];\n}\n@CCCommand(ThermostatFanModeCommand.SupportedReport)\n@ccValueProperty(\"supportedModes\", ThermostatFanModeCCValues.supportedFanModes)\nexport class ThermostatFanModeCCSupportedReport extends ThermostatFanModeCC {\n public constructor(options: WithAddress<ThermostatFanModeCCSupportedReportOptions>) {\n super(options);\n // TODO: Check implementation:\n this.supportedModes = options.supportedModes;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ThermostatFanModeCCSupportedReport {\n const supportedModes: ThermostatFanMode[] = parseBitMask(raw.payload, ThermostatFanMode[\"Auto low\"]);\n return new this({\n nodeId: ctx.sourceNodeId,\n supportedModes,\n });\n }\n public persistValues(ctx: PersistValuesContext): boolean {\n if (!super.persistValues(ctx))\n return false;\n // Remember which fan modes are supported\n const fanModeValue = ThermostatFanModeCCValues.fanMode;\n this.setMetadata(ctx, fanModeValue, {\n ...fanModeValue.meta,\n states: enumValuesToMetadataStates(ThermostatFanMode, this.supportedModes),\n });\n return true;\n }\n public readonly supportedModes: ThermostatFanMode[];\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"supported modes\": logList(this.supportedModes.map((mode) => getEnumMemberName(ThermostatFanMode, mode))),\n },\n };\n }\n}\n@CCCommand(ThermostatFanModeCommand.SupportedGet)\n@expectedCCResponse(ThermostatFanModeCCSupportedReport)\nexport class ThermostatFanModeCCSupportedGet extends ThermostatFanModeCC {\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qBAAgC;AAEhC,kBAAmU;AACnU,oBAA+C;AAC/C,iBAAwJ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Args from \"./ThermostatFanModeCC._validateArgs.js\";\nconst { validateArgs_ThermostatFanModeCCAPI_set } = __validateArgs;\nimport { CommandClasses, type GetValueDB, type MaybeNotKnown, type MessageOrCCLogEntry, MessagePriority, type MessageRecord, type SupervisionResult, ValueMetadata, type WithAddress, ZWaveError, ZWaveErrorCodes, enumValuesToMetadataStates, logList, logText, parseBitMask, supervisedCommandSucceeded, validatePayload, } from \"@zwave-js/core\";\nimport { Bytes, getEnumMemberName, pick } from \"@zwave-js/shared\";\nimport { CCAPI, POLL_VALUE, type PollValueImplementation, SET_VALUE, type SetValueImplementation, throwUnsupportedProperty, throwWrongValueType, } from \"../lib/API.js\";\nimport { type CCRaw, CommandClass, type InterviewContext, type PersistValuesContext, type RefreshValuesContext, type RefreshValuesOptions, } from \"../lib/CommandClass.js\";\nimport { API, CCCommand, ccValueProperty, ccValues, commandClass, expectedCCResponse, implementedVersion, useSupervision, } from \"../lib/CommandClassDecorators.js\";\nimport { V } from \"../lib/Values.js\";\nimport { ThermostatFanMode, ThermostatFanModeCommand } from \"../lib/_Types.js\";\nimport type { CCEncodingContext, CCParsingContext } from \"../lib/traits.js\";\nimport { ThermostatFanModeCCValues } from \"./_CCValues.generated.js\";\nexport { ThermostatFanModeCCValues };\n@API(CommandClasses[\"Thermostat Fan Mode\"])\nexport class ThermostatFanModeCCAPI extends CCAPI {\n public supportsCommand(cmd: ThermostatFanModeCommand): MaybeNotKnown<boolean> {\n switch (cmd) {\n case ThermostatFanModeCommand.Get:\n case ThermostatFanModeCommand.SupportedGet:\n return this.isSinglecast();\n case ThermostatFanModeCommand.Set:\n return true; // This is mandatory\n }\n return super.supportsCommand(cmd);\n }\n protected override get [SET_VALUE](): SetValueImplementation {\n return async function (this: ThermostatFanModeCCAPI, { property }, value) {\n const valueDB = this.getValueDB();\n let result: SupervisionResult | undefined;\n if (property === \"mode\") {\n if (typeof value !== \"number\") {\n throwWrongValueType(this.ccId, property, \"number\", typeof value);\n }\n // Preserve the value of the \"off\" flag\n const off = valueDB.getValue<boolean>(ThermostatFanModeCCValues.turnedOff.endpoint(this.endpoint.index));\n result = await this.set(value, off);\n }\n else if (property === \"off\") {\n if (typeof value !== \"boolean\") {\n throwWrongValueType(this.ccId, property, \"boolean\", typeof value);\n }\n const mode = valueDB.getValue<ThermostatFanMode>(ThermostatFanModeCCValues.fanMode.endpoint(this.endpoint.index));\n if (mode == undefined) {\n throw new ZWaveError(`The \"off\" property cannot be changed before the fan mode is known!`, ZWaveErrorCodes.Argument_Invalid);\n }\n result = await this.set(mode, value);\n }\n else {\n throwUnsupportedProperty(this.ccId, property);\n }\n // Verify the current value after a delay, unless the command was supervised and successful\n if (this.isSinglecast() && !supervisedCommandSucceeded(result)) {\n // TODO: Ideally this would be a short delay, but some thermostats like Remotec ZXT-600\n // aren't able to handle the GET this quickly.\n this.schedulePoll({ property }, value);\n }\n return result;\n };\n }\n protected get [POLL_VALUE](): PollValueImplementation {\n return async function (this: ThermostatFanModeCCAPI, { property }) {\n switch (property) {\n case \"mode\":\n case \"off\":\n return (await this.get())?.[property];\n default:\n throwUnsupportedProperty(this.ccId, property);\n }\n };\n }\n // oxlint-disable-next-line typescript/explicit-module-boundary-types\n public async get() {\n this.assertSupportsCommand(ThermostatFanModeCommand, ThermostatFanModeCommand.Get);\n const cc = new ThermostatFanModeCCGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<ThermostatFanModeCCReport>(cc, this.commandOptions);\n if (response) {\n return pick(response, [\"mode\", \"off\"]);\n }\n }\n @validateArgs_ThermostatFanModeCCAPI_set()\n public async set(mode: ThermostatFanMode, off?: boolean): Promise<SupervisionResult | undefined> {\n this.assertSupportsCommand(ThermostatFanModeCommand, ThermostatFanModeCommand.Set);\n const cc = new ThermostatFanModeCCSet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n mode,\n off,\n });\n return this.host.sendCommand(cc, this.commandOptions);\n }\n public async getSupportedModes(): Promise<MaybeNotKnown<readonly ThermostatFanMode[]>> {\n this.assertSupportsCommand(ThermostatFanModeCommand, ThermostatFanModeCommand.SupportedGet);\n const cc = new ThermostatFanModeCCSupportedGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<ThermostatFanModeCCSupportedReport>(cc, this.commandOptions);\n return response?.supportedModes;\n }\n}\n@commandClass(CommandClasses[\"Thermostat Fan Mode\"])\n@implementedVersion(5)\n@ccValues(ThermostatFanModeCCValues)\nexport class ThermostatFanModeCC extends CommandClass {\n declare ccCommand: ThermostatFanModeCommand;\n public async interview(ctx: InterviewContext): Promise<void> {\n const node = this.getNode(ctx)!;\n const endpoint = this.getEndpoint(ctx)!;\n const api = CCAPI.create(CommandClasses[\"Thermostat Fan Mode\"], ctx, endpoint).withOptions({\n priority: MessagePriority.NodeQuery,\n tag: \"interview\",\n });\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `Interviewing ${this.ccName}...`,\n direction: \"none\",\n });\n // First query the possible modes to set the metadata\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"querying supported thermostat fan modes...\",\n direction: \"outbound\",\n });\n const supportedModes = await api.getSupportedModes();\n if (supportedModes) {\n const logMessage = logText(\"received supported thermostat fan modes:\", {\n nested: logList(supportedModes.map((mode) => getEnumMemberName(ThermostatFanMode, mode))),\n });\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: logMessage,\n direction: \"inbound\",\n });\n }\n else {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"Querying supported thermostat fan modes timed out, skipping interview...\",\n });\n return;\n }\n await this.refreshValues(ctx, { tag: \"interview\" });\n // Remember that the interview is complete\n this.setInterviewComplete(ctx, true);\n }\n public async refreshValues(ctx: RefreshValuesContext, options?: RefreshValuesOptions): Promise<void> {\n const node = this.getNode(ctx)!;\n const endpoint = this.getEndpoint(ctx)!;\n const api = CCAPI.create(CommandClasses[\"Thermostat Fan Mode\"], ctx, endpoint).withOptions({\n priority: options?.priority ?? MessagePriority.NodeQuery,\n tag: options?.tag,\n });\n // Query the current status\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"querying current thermostat fan mode...\",\n direction: \"outbound\",\n });\n const currentStatus = await api.get();\n if (currentStatus) {\n let logMessage = `received current thermostat fan mode: ${getEnumMemberName(ThermostatFanMode, currentStatus.mode)}`;\n if (currentStatus.off != undefined) {\n logMessage += ` (turned off)`;\n }\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: logMessage,\n direction: \"inbound\",\n });\n }\n }\n}\n// @publicAPI\nexport interface ThermostatFanModeCCSetOptions {\n mode: ThermostatFanMode;\n off?: boolean;\n}\n@CCCommand(ThermostatFanModeCommand.Set)\n@useSupervision()\nexport class ThermostatFanModeCCSet extends ThermostatFanModeCC {\n public constructor(options: WithAddress<ThermostatFanModeCCSetOptions>) {\n super(options);\n this.mode = options.mode;\n this.off = options.off;\n }\n public static from(_raw: CCRaw, _ctx: CCParsingContext): ThermostatFanModeCCSet {\n // TODO: Deserialize payload\n throw new ZWaveError(`${this.name}: deserialization not implemented`, ZWaveErrorCodes.Deserialization_NotImplemented);\n // return new ThermostatFanModeCCSet({\n // \tnodeId: ctx.sourceNodeId,\n // });\n }\n public mode: ThermostatFanMode;\n public off: boolean | undefined;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([\n (this.off ? 128 : 0) | (this.mode & 0b1111),\n ]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const message: MessageRecord = {\n mode: getEnumMemberName(ThermostatFanMode, this.mode),\n };\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n}\n// @publicAPI\nexport interface ThermostatFanModeCCReportOptions {\n mode: ThermostatFanMode;\n off?: boolean;\n}\n@CCCommand(ThermostatFanModeCommand.Report)\n@ccValueProperty(\"mode\", ThermostatFanModeCCValues.fanMode)\n@ccValueProperty(\"off\", ThermostatFanModeCCValues.turnedOff)\nexport class ThermostatFanModeCCReport extends ThermostatFanModeCC {\n public constructor(options: WithAddress<ThermostatFanModeCCReportOptions>) {\n super(options);\n // TODO: Check implementation:\n this.mode = options.mode;\n this.off = options.off;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ThermostatFanModeCCReport {\n validatePayload(raw.payload.length >= 1);\n const mode: ThermostatFanMode = raw.payload[0] & 0b1111;\n // V3+\n const off = !!(raw.payload[0] & 128);\n return new this({\n nodeId: ctx.sourceNodeId,\n mode,\n off,\n });\n }\n public readonly mode: ThermostatFanMode;\n public readonly off: boolean | undefined;\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const message: MessageRecord = {\n mode: getEnumMemberName(ThermostatFanMode, this.mode),\n };\n if (this.off != undefined) {\n message.off = this.off;\n }\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n}\n@CCCommand(ThermostatFanModeCommand.Get)\n@expectedCCResponse(ThermostatFanModeCCReport)\nexport class ThermostatFanModeCCGet extends ThermostatFanModeCC {\n}\n// @publicAPI\nexport interface ThermostatFanModeCCSupportedReportOptions {\n supportedModes: ThermostatFanMode[];\n}\n@CCCommand(ThermostatFanModeCommand.SupportedReport)\n@ccValueProperty(\"supportedModes\", ThermostatFanModeCCValues.supportedFanModes)\nexport class ThermostatFanModeCCSupportedReport extends ThermostatFanModeCC {\n public constructor(options: WithAddress<ThermostatFanModeCCSupportedReportOptions>) {\n super(options);\n // TODO: Check implementation:\n this.supportedModes = options.supportedModes;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ThermostatFanModeCCSupportedReport {\n const supportedModes: ThermostatFanMode[] = parseBitMask(raw.payload, ThermostatFanMode[\"Auto low\"]);\n return new this({\n nodeId: ctx.sourceNodeId,\n supportedModes,\n });\n }\n public persistValues(ctx: PersistValuesContext): boolean {\n if (!super.persistValues(ctx))\n return false;\n // Remember which fan modes are supported\n const fanModeValue = ThermostatFanModeCCValues.fanMode;\n this.setMetadata(ctx, fanModeValue, {\n ...fanModeValue.meta,\n states: enumValuesToMetadataStates(ThermostatFanMode, this.supportedModes),\n });\n return true;\n }\n public readonly supportedModes: ThermostatFanMode[];\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"supported modes\": logList(this.supportedModes.map((mode) => getEnumMemberName(ThermostatFanMode, mode))),\n },\n };\n }\n}\n@CCCommand(ThermostatFanModeCommand.SupportedGet)\n@expectedCCResponse(ThermostatFanModeCCSupportedReport)\nexport class ThermostatFanModeCCSupportedGet extends ThermostatFanModeCC {\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qBAAgC;AAEhC,kBAAmU;AACnU,oBAA+C;AAC/C,iBAAwJ;AACxJ,0BAAkJ;AAClJ,oCAAiI;AAEjI,mBAA4D;AAE5D,gCAA0C;AAT1C,MAAM,EAAE,wCAAuC,IAAK;IAYvC,0BAAsB,MAAA;8BADlC,mCAAI,2BAAe,qBAAqB,CAAC,CAAC;;;;oBACC;;;8CAAA,YAAK;WAAA;;;;;;;;yBAoE5C,wCAAuC,CAAE;AAC1C,qCAAA,MAAA,MAAA,iBAAA,EAAA,MAAA,UAAA,MAAA,OAAA,QAAA,OAAA,SAAA,OAAA,QAAA,EAAA,KAAA,gCAAA,SAAA,KAAA,QAAA,KAAA,gCAAA,IAAa,KAAb,OAAgB,GAAA,UAAA,UAAA,GAAA,MAAA,0BAAA;AArEpB,qCAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,0CAAA,YAAA,uBAAA;;IACF,gBAAgB,KAA6B;AAChD,cAAQ,KAAK;QACT,KAAK,sCAAyB;QAC9B,KAAK,sCAAyB;AAC1B,iBAAO,KAAK,aAAY;QAC5B,K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CAA2B,gCAAmB,KAAK,cAAc;OAC5E;AACD,aAAO;IACX;IACgB;IACT,WAAW,KAAgB;AAC9B,aAAO;QACH,GAAG,MAAM,WAAW,GAAG;QACvB,SAAS;UACL,uBAAmB,qBAAQ,KAAK,eAAe,IAAI,CAAC,aAAS,iCAAkB,gCAAmB,IAAI,CAAC,CAAC;;;IAGpH;;;;IAIS,mCAA+B,MAAA;8BAF3C,yCAAU,sCAAyB,YAAY,OAC/C,kDAAmB,kCAAkC,CAAC;;;;oBACF;uDAAA,YAAmB;WAAA;;;;;;;;AAAxE,qCAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,0CAAA,YAAA,uBAAA;;;;;",
6
6
  "names": []
7
7
  }
@@ -285,9 +285,7 @@ let ThermostatModeCCSet = (() => {
285
285
  const manufacturerData = this.mode === import_Types.ThermostatMode["Manufacturer specific"] && this.manufacturerData ? this.manufacturerData : new Uint8Array();
286
286
  const manufacturerDataLength = manufacturerData.length;
287
287
  this.payload = import_shared.Bytes.concat([
288
- [
289
- ((manufacturerDataLength & 7) << 5) + (this.mode & 31)
290
- ],
288
+ [((manufacturerDataLength & 7) << 5) + (this.mode & 31)],
291
289
  manufacturerData
292
290
  ]);
293
291
  return super.serialize(ctx);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src_gen/cc/ThermostatModeCC.ts"],
4
- "sourcesContent": ["import * as __validateArgs from \"./ThermostatModeCC._validateArgs.js\";\nconst { validateArgs_ThermostatModeCCAPI_set } = __validateArgs;\nimport { CommandClasses, type GetValueDB, type MaybeNotKnown, type MessageOrCCLogEntry, MessagePriority, type MessageRecord, type SupervisionResult, ValueMetadata, type WithAddress, ZWaveError, ZWaveErrorCodes, encodeBitMask, enumValuesToMetadataStates, logList, logText, parseBitMask, supervisedCommandSucceeded, validatePayload, } from \"@zwave-js/core\";\nimport { Bytes, type BytesView, buffer2hex, getEnumMemberName, pick, } from \"@zwave-js/shared\";\nimport { CCAPI, POLL_VALUE, type PollValueImplementation, SET_VALUE, type SetValueImplementation, throwUnsupportedProperty, throwWrongValueType, } from \"../lib/API.js\";\nimport { type CCRaw, CommandClass, type InterviewContext, type PersistValuesContext, type RefreshValuesContext, type RefreshValuesOptions, } from \"../lib/CommandClass.js\";\nimport { API, CCCommand, ccValueProperty, ccValues, commandClass, expectedCCResponse, implementedVersion, useSupervision, } from \"../lib/CommandClassDecorators.js\";\nimport { V } from \"../lib/Values.js\";\nimport { ThermostatMode, ThermostatModeCommand } from \"../lib/_Types.js\";\nimport type { CCEncodingContext, CCParsingContext } from \"../lib/traits.js\";\nimport { ThermostatModeCCValues } from \"./_CCValues.generated.js\";\nexport { ThermostatModeCCValues };\n@API(CommandClasses[\"Thermostat Mode\"])\nexport class ThermostatModeCCAPI extends CCAPI {\n public supportsCommand(cmd: ThermostatModeCommand): MaybeNotKnown<boolean> {\n switch (cmd) {\n case ThermostatModeCommand.Get:\n case ThermostatModeCommand.SupportedGet:\n return this.isSinglecast();\n case ThermostatModeCommand.Set:\n return true; // This is mandatory\n }\n return super.supportsCommand(cmd);\n }\n protected override get [SET_VALUE](): SetValueImplementation {\n return async function (this: ThermostatModeCCAPI, { property }, value) {\n if (property !== \"mode\") {\n throwUnsupportedProperty(this.ccId, property);\n }\n if (typeof value !== \"number\") {\n throwWrongValueType(this.ccId, property, \"number\", typeof value);\n }\n const result = await this.set(value);\n // Verify the current value after a delay, unless the command was supervised and successful\n if (this.isSinglecast() && !supervisedCommandSucceeded(result)) {\n // TODO: Ideally this would be a short delay, but some thermostats like Remotec ZXT-600\n // aren't able to handle the GET this quickly.\n this.schedulePoll({ property }, value);\n }\n return result;\n };\n }\n protected get [POLL_VALUE](): PollValueImplementation {\n return async function (this: ThermostatModeCCAPI, { property }) {\n switch (property) {\n case \"mode\":\n return (await this.get())?.[property];\n default:\n throwUnsupportedProperty(this.ccId, property);\n }\n };\n }\n // oxlint-disable-next-line typescript/explicit-module-boundary-types\n public async get() {\n this.assertSupportsCommand(ThermostatModeCommand, ThermostatModeCommand.Get);\n const cc = new ThermostatModeCCGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<ThermostatModeCCReport>(cc, this.commandOptions);\n if (response) {\n return pick(response, [\"mode\", \"manufacturerData\"]);\n }\n }\n public async set(mode: Exclude<ThermostatMode, (typeof ThermostatMode)[\"Manufacturer specific\"]>): Promise<SupervisionResult | undefined>;\n public async set(mode: (typeof ThermostatMode)[\"Manufacturer specific\"], manufacturerData: BytesView | string): Promise<SupervisionResult | undefined>;\n @validateArgs_ThermostatModeCCAPI_set()\n public async set(mode: ThermostatMode, manufacturerData?: BytesView | string): Promise<SupervisionResult | undefined> {\n this.assertSupportsCommand(ThermostatModeCommand, ThermostatModeCommand.Set);\n if (typeof manufacturerData === \"string\") {\n // We accept the manufacturer data as a hex string. Make sure it's valid\n if (manufacturerData.length % 2 !== 0\n || !/^[0-9a-f]+$/i.test(manufacturerData)) {\n throw new ZWaveError(`Manufacturer data must be represented as hexadecimal when passed as a string!`, ZWaveErrorCodes.Argument_Invalid);\n }\n manufacturerData = Bytes.from(manufacturerData, \"hex\");\n }\n const cc = new ThermostatModeCCSet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n mode,\n manufacturerData: manufacturerData as any,\n });\n return this.host.sendCommand(cc, this.commandOptions);\n }\n public async getSupportedModes(): Promise<MaybeNotKnown<readonly ThermostatMode[]>> {\n this.assertSupportsCommand(ThermostatModeCommand, ThermostatModeCommand.SupportedGet);\n const cc = new ThermostatModeCCSupportedGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<ThermostatModeCCSupportedReport>(cc, this.commandOptions);\n return response?.supportedModes;\n }\n}\n@commandClass(CommandClasses[\"Thermostat Mode\"])\n@implementedVersion(3)\n@ccValues(ThermostatModeCCValues)\nexport class ThermostatModeCC extends CommandClass {\n declare ccCommand: ThermostatModeCommand;\n public async interview(ctx: InterviewContext): Promise<void> {\n const node = this.getNode(ctx)!;\n const endpoint = this.getEndpoint(ctx)!;\n const api = CCAPI.create(CommandClasses[\"Thermostat Mode\"], ctx, endpoint).withOptions({\n priority: MessagePriority.NodeQuery,\n tag: \"interview\",\n });\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `Interviewing ${this.ccName}...`,\n direction: \"none\",\n });\n // First query the possible modes to set the metadata\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"querying supported thermostat modes...\",\n direction: \"outbound\",\n });\n const supportedModes = await api.getSupportedModes();\n if (supportedModes) {\n const logMessage = logText(\"received supported thermostat modes:\", {\n nested: logList(supportedModes.map((mode) => getEnumMemberName(ThermostatMode, mode))),\n });\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: logMessage,\n direction: \"inbound\",\n });\n }\n else {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"Querying supported thermostat modes timed out, skipping interview...\",\n level: \"warn\",\n });\n return;\n }\n await this.refreshValues(ctx, { tag: \"interview\" });\n // Remember that the interview is complete\n this.setInterviewComplete(ctx, true);\n }\n public async refreshValues(ctx: RefreshValuesContext, options?: RefreshValuesOptions): Promise<void> {\n const node = this.getNode(ctx)!;\n const endpoint = this.getEndpoint(ctx)!;\n const api = CCAPI.create(CommandClasses[\"Thermostat Mode\"], ctx, endpoint).withOptions({\n priority: options?.priority ?? MessagePriority.NodeQuery,\n tag: options?.tag,\n });\n // Query the current status\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"querying current thermostat mode...\",\n direction: \"outbound\",\n });\n const currentStatus = await api.get();\n if (currentStatus) {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"received current thermostat mode: \"\n + getEnumMemberName(ThermostatMode, currentStatus.mode),\n direction: \"inbound\",\n });\n }\n }\n}\n// @publicAPI\nexport type ThermostatModeCCSetOptions = {\n mode: Exclude<ThermostatMode, (typeof ThermostatMode)[\"Manufacturer specific\"]>;\n} | {\n mode: (typeof ThermostatMode)[\"Manufacturer specific\"];\n manufacturerData: BytesView;\n};\n@CCCommand(ThermostatModeCommand.Set)\n@useSupervision()\nexport class ThermostatModeCCSet extends ThermostatModeCC {\n public constructor(options: WithAddress<ThermostatModeCCSetOptions>) {\n super(options);\n this.mode = options.mode;\n if (\"manufacturerData\" in options) {\n this.manufacturerData = options.manufacturerData;\n }\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ThermostatModeCCSet {\n validatePayload(raw.payload.length >= 1);\n const mode: ThermostatMode = raw.payload[0] & 0b11111;\n if (mode !== ThermostatMode[\"Manufacturer specific\"]) {\n return new this({\n nodeId: ctx.sourceNodeId,\n mode,\n });\n }\n const manufacturerDataLength = (raw.payload[0] >>> 5) & 0b111;\n validatePayload(raw.payload.length >= 1 + manufacturerDataLength);\n const manufacturerData = raw.payload.subarray(1, 1 + manufacturerDataLength);\n return new this({\n nodeId: ctx.sourceNodeId,\n mode,\n manufacturerData,\n });\n }\n public mode: ThermostatMode;\n public manufacturerData?: BytesView;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n const manufacturerData = this.mode === ThermostatMode[\"Manufacturer specific\"]\n && this.manufacturerData\n ? this.manufacturerData\n : new Uint8Array();\n const manufacturerDataLength = manufacturerData.length;\n this.payload = Bytes.concat([\n [\n ((manufacturerDataLength & 0b111) << 5) + (this.mode & 0b11111),\n ],\n manufacturerData,\n ]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const message: MessageRecord = {\n mode: getEnumMemberName(ThermostatMode, this.mode),\n };\n if (this.manufacturerData != undefined) {\n message[\"manufacturer data\"] = buffer2hex(this.manufacturerData);\n }\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n}\n// @publicAPI\nexport type ThermostatModeCCReportOptions = {\n mode: Exclude<ThermostatMode, (typeof ThermostatMode)[\"Manufacturer specific\"]>;\n manufacturerData?: undefined;\n} | {\n mode: (typeof ThermostatMode)[\"Manufacturer specific\"];\n manufacturerData?: BytesView;\n};\n@CCCommand(ThermostatModeCommand.Report)\n@ccValueProperty(\"mode\", ThermostatModeCCValues.thermostatMode)\n@ccValueProperty(\"manufacturerData\", ThermostatModeCCValues.manufacturerData)\nexport class ThermostatModeCCReport extends ThermostatModeCC {\n public constructor(options: WithAddress<ThermostatModeCCReportOptions>) {\n super(options);\n this.mode = options.mode;\n this.manufacturerData = options.manufacturerData;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ThermostatModeCCReport {\n validatePayload(raw.payload.length >= 1);\n const mode: ThermostatMode = raw.payload[0] & 0b11111;\n if (mode !== ThermostatMode[\"Manufacturer specific\"]) {\n return new this({\n nodeId: ctx.sourceNodeId,\n mode,\n });\n }\n // V3+\n const manufacturerDataLength = raw.payload[0] >>> 5;\n validatePayload(raw.payload.length >= 1 + manufacturerDataLength);\n const manufacturerData = raw.payload.subarray(1, 1 + manufacturerDataLength);\n return new this({\n nodeId: ctx.sourceNodeId,\n mode,\n manufacturerData,\n });\n }\n public persistValues(ctx: PersistValuesContext): boolean {\n if (!super.persistValues(ctx))\n return false;\n // Update the supported modes if a mode is used that wasn't previously\n // reported to be supported. This shouldn't happen, but well... it does anyways\n const thermostatModeValue = ThermostatModeCCValues.thermostatMode;\n const supportedModesValue = ThermostatModeCCValues.supportedModes;\n const supportedModes = this.getValue<ThermostatMode[]>(ctx, supportedModesValue);\n if (supportedModes\n && this.mode in ThermostatMode\n && !supportedModes.includes(this.mode)) {\n supportedModes.push(this.mode);\n supportedModes.sort((a, b) => a - b);\n this.setMetadata(ctx, thermostatModeValue, {\n ...thermostatModeValue.meta,\n states: enumValuesToMetadataStates(ThermostatMode, supportedModes),\n });\n this.setValue(ctx, supportedModesValue, supportedModes);\n }\n return true;\n }\n public readonly mode: ThermostatMode;\n public readonly manufacturerData: BytesView | undefined;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n const manufacturerDataLength = this.mode === ThermostatMode[\"Manufacturer specific\"]\n && this.manufacturerData\n ? Math.min(0b111, this.manufacturerData.length)\n : 0;\n this.payload = new Bytes(1 + manufacturerDataLength);\n this.payload[0] = (manufacturerDataLength << 5) + (this.mode & 0b11111);\n if (manufacturerDataLength && this.manufacturerData) {\n this.payload.set(this.manufacturerData.subarray(0, manufacturerDataLength), 1);\n }\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const message: MessageRecord = {\n mode: getEnumMemberName(ThermostatMode, this.mode),\n };\n if (this.manufacturerData != undefined) {\n message[\"manufacturer data\"] = buffer2hex(this.manufacturerData);\n }\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n}\n@CCCommand(ThermostatModeCommand.Get)\n@expectedCCResponse(ThermostatModeCCReport)\nexport class ThermostatModeCCGet extends ThermostatModeCC {\n}\n// @publicAPI\nexport interface ThermostatModeCCSupportedReportOptions {\n supportedModes: ThermostatMode[];\n}\n@CCCommand(ThermostatModeCommand.SupportedReport)\n@ccValueProperty(\"supportedModes\", ThermostatModeCCValues.supportedModes)\nexport class ThermostatModeCCSupportedReport extends ThermostatModeCC {\n public constructor(options: WithAddress<ThermostatModeCCSupportedReportOptions>) {\n super(options);\n this.supportedModes = options.supportedModes;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ThermostatModeCCSupportedReport {\n const supportedModes: ThermostatMode[] = parseBitMask(raw.payload, ThermostatMode.Off);\n return new this({\n nodeId: ctx.sourceNodeId,\n supportedModes,\n });\n }\n public persistValues(ctx: PersistValuesContext): boolean {\n if (!super.persistValues(ctx))\n return false;\n // Use this information to create the metadata for the mode property\n const thermostatModeValue = ThermostatModeCCValues.thermostatMode;\n this.setMetadata(ctx, thermostatModeValue, {\n ...thermostatModeValue.meta,\n states: enumValuesToMetadataStates(ThermostatMode, this.supportedModes),\n });\n return true;\n }\n public readonly supportedModes: ThermostatMode[];\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = encodeBitMask(this.supportedModes, ThermostatMode[\"Manufacturer specific\"], ThermostatMode.Off);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"supported modes\": logList(this.supportedModes.map((mode) => getEnumMemberName(ThermostatMode, mode))),\n },\n };\n }\n}\n@CCCommand(ThermostatModeCommand.SupportedGet)\n@expectedCCResponse(ThermostatModeCCSupportedReport)\nexport class ThermostatModeCCSupportedGet extends ThermostatModeCC {\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qBAAgC;AAEhC,kBAAkV;AAClV,oBAA4E;AAC5E,iBAAwJ;AACxJ,0BAAkJ;AAClJ,oCAAiI;AAEjI,mBAAsD;AAEtD,gCAAuC;AATvC,MAAM,EAAE,qCAAoC,IAAK;IAYpC,uBAAmB,MAAA;8BAD/B,mCAAI,2BAAe,iBAAiB,CAAC,CAAC;;;;oBACE;;;2CAAA,YAAK;WAAA;;;;;;;;yBAqDzC,qCAAoC,CAAE;AACvC,qCAAA,MAAA,MAAA,iBAAA,EAAA,MAAA,UAAA,MAAA,OAAA,QAAA,OAAA,SAAA,OAAA,QAAA,EAAA,KAAA,gCAAA,SAAA,KAAA,QAAA,KAAA,gCAAA,IAAa,KAAb,OAAgB,GAAA,UAAA,UAAA,GAAA,MAAA,0BAAA;AAtDpB,qCAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,0CAAA,YAAA,uBAAA;;IACF,gBAAgB,KAA0B;AAC7C,cAAQ,KAAK;QACT,KAAK,mCAAsB;QAC3B,KAAK,mCAAsB;AACvB,iBAAO,KAAK,aAA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cAAc,KAAyB;AAC1C,UAAI,CAAC,MAAM,cAAc,GAAG;AACxB,eAAO;AAEX,YAAM,sBAAsB,iDAAuB;AACnD,WAAK,YAAY,KAAK,qBAAqB;QACvC,GAAG,oBAAoB;QACvB,YAAQ,wCAA2B,6BAAgB,KAAK,cAAc;OACzE;AACD,aAAO;IACX;IACgB;IACT,UAAU,KAAsB;AACnC,WAAK,cAAU,2BAAc,KAAK,gBAAgB,4BAAe,uBAAuB,GAAG,4BAAe,GAAG;AAC7G,aAAO,MAAM,UAAU,GAAG;IAC9B;IACO,WAAW,KAAgB;AAC9B,aAAO;QACH,GAAG,MAAM,WAAW,GAAG;QACvB,SAAS;UACL,uBAAmB,qBAAQ,KAAK,eAAe,IAAI,CAAC,aAAS,iCAAkB,6BAAgB,IAAI,CAAC,CAAC;;;IAGjH;;;;IAIS,gCAA4B,MAAA;8BAFxC,yCAAU,mCAAsB,YAAY,OAC5C,kDAAmB,+BAA+B,CAAC;;;;oBACF;oDAAA,YAAgB;WAAA;;;;;;;;AAAlE,qCAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,0CAAA,YAAA,uBAAA;;;;;",
4
+ "sourcesContent": ["import * as __validateArgs from \"./ThermostatModeCC._validateArgs.js\";\nconst { validateArgs_ThermostatModeCCAPI_set } = __validateArgs;\nimport { CommandClasses, type GetValueDB, type MaybeNotKnown, type MessageOrCCLogEntry, MessagePriority, type MessageRecord, type SupervisionResult, ValueMetadata, type WithAddress, ZWaveError, ZWaveErrorCodes, encodeBitMask, enumValuesToMetadataStates, logList, logText, parseBitMask, supervisedCommandSucceeded, validatePayload, } from \"@zwave-js/core\";\nimport { Bytes, type BytesView, buffer2hex, getEnumMemberName, pick, } from \"@zwave-js/shared\";\nimport { CCAPI, POLL_VALUE, type PollValueImplementation, SET_VALUE, type SetValueImplementation, throwUnsupportedProperty, throwWrongValueType, } from \"../lib/API.js\";\nimport { type CCRaw, CommandClass, type InterviewContext, type PersistValuesContext, type RefreshValuesContext, type RefreshValuesOptions, } from \"../lib/CommandClass.js\";\nimport { API, CCCommand, ccValueProperty, ccValues, commandClass, expectedCCResponse, implementedVersion, useSupervision, } from \"../lib/CommandClassDecorators.js\";\nimport { V } from \"../lib/Values.js\";\nimport { ThermostatMode, ThermostatModeCommand } from \"../lib/_Types.js\";\nimport type { CCEncodingContext, CCParsingContext } from \"../lib/traits.js\";\nimport { ThermostatModeCCValues } from \"./_CCValues.generated.js\";\nexport { ThermostatModeCCValues };\n@API(CommandClasses[\"Thermostat Mode\"])\nexport class ThermostatModeCCAPI extends CCAPI {\n public supportsCommand(cmd: ThermostatModeCommand): MaybeNotKnown<boolean> {\n switch (cmd) {\n case ThermostatModeCommand.Get:\n case ThermostatModeCommand.SupportedGet:\n return this.isSinglecast();\n case ThermostatModeCommand.Set:\n return true; // This is mandatory\n }\n return super.supportsCommand(cmd);\n }\n protected override get [SET_VALUE](): SetValueImplementation {\n return async function (this: ThermostatModeCCAPI, { property }, value) {\n if (property !== \"mode\") {\n throwUnsupportedProperty(this.ccId, property);\n }\n if (typeof value !== \"number\") {\n throwWrongValueType(this.ccId, property, \"number\", typeof value);\n }\n const result = await this.set(value);\n // Verify the current value after a delay, unless the command was supervised and successful\n if (this.isSinglecast() && !supervisedCommandSucceeded(result)) {\n // TODO: Ideally this would be a short delay, but some thermostats like Remotec ZXT-600\n // aren't able to handle the GET this quickly.\n this.schedulePoll({ property }, value);\n }\n return result;\n };\n }\n protected get [POLL_VALUE](): PollValueImplementation {\n return async function (this: ThermostatModeCCAPI, { property }) {\n switch (property) {\n case \"mode\":\n return (await this.get())?.[property];\n default:\n throwUnsupportedProperty(this.ccId, property);\n }\n };\n }\n // oxlint-disable-next-line typescript/explicit-module-boundary-types\n public async get() {\n this.assertSupportsCommand(ThermostatModeCommand, ThermostatModeCommand.Get);\n const cc = new ThermostatModeCCGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<ThermostatModeCCReport>(cc, this.commandOptions);\n if (response) {\n return pick(response, [\"mode\", \"manufacturerData\"]);\n }\n }\n public async set(mode: Exclude<ThermostatMode, (typeof ThermostatMode)[\"Manufacturer specific\"]>): Promise<SupervisionResult | undefined>;\n public async set(mode: (typeof ThermostatMode)[\"Manufacturer specific\"], manufacturerData: BytesView | string): Promise<SupervisionResult | undefined>;\n @validateArgs_ThermostatModeCCAPI_set()\n public async set(mode: ThermostatMode, manufacturerData?: BytesView | string): Promise<SupervisionResult | undefined> {\n this.assertSupportsCommand(ThermostatModeCommand, ThermostatModeCommand.Set);\n if (typeof manufacturerData === \"string\") {\n // We accept the manufacturer data as a hex string. Make sure it's valid\n if (manufacturerData.length % 2 !== 0\n || !/^[0-9a-f]+$/i.test(manufacturerData)) {\n throw new ZWaveError(`Manufacturer data must be represented as hexadecimal when passed as a string!`, ZWaveErrorCodes.Argument_Invalid);\n }\n manufacturerData = Bytes.from(manufacturerData, \"hex\");\n }\n const cc = new ThermostatModeCCSet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n mode,\n manufacturerData: manufacturerData as any,\n });\n return this.host.sendCommand(cc, this.commandOptions);\n }\n public async getSupportedModes(): Promise<MaybeNotKnown<readonly ThermostatMode[]>> {\n this.assertSupportsCommand(ThermostatModeCommand, ThermostatModeCommand.SupportedGet);\n const cc = new ThermostatModeCCSupportedGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<ThermostatModeCCSupportedReport>(cc, this.commandOptions);\n return response?.supportedModes;\n }\n}\n@commandClass(CommandClasses[\"Thermostat Mode\"])\n@implementedVersion(3)\n@ccValues(ThermostatModeCCValues)\nexport class ThermostatModeCC extends CommandClass {\n declare ccCommand: ThermostatModeCommand;\n public async interview(ctx: InterviewContext): Promise<void> {\n const node = this.getNode(ctx)!;\n const endpoint = this.getEndpoint(ctx)!;\n const api = CCAPI.create(CommandClasses[\"Thermostat Mode\"], ctx, endpoint).withOptions({\n priority: MessagePriority.NodeQuery,\n tag: \"interview\",\n });\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `Interviewing ${this.ccName}...`,\n direction: \"none\",\n });\n // First query the possible modes to set the metadata\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"querying supported thermostat modes...\",\n direction: \"outbound\",\n });\n const supportedModes = await api.getSupportedModes();\n if (supportedModes) {\n const logMessage = logText(\"received supported thermostat modes:\", {\n nested: logList(supportedModes.map((mode) => getEnumMemberName(ThermostatMode, mode))),\n });\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: logMessage,\n direction: \"inbound\",\n });\n }\n else {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"Querying supported thermostat modes timed out, skipping interview...\",\n level: \"warn\",\n });\n return;\n }\n await this.refreshValues(ctx, { tag: \"interview\" });\n // Remember that the interview is complete\n this.setInterviewComplete(ctx, true);\n }\n public async refreshValues(ctx: RefreshValuesContext, options?: RefreshValuesOptions): Promise<void> {\n const node = this.getNode(ctx)!;\n const endpoint = this.getEndpoint(ctx)!;\n const api = CCAPI.create(CommandClasses[\"Thermostat Mode\"], ctx, endpoint).withOptions({\n priority: options?.priority ?? MessagePriority.NodeQuery,\n tag: options?.tag,\n });\n // Query the current status\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"querying current thermostat mode...\",\n direction: \"outbound\",\n });\n const currentStatus = await api.get();\n if (currentStatus) {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"received current thermostat mode: \"\n + getEnumMemberName(ThermostatMode, currentStatus.mode),\n direction: \"inbound\",\n });\n }\n }\n}\n// @publicAPI\nexport type ThermostatModeCCSetOptions = {\n mode: Exclude<ThermostatMode, (typeof ThermostatMode)[\"Manufacturer specific\"]>;\n} | {\n mode: (typeof ThermostatMode)[\"Manufacturer specific\"];\n manufacturerData: BytesView;\n};\n@CCCommand(ThermostatModeCommand.Set)\n@useSupervision()\nexport class ThermostatModeCCSet extends ThermostatModeCC {\n public constructor(options: WithAddress<ThermostatModeCCSetOptions>) {\n super(options);\n this.mode = options.mode;\n if (\"manufacturerData\" in options) {\n this.manufacturerData = options.manufacturerData;\n }\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ThermostatModeCCSet {\n validatePayload(raw.payload.length >= 1);\n const mode: ThermostatMode = raw.payload[0] & 0b11111;\n if (mode !== ThermostatMode[\"Manufacturer specific\"]) {\n return new this({\n nodeId: ctx.sourceNodeId,\n mode,\n });\n }\n const manufacturerDataLength = (raw.payload[0] >>> 5) & 0b111;\n validatePayload(raw.payload.length >= 1 + manufacturerDataLength);\n const manufacturerData = raw.payload.subarray(1, 1 + manufacturerDataLength);\n return new this({\n nodeId: ctx.sourceNodeId,\n mode,\n manufacturerData,\n });\n }\n public mode: ThermostatMode;\n public manufacturerData?: BytesView;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n const manufacturerData = this.mode === ThermostatMode[\"Manufacturer specific\"]\n && this.manufacturerData\n ? this.manufacturerData\n : new Uint8Array();\n const manufacturerDataLength = manufacturerData.length;\n this.payload = Bytes.concat([\n [((manufacturerDataLength & 0b111) << 5) + (this.mode & 0b11111)],\n manufacturerData,\n ]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const message: MessageRecord = {\n mode: getEnumMemberName(ThermostatMode, this.mode),\n };\n if (this.manufacturerData != undefined) {\n message[\"manufacturer data\"] = buffer2hex(this.manufacturerData);\n }\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n}\n// @publicAPI\nexport type ThermostatModeCCReportOptions = {\n mode: Exclude<ThermostatMode, (typeof ThermostatMode)[\"Manufacturer specific\"]>;\n manufacturerData?: undefined;\n} | {\n mode: (typeof ThermostatMode)[\"Manufacturer specific\"];\n manufacturerData?: BytesView;\n};\n@CCCommand(ThermostatModeCommand.Report)\n@ccValueProperty(\"mode\", ThermostatModeCCValues.thermostatMode)\n@ccValueProperty(\"manufacturerData\", ThermostatModeCCValues.manufacturerData)\nexport class ThermostatModeCCReport extends ThermostatModeCC {\n public constructor(options: WithAddress<ThermostatModeCCReportOptions>) {\n super(options);\n this.mode = options.mode;\n this.manufacturerData = options.manufacturerData;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ThermostatModeCCReport {\n validatePayload(raw.payload.length >= 1);\n const mode: ThermostatMode = raw.payload[0] & 0b11111;\n if (mode !== ThermostatMode[\"Manufacturer specific\"]) {\n return new this({\n nodeId: ctx.sourceNodeId,\n mode,\n });\n }\n // V3+\n const manufacturerDataLength = raw.payload[0] >>> 5;\n validatePayload(raw.payload.length >= 1 + manufacturerDataLength);\n const manufacturerData = raw.payload.subarray(1, 1 + manufacturerDataLength);\n return new this({\n nodeId: ctx.sourceNodeId,\n mode,\n manufacturerData,\n });\n }\n public persistValues(ctx: PersistValuesContext): boolean {\n if (!super.persistValues(ctx))\n return false;\n // Update the supported modes if a mode is used that wasn't previously\n // reported to be supported. This shouldn't happen, but well... it does anyways\n const thermostatModeValue = ThermostatModeCCValues.thermostatMode;\n const supportedModesValue = ThermostatModeCCValues.supportedModes;\n const supportedModes = this.getValue<ThermostatMode[]>(ctx, supportedModesValue);\n if (supportedModes\n && this.mode in ThermostatMode\n && !supportedModes.includes(this.mode)) {\n supportedModes.push(this.mode);\n supportedModes.sort((a, b) => a - b);\n this.setMetadata(ctx, thermostatModeValue, {\n ...thermostatModeValue.meta,\n states: enumValuesToMetadataStates(ThermostatMode, supportedModes),\n });\n this.setValue(ctx, supportedModesValue, supportedModes);\n }\n return true;\n }\n public readonly mode: ThermostatMode;\n public readonly manufacturerData: BytesView | undefined;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n const manufacturerDataLength = this.mode === ThermostatMode[\"Manufacturer specific\"]\n && this.manufacturerData\n ? Math.min(0b111, this.manufacturerData.length)\n : 0;\n this.payload = new Bytes(1 + manufacturerDataLength);\n this.payload[0] = (manufacturerDataLength << 5) + (this.mode & 0b11111);\n if (manufacturerDataLength && this.manufacturerData) {\n this.payload.set(this.manufacturerData.subarray(0, manufacturerDataLength), 1);\n }\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const message: MessageRecord = {\n mode: getEnumMemberName(ThermostatMode, this.mode),\n };\n if (this.manufacturerData != undefined) {\n message[\"manufacturer data\"] = buffer2hex(this.manufacturerData);\n }\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n}\n@CCCommand(ThermostatModeCommand.Get)\n@expectedCCResponse(ThermostatModeCCReport)\nexport class ThermostatModeCCGet extends ThermostatModeCC {\n}\n// @publicAPI\nexport interface ThermostatModeCCSupportedReportOptions {\n supportedModes: ThermostatMode[];\n}\n@CCCommand(ThermostatModeCommand.SupportedReport)\n@ccValueProperty(\"supportedModes\", ThermostatModeCCValues.supportedModes)\nexport class ThermostatModeCCSupportedReport extends ThermostatModeCC {\n public constructor(options: WithAddress<ThermostatModeCCSupportedReportOptions>) {\n super(options);\n this.supportedModes = options.supportedModes;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ThermostatModeCCSupportedReport {\n const supportedModes: ThermostatMode[] = parseBitMask(raw.payload, ThermostatMode.Off);\n return new this({\n nodeId: ctx.sourceNodeId,\n supportedModes,\n });\n }\n public persistValues(ctx: PersistValuesContext): boolean {\n if (!super.persistValues(ctx))\n return false;\n // Use this information to create the metadata for the mode property\n const thermostatModeValue = ThermostatModeCCValues.thermostatMode;\n this.setMetadata(ctx, thermostatModeValue, {\n ...thermostatModeValue.meta,\n states: enumValuesToMetadataStates(ThermostatMode, this.supportedModes),\n });\n return true;\n }\n public readonly supportedModes: ThermostatMode[];\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = encodeBitMask(this.supportedModes, ThermostatMode[\"Manufacturer specific\"], ThermostatMode.Off);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"supported modes\": logList(this.supportedModes.map((mode) => getEnumMemberName(ThermostatMode, mode))),\n },\n };\n }\n}\n@CCCommand(ThermostatModeCommand.SupportedGet)\n@expectedCCResponse(ThermostatModeCCSupportedReport)\nexport class ThermostatModeCCSupportedGet extends ThermostatModeCC {\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qBAAgC;AAEhC,kBAAkV;AAClV,oBAA4E;AAC5E,iBAAwJ;AACxJ,0BAAkJ;AAClJ,oCAAiI;AAEjI,mBAAsD;AAEtD,gCAAuC;AATvC,MAAM,EAAE,qCAAoC,IAAK;IAYpC,uBAAmB,MAAA;8BAD/B,mCAAI,2BAAe,iBAAiB,CAAC,CAAC;;;;oBACE;;;2CAAA,YAAK;WAAA;;;;;;;;yBAqDzC,qCAAoC,CAAE;AACvC,qCAAA,MAAA,MAAA,iBAAA,EAAA,MAAA,UAAA,MAAA,OAAA,QAAA,OAAA,SAAA,OAAA,QAAA,EAAA,KAAA,gCAAA,SAAA,KAAA,QAAA,KAAA,gCAAA,IAAa,KAAb,OAAgB,GAAA,UAAA,UAAA,GAAA,MAAA,0BAAA;AAtDpB,qCAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,0CAAA,YAAA,uBAAA;;IACF,gBAAgB,KAA0B;AAC7C,cAAQ,KAAK;QACT,KAAK,mCAAsB;QAC3B,KAAK,mCAAsB;AACvB,iBAAO,KAAK,aAAY;QAC5B,KAAK,mCAAsB;AACvB,iBAAO;MACf;AACA,aAAO,MAAM,gBAAgB,GAAG;IACpC;IACA,KAAwB,oBAAS,IAAC;AAC9B,aAAO,eAA2C,EAAE,SAAQ,GAAI,OAAK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;QACvB,YAAQ,wCAA2B,6BAAgB,KAAK,cAAc;OACzE;AACD,aAAO;IACX;IACgB;IACT,UAAU,KAAsB;AACnC,WAAK,cAAU,2BAAc,KAAK,gBAAgB,4BAAe,uBAAuB,GAAG,4BAAe,GAAG;AAC7G,aAAO,MAAM,UAAU,GAAG;IAC9B;IACO,WAAW,KAAgB;AAC9B,aAAO;QACH,GAAG,MAAM,WAAW,GAAG;QACvB,SAAS;UACL,uBAAmB,qBAAQ,KAAK,eAAe,IAAI,CAAC,aAAS,iCAAkB,6BAAgB,IAAI,CAAC,CAAC;;;IAGjH;;;;IAIS,gCAA4B,MAAA;8BAFxC,yCAAU,mCAAsB,YAAY,OAC5C,kDAAmB,+BAA+B,CAAC;;;;oBACF;oDAAA,YAAgB;WAAA;;;;;;;;AAAlE,qCAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,0CAAA,YAAA,uBAAA;;;;;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src_gen/cc/ThermostatOperatingStateCC.ts"],
4
- "sourcesContent": ["import * as __validateArgs from \"./ThermostatOperatingStateCC._validateArgs.js\";\nconst { validateArgs_ThermostatOperatingStateCCAPI_getLogging } = __validateArgs;\nimport { CommandClasses, type GetValueDB, type MaybeNotKnown, type MessageOrCCLogEntry, MessagePriority, type MessageRecord, ValueMetadata, type WithAddress, encodeBitMask, enumValuesToMetadataStates, logList, parseBitMask, validatePayload, } from \"@zwave-js/core\";\nimport { Bytes, getEnumMemberName } from \"@zwave-js/shared\";\nimport { CCAPI, POLL_VALUE, PhysicalCCAPI, type PollValueImplementation, throwUnsupportedProperty, } from \"../lib/API.js\";\nimport { type CCRaw, CommandClass, type InterviewContext, type RefreshValuesContext, type RefreshValuesOptions, } from \"../lib/CommandClass.js\";\nimport { API, CCCommand, ccValueProperty, ccValues, commandClass, expectedCCResponse, implementedVersion, } from \"../lib/CommandClassDecorators.js\";\nimport { V } from \"../lib/Values.js\";\nimport { ThermostatOperatingState, ThermostatOperatingStateCommand, type ThermostatOperatingStateLoggingData, } from \"../lib/_Types.js\";\nimport type { CCEncodingContext, CCParsingContext } from \"../lib/traits.js\";\nimport { ThermostatOperatingStateCCValues } from \"./_CCValues.generated.js\";\nexport { ThermostatOperatingStateCCValues };\n// @noSetValueAPI This CC is read-only\n@API(CommandClasses[\"Thermostat Operating State\"])\nexport class ThermostatOperatingStateCCAPI extends PhysicalCCAPI {\n public supportsCommand(cmd: ThermostatOperatingStateCommand): MaybeNotKnown<boolean> {\n switch (cmd) {\n case ThermostatOperatingStateCommand.Get:\n return true; // This is mandatory\n case ThermostatOperatingStateCommand.LoggingSupportedGet:\n case ThermostatOperatingStateCommand.LoggingGet:\n return this.version >= 2;\n }\n return super.supportsCommand(cmd);\n }\n protected get [POLL_VALUE](): PollValueImplementation {\n return async function (this: ThermostatOperatingStateCCAPI, { property }) {\n switch (property) {\n case \"state\":\n return this.get();\n default:\n throwUnsupportedProperty(this.ccId, property);\n }\n };\n }\n public async get(): Promise<MaybeNotKnown<ThermostatOperatingState>> {\n this.assertSupportsCommand(ThermostatOperatingStateCommand, ThermostatOperatingStateCommand.Get);\n const cc = new ThermostatOperatingStateCCGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<ThermostatOperatingStateCCReport>(cc, this.commandOptions);\n return response?.state;\n }\n public async getSupportedLoggingTypes(): Promise<MaybeNotKnown<readonly ThermostatOperatingState[]>> {\n this.assertSupportsCommand(ThermostatOperatingStateCommand, ThermostatOperatingStateCommand.LoggingSupportedGet);\n const cc = new ThermostatOperatingStateCCLoggingSupportedGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<ThermostatOperatingStateCCLoggingSupportedReport>(cc, this.commandOptions);\n return response?.supportedLoggingTypes;\n }\n @validateArgs_ThermostatOperatingStateCCAPI_getLogging()\n public async getLogging(states: ThermostatOperatingState[]): Promise<MaybeNotKnown<ReadonlyMap<ThermostatOperatingState, ThermostatOperatingStateLoggingData>>> {\n this.assertSupportsCommand(ThermostatOperatingStateCommand, ThermostatOperatingStateCommand.LoggingGet);\n const cc = new ThermostatOperatingStateCCLoggingGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n requestedStates: states,\n });\n const response = await this.host.sendCommand<ThermostatOperatingStateCCLoggingReport>(cc, this.commandOptions);\n return response?.loggingData;\n }\n}\n@commandClass(CommandClasses[\"Thermostat Operating State\"])\n@implementedVersion(2)\n@ccValues(ThermostatOperatingStateCCValues)\nexport class ThermostatOperatingStateCC extends CommandClass {\n declare ccCommand: ThermostatOperatingStateCommand;\n public async interview(ctx: InterviewContext): Promise<void> {\n const node = this.getNode(ctx)!;\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `Interviewing ${this.ccName}...`,\n direction: \"none\",\n });\n await this.refreshValues(ctx, { tag: \"interview\" });\n this.setInterviewComplete(ctx, true);\n }\n public async refreshValues(ctx: RefreshValuesContext, options?: RefreshValuesOptions): Promise<void> {\n const node = this.getNode(ctx)!;\n const endpoint = this.getEndpoint(ctx)!;\n const api = CCAPI.create(CommandClasses[\"Thermostat Operating State\"], ctx, endpoint).withOptions({\n priority: options?.priority ?? MessagePriority.NodeQuery,\n tag: options?.tag,\n });\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"querying thermostat operating state...\",\n direction: \"outbound\",\n });\n const state = await api.get();\n if (state != undefined) {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `received current thermostat operating state: ${getEnumMemberName(ThermostatOperatingState, state)}`,\n direction: \"inbound\",\n });\n }\n }\n}\n// @publicAPI\nexport interface ThermostatOperatingStateCCReportOptions {\n state: ThermostatOperatingState;\n}\n@CCCommand(ThermostatOperatingStateCommand.Report)\n@ccValueProperty(\"state\", ThermostatOperatingStateCCValues.operatingState)\nexport class ThermostatOperatingStateCCReport extends ThermostatOperatingStateCC {\n public constructor(options: WithAddress<ThermostatOperatingStateCCReportOptions>) {\n super(options);\n this.state = options.state;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ThermostatOperatingStateCCReport {\n validatePayload(raw.payload.length >= 1);\n const state: ThermostatOperatingState = raw.payload[0];\n validatePayload(state <= ThermostatOperatingState[\"3rd Stage Aux Heat\"]);\n return new this({\n nodeId: ctx.sourceNodeId,\n state,\n });\n }\n public readonly state: ThermostatOperatingState;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([this.state]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n state: getEnumMemberName(ThermostatOperatingState, this.state),\n },\n };\n }\n}\n@CCCommand(ThermostatOperatingStateCommand.Get)\n@expectedCCResponse(ThermostatOperatingStateCCReport)\nexport class ThermostatOperatingStateCCGet extends ThermostatOperatingStateCC {\n}\n// @publicAPI\nexport interface ThermostatOperatingStateCCLoggingSupportedReportOptions {\n supportedLoggingTypes: ThermostatOperatingState[];\n}\n@CCCommand(ThermostatOperatingStateCommand.LoggingSupportedReport)\nexport class ThermostatOperatingStateCCLoggingSupportedReport extends ThermostatOperatingStateCC {\n public constructor(options: WithAddress<ThermostatOperatingStateCCLoggingSupportedReportOptions>) {\n super(options);\n this.supportedLoggingTypes = options.supportedLoggingTypes;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ThermostatOperatingStateCCLoggingSupportedReport {\n // Bit 0 is not allocated, bit 1 = Operating State 1, etc.\n const supportedLoggingTypes: ThermostatOperatingState[] = parseBitMask(raw.payload, ThermostatOperatingState[\"Idle\"])\n // Bit 0 MUST be set to zero, so we ignore it when set\n .filter((state) => state !== ThermostatOperatingState.Idle);\n return new this({\n nodeId: ctx.sourceNodeId,\n supportedLoggingTypes,\n });\n }\n public readonly supportedLoggingTypes: ThermostatOperatingState[];\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n const supportedLoggingTypes = this.supportedLoggingTypes\n // Bit 0 MUST be set to zero, so we filter it out\n .filter((t) => t !== ThermostatOperatingState.Idle);\n this.payload = encodeBitMask(supportedLoggingTypes, undefined, ThermostatOperatingState[\"Idle\"]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"supported logging types\": logList(this.supportedLoggingTypes.map((t) => getEnumMemberName(ThermostatOperatingState, t))),\n },\n };\n }\n}\n@CCCommand(ThermostatOperatingStateCommand.LoggingSupportedGet)\n@expectedCCResponse(ThermostatOperatingStateCCLoggingSupportedReport)\nexport class ThermostatOperatingStateCCLoggingSupportedGet extends ThermostatOperatingStateCC {\n}\n// @publicAPI\nexport interface ThermostatOperatingStateCCLoggingReportOptions {\n reportsToFollow: number;\n loggingData: Map<ThermostatOperatingState, ThermostatOperatingStateLoggingData>;\n}\n@CCCommand(ThermostatOperatingStateCommand.LoggingReport)\nexport class ThermostatOperatingStateCCLoggingReport extends ThermostatOperatingStateCC {\n public constructor(options: WithAddress<ThermostatOperatingStateCCLoggingReportOptions>) {\n super(options);\n this.reportsToFollow = options.reportsToFollow;\n this.loggingData = options.loggingData;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ThermostatOperatingStateCCLoggingReport {\n validatePayload(raw.payload.length >= 1);\n const reportsToFollow = raw.payload[0];\n // Each log entry is 5 bytes:\n // Reserved[7:4]+StateType[3:0], TodayH, TodayM, YesterdayH, YesterdayM\n const loggingData = new Map<ThermostatOperatingState, ThermostatOperatingStateLoggingData>();\n let offset = 1;\n while (offset + 5 <= raw.payload.length) {\n const state: ThermostatOperatingState = raw.payload[offset++]\n & 0b1111;\n loggingData.set(state, {\n usageTodayHours: raw.payload[offset++],\n usageTodayMinutes: raw.payload[offset++],\n usageYesterdayHours: raw.payload[offset++],\n usageYesterdayMinutes: raw.payload[offset++],\n });\n }\n return new this({\n nodeId: ctx.sourceNodeId,\n reportsToFollow,\n loggingData,\n });\n }\n public reportsToFollow: number;\n public loggingData: Map<ThermostatOperatingState, ThermostatOperatingStateLoggingData>;\n public getPartialCCSessionId(): Record<string, any> | undefined {\n return {};\n }\n public getRemainingSegments(): number | undefined {\n return this.reportsToFollow;\n }\n public mergePartialCCs(partials: ThermostatOperatingStateCCLoggingReport[], _ctx: CCParsingContext): Promise<void> {\n // Merge all logging data maps from partial reports\n const merged = new Map<ThermostatOperatingState, ThermostatOperatingStateLoggingData>();\n for (const partial of partials) {\n for (const [state, data] of partial.loggingData) {\n merged.set(state, data);\n }\n }\n for (const [state, data] of this.loggingData) {\n merged.set(state, data);\n }\n this.loggingData = merged;\n return Promise.resolve();\n }\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = new Bytes(1 + this.loggingData.size * 5);\n this.payload[0] = this.reportsToFollow;\n let offset = 1;\n for (const [state, entry] of this.loggingData) {\n this.payload[offset++] = state & 0b1111;\n this.payload[offset++] = entry.usageTodayHours;\n this.payload[offset++] = entry.usageTodayMinutes;\n this.payload[offset++] = entry.usageYesterdayHours;\n this.payload[offset++] = entry.usageYesterdayMinutes;\n }\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const message: MessageRecord = {\n \"reports to follow\": this.reportsToFollow,\n };\n for (const [state, entry] of this.loggingData) {\n const stateName = getEnumMemberName(ThermostatOperatingState, state);\n message[`${stateName} today`] =\n `${entry.usageTodayHours}h ${entry.usageTodayMinutes}m`;\n message[`${stateName} yesterday`] =\n `${entry.usageYesterdayHours}h ${entry.usageYesterdayMinutes}m`;\n }\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n}\n// @publicAPI\nexport interface ThermostatOperatingStateCCLoggingGetOptions {\n requestedStates: ThermostatOperatingState[];\n}\n@CCCommand(ThermostatOperatingStateCommand.LoggingGet)\n@expectedCCResponse(ThermostatOperatingStateCCLoggingReport)\nexport class ThermostatOperatingStateCCLoggingGet extends ThermostatOperatingStateCC {\n public constructor(options: WithAddress<ThermostatOperatingStateCCLoggingGetOptions>) {\n super(options);\n this.requestedStates = options.requestedStates;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ThermostatOperatingStateCCLoggingGet {\n const requestedStates: ThermostatOperatingState[] = parseBitMask(raw.payload, ThermostatOperatingState[\"Idle\"]);\n return new this({\n nodeId: ctx.sourceNodeId,\n requestedStates,\n });\n }\n public requestedStates: ThermostatOperatingState[];\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = encodeBitMask(this.requestedStates, undefined, ThermostatOperatingState[\"Idle\"]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"requested states\": this.requestedStates\n .map((t) => getEnumMemberName(ThermostatOperatingState, t))\n .join(\", \"),\n },\n };\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qBAAgC;AAEhC,kBAAwP;AACxP,oBAAyC;AACzC,iBAA0G;AAC1G,0BAAuH;AACvH,oCAAiH;AAEjH,mBAAqH;AAErH,gCAAiD;AATjD,MAAM,EAAE,sDAAqD,IAAK;IAarD,iCAA6B,MAAA;8BADzC,mCAAI,2BAAe,4BAA4B,CAAC,CAAC;;;;oBACC;;;qDAAA,YAAa;WAAA;;;;;;;;gCAuC3D,sDAAqD,CAAE;AACxD,qCAAA,MAAA,MAAA,wBAAA,EAAA,MAAA,UAAA,MAAA,cAAA,QAAA,OAAA,SAAA,OAAA,QAAA,EAAA,KAAA,gCAAA,gBAAA,KAAA,QAAA,KAAA,gCAAA,IAAa,YAAb,OAAuB,GAAA,UAAA,UAAA,GAAA,MAAA,0BAAA;AAxC3B,qCAAA,MAAA,mBA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K,IAAI;;;IAG1B;;;;",
4
+ "sourcesContent": ["import * as __validateArgs from \"./ThermostatOperatingStateCC._validateArgs.js\";\nconst { validateArgs_ThermostatOperatingStateCCAPI_getLogging } = __validateArgs;\nimport { CommandClasses, type GetValueDB, type MaybeNotKnown, type MessageOrCCLogEntry, MessagePriority, type MessageRecord, ValueMetadata, type WithAddress, encodeBitMask, enumValuesToMetadataStates, logList, parseBitMask, validatePayload, } from \"@zwave-js/core\";\nimport { Bytes, getEnumMemberName } from \"@zwave-js/shared\";\nimport { CCAPI, POLL_VALUE, PhysicalCCAPI, type PollValueImplementation, throwUnsupportedProperty, } from \"../lib/API.js\";\nimport { type CCRaw, CommandClass, type InterviewContext, type RefreshValuesContext, type RefreshValuesOptions, } from \"../lib/CommandClass.js\";\nimport { API, CCCommand, ccValueProperty, ccValues, commandClass, expectedCCResponse, implementedVersion, } from \"../lib/CommandClassDecorators.js\";\nimport { V } from \"../lib/Values.js\";\nimport { ThermostatOperatingState, ThermostatOperatingStateCommand, type ThermostatOperatingStateLoggingData, } from \"../lib/_Types.js\";\nimport type { CCEncodingContext, CCParsingContext } from \"../lib/traits.js\";\nimport { ThermostatOperatingStateCCValues } from \"./_CCValues.generated.js\";\nexport { ThermostatOperatingStateCCValues };\n// @noSetValueAPI This CC is read-only\n@API(CommandClasses[\"Thermostat Operating State\"])\nexport class ThermostatOperatingStateCCAPI extends PhysicalCCAPI {\n public supportsCommand(cmd: ThermostatOperatingStateCommand): MaybeNotKnown<boolean> {\n switch (cmd) {\n case ThermostatOperatingStateCommand.Get:\n return true; // This is mandatory\n case ThermostatOperatingStateCommand.LoggingSupportedGet:\n case ThermostatOperatingStateCommand.LoggingGet:\n return this.version >= 2;\n }\n return super.supportsCommand(cmd);\n }\n protected get [POLL_VALUE](): PollValueImplementation {\n return async function (this: ThermostatOperatingStateCCAPI, { property }) {\n switch (property) {\n case \"state\":\n return this.get();\n default:\n throwUnsupportedProperty(this.ccId, property);\n }\n };\n }\n public async get(): Promise<MaybeNotKnown<ThermostatOperatingState>> {\n this.assertSupportsCommand(ThermostatOperatingStateCommand, ThermostatOperatingStateCommand.Get);\n const cc = new ThermostatOperatingStateCCGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<ThermostatOperatingStateCCReport>(cc, this.commandOptions);\n return response?.state;\n }\n public async getSupportedLoggingTypes(): Promise<MaybeNotKnown<readonly ThermostatOperatingState[]>> {\n this.assertSupportsCommand(ThermostatOperatingStateCommand, ThermostatOperatingStateCommand.LoggingSupportedGet);\n const cc = new ThermostatOperatingStateCCLoggingSupportedGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<ThermostatOperatingStateCCLoggingSupportedReport>(cc, this.commandOptions);\n return response?.supportedLoggingTypes;\n }\n @validateArgs_ThermostatOperatingStateCCAPI_getLogging()\n public async getLogging(states: ThermostatOperatingState[]): Promise<MaybeNotKnown<ReadonlyMap<ThermostatOperatingState, ThermostatOperatingStateLoggingData>>> {\n this.assertSupportsCommand(ThermostatOperatingStateCommand, ThermostatOperatingStateCommand.LoggingGet);\n const cc = new ThermostatOperatingStateCCLoggingGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n requestedStates: states,\n });\n const response = await this.host.sendCommand<ThermostatOperatingStateCCLoggingReport>(cc, this.commandOptions);\n return response?.loggingData;\n }\n}\n@commandClass(CommandClasses[\"Thermostat Operating State\"])\n@implementedVersion(2)\n@ccValues(ThermostatOperatingStateCCValues)\nexport class ThermostatOperatingStateCC extends CommandClass {\n declare ccCommand: ThermostatOperatingStateCommand;\n public async interview(ctx: InterviewContext): Promise<void> {\n const node = this.getNode(ctx)!;\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `Interviewing ${this.ccName}...`,\n direction: \"none\",\n });\n await this.refreshValues(ctx, { tag: \"interview\" });\n this.setInterviewComplete(ctx, true);\n }\n public async refreshValues(ctx: RefreshValuesContext, options?: RefreshValuesOptions): Promise<void> {\n const node = this.getNode(ctx)!;\n const endpoint = this.getEndpoint(ctx)!;\n const api = CCAPI.create(CommandClasses[\"Thermostat Operating State\"], ctx, endpoint).withOptions({\n priority: options?.priority ?? MessagePriority.NodeQuery,\n tag: options?.tag,\n });\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"querying thermostat operating state...\",\n direction: \"outbound\",\n });\n const state = await api.get();\n if (state != undefined) {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `received current thermostat operating state: ${getEnumMemberName(ThermostatOperatingState, state)}`,\n direction: \"inbound\",\n });\n }\n }\n}\n// @publicAPI\nexport interface ThermostatOperatingStateCCReportOptions {\n state: ThermostatOperatingState;\n}\n@CCCommand(ThermostatOperatingStateCommand.Report)\n@ccValueProperty(\"state\", ThermostatOperatingStateCCValues.operatingState)\nexport class ThermostatOperatingStateCCReport extends ThermostatOperatingStateCC {\n public constructor(options: WithAddress<ThermostatOperatingStateCCReportOptions>) {\n super(options);\n this.state = options.state;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ThermostatOperatingStateCCReport {\n validatePayload(raw.payload.length >= 1);\n const state: ThermostatOperatingState = raw.payload[0];\n validatePayload(state <= ThermostatOperatingState[\"3rd Stage Aux Heat\"]);\n return new this({\n nodeId: ctx.sourceNodeId,\n state,\n });\n }\n public readonly state: ThermostatOperatingState;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([this.state]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n state: getEnumMemberName(ThermostatOperatingState, this.state),\n },\n };\n }\n}\n@CCCommand(ThermostatOperatingStateCommand.Get)\n@expectedCCResponse(ThermostatOperatingStateCCReport)\nexport class ThermostatOperatingStateCCGet extends ThermostatOperatingStateCC {\n}\n// @publicAPI\nexport interface ThermostatOperatingStateCCLoggingSupportedReportOptions {\n supportedLoggingTypes: ThermostatOperatingState[];\n}\n@CCCommand(ThermostatOperatingStateCommand.LoggingSupportedReport)\nexport class ThermostatOperatingStateCCLoggingSupportedReport extends ThermostatOperatingStateCC {\n public constructor(options: WithAddress<ThermostatOperatingStateCCLoggingSupportedReportOptions>) {\n super(options);\n this.supportedLoggingTypes = options.supportedLoggingTypes;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ThermostatOperatingStateCCLoggingSupportedReport {\n // Bit 0 is not allocated, bit 1 = Operating State 1, etc.\n const supportedLoggingTypes: ThermostatOperatingState[] = parseBitMask(raw.payload, ThermostatOperatingState[\"Idle\"])\n // Bit 0 MUST be set to zero, so we ignore it when set\n .filter((state) => state !== ThermostatOperatingState.Idle);\n return new this({\n nodeId: ctx.sourceNodeId,\n supportedLoggingTypes,\n });\n }\n public readonly supportedLoggingTypes: ThermostatOperatingState[];\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n const supportedLoggingTypes = this.supportedLoggingTypes\n // Bit 0 MUST be set to zero, so we filter it out\n .filter((t) => t !== ThermostatOperatingState.Idle);\n this.payload = encodeBitMask(supportedLoggingTypes, undefined, ThermostatOperatingState[\"Idle\"]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"supported logging types\": logList(this.supportedLoggingTypes.map((t) => getEnumMemberName(ThermostatOperatingState, t))),\n },\n };\n }\n}\n@CCCommand(ThermostatOperatingStateCommand.LoggingSupportedGet)\n@expectedCCResponse(ThermostatOperatingStateCCLoggingSupportedReport)\nexport class ThermostatOperatingStateCCLoggingSupportedGet extends ThermostatOperatingStateCC {\n}\n// @publicAPI\nexport interface ThermostatOperatingStateCCLoggingReportOptions {\n reportsToFollow: number;\n loggingData: Map<ThermostatOperatingState, ThermostatOperatingStateLoggingData>;\n}\n@CCCommand(ThermostatOperatingStateCommand.LoggingReport)\nexport class ThermostatOperatingStateCCLoggingReport extends ThermostatOperatingStateCC {\n public constructor(options: WithAddress<ThermostatOperatingStateCCLoggingReportOptions>) {\n super(options);\n this.reportsToFollow = options.reportsToFollow;\n this.loggingData = options.loggingData;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ThermostatOperatingStateCCLoggingReport {\n validatePayload(raw.payload.length >= 1);\n const reportsToFollow = raw.payload[0];\n // Each log entry is 5 bytes:\n // Reserved[7:4]+StateType[3:0], TodayH, TodayM, YesterdayH, YesterdayM\n const loggingData = new Map<ThermostatOperatingState, ThermostatOperatingStateLoggingData>();\n let offset = 1;\n while (offset + 5 <= raw.payload.length) {\n const state: ThermostatOperatingState = raw.payload[offset++] & 0b1111;\n loggingData.set(state, {\n usageTodayHours: raw.payload[offset++],\n usageTodayMinutes: raw.payload[offset++],\n usageYesterdayHours: raw.payload[offset++],\n usageYesterdayMinutes: raw.payload[offset++],\n });\n }\n return new this({\n nodeId: ctx.sourceNodeId,\n reportsToFollow,\n loggingData,\n });\n }\n public reportsToFollow: number;\n public loggingData: Map<ThermostatOperatingState, ThermostatOperatingStateLoggingData>;\n public getPartialCCSessionId(): Record<string, any> | undefined {\n return {};\n }\n public getRemainingSegments(): number | undefined {\n return this.reportsToFollow;\n }\n public mergePartialCCs(partials: ThermostatOperatingStateCCLoggingReport[], _ctx: CCParsingContext): Promise<void> {\n // Merge all logging data maps from partial reports\n const merged = new Map<ThermostatOperatingState, ThermostatOperatingStateLoggingData>();\n for (const partial of partials) {\n for (const [state, data] of partial.loggingData) {\n merged.set(state, data);\n }\n }\n for (const [state, data] of this.loggingData) {\n merged.set(state, data);\n }\n this.loggingData = merged;\n return Promise.resolve();\n }\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = new Bytes(1 + this.loggingData.size * 5);\n this.payload[0] = this.reportsToFollow;\n let offset = 1;\n for (const [state, entry] of this.loggingData) {\n this.payload[offset++] = state & 0b1111;\n this.payload[offset++] = entry.usageTodayHours;\n this.payload[offset++] = entry.usageTodayMinutes;\n this.payload[offset++] = entry.usageYesterdayHours;\n this.payload[offset++] = entry.usageYesterdayMinutes;\n }\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const message: MessageRecord = {\n \"reports to follow\": this.reportsToFollow,\n };\n for (const [state, entry] of this.loggingData) {\n const stateName = getEnumMemberName(ThermostatOperatingState, state);\n message[`${stateName} today`] =\n `${entry.usageTodayHours}h ${entry.usageTodayMinutes}m`;\n message[`${stateName} yesterday`] =\n `${entry.usageYesterdayHours}h ${entry.usageYesterdayMinutes}m`;\n }\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n}\n// @publicAPI\nexport interface ThermostatOperatingStateCCLoggingGetOptions {\n requestedStates: ThermostatOperatingState[];\n}\n@CCCommand(ThermostatOperatingStateCommand.LoggingGet)\n@expectedCCResponse(ThermostatOperatingStateCCLoggingReport)\nexport class ThermostatOperatingStateCCLoggingGet extends ThermostatOperatingStateCC {\n public constructor(options: WithAddress<ThermostatOperatingStateCCLoggingGetOptions>) {\n super(options);\n this.requestedStates = options.requestedStates;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ThermostatOperatingStateCCLoggingGet {\n const requestedStates: ThermostatOperatingState[] = parseBitMask(raw.payload, ThermostatOperatingState[\"Idle\"]);\n return new this({\n nodeId: ctx.sourceNodeId,\n requestedStates,\n });\n }\n public requestedStates: ThermostatOperatingState[];\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = encodeBitMask(this.requestedStates, undefined, ThermostatOperatingState[\"Idle\"]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"requested states\": this.requestedStates\n .map((t) => getEnumMemberName(ThermostatOperatingState, t))\n .join(\", \"),\n },\n };\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qBAAgC;A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AAiE;AAChF,YAAM,OAAO;AACb,WAAK,kBAAkB,QAAQ;IACnC;IACO,OAAO,KAAK,KAAY,KAAqB;AAChD,YAAM,sBAA8C,0BAAa,IAAI,SAAS,sCAAyB,MAAM,CAAC;AAC9G,aAAO,IAAI,KAAK;QACZ,QAAQ,IAAI;QACZ;OACH;IACL;IACO;IACA,UAAU,KAAsB;AACnC,WAAK,cAAU,2BAAc,KAAK,iBAAiB,QAAW,sCAAyB,MAAM,CAAC;AAC9F,aAAO,MAAM,UAAU,GAAG;IAC9B;IACO,WAAW,KAAgB;AAC9B,aAAO;QACH,GAAG,MAAM,WAAW,GAAG;QACvB,SAAS;UACL,oBAAoB,KAAK,gBACpB,IAAI,CAAC,UAAM,iCAAkB,uCAA0B,CAAC,CAAC,EACzD,KAAK,IAAI;;;IAG1B;;;;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  import { type GetValueDB, type MaybeNotKnown, type MessageOrCCLogEntry, type Scale, type SupervisionResult, type WithAddress } from "@zwave-js/core";
2
2
  import { Bytes } from "@zwave-js/shared";
3
3
  import { CCAPI, POLL_VALUE, type PollValueImplementation, SET_VALUE, type SetValueImplementation } from "../lib/API.js";
4
- import { type CCRaw, CommandClass, type InterviewContext, type PersistValuesContext, type RefreshValuesContext, type RefreshValuesOptions } from "../lib/CommandClass.js";
4
+ import { type CCRaw, CommandClass, CommandRelation, type InterviewContext, type PersistValuesContext, type RefreshValuesContext, type RefreshValuesOptions } from "../lib/CommandClass.js";
5
5
  import { ThermostatSetpointCommand, ThermostatSetpointType } from "../lib/_Types.js";
6
6
  import type { CCEncodingContext, CCParsingContext } from "../lib/traits.js";
7
7
  import { ThermostatSetpointCCValues } from "./_CCValues.generated.js";
@@ -40,6 +40,7 @@ export declare class ThermostatSetpointCCSet extends ThermostatSetpointCC {
40
40
  setpointType: ThermostatSetpointType;
41
41
  value: number;
42
42
  scale: number;
43
+ protected determineRelation(other: CommandClass): CommandRelation;
43
44
  serialize(ctx: CCEncodingContext): Promise<Bytes>;
44
45
  toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry;
45
46
  }
@@ -55,6 +56,7 @@ export declare class ThermostatSetpointCCReport extends ThermostatSetpointCC {
55
56
  type: ThermostatSetpointType;
56
57
  scale: number;
57
58
  value: number;
59
+ protected determineRelation(other: CommandClass): CommandRelation;
58
60
  serialize(ctx: CCEncodingContext): Promise<Bytes>;
59
61
  toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry;
60
62
  }
@@ -65,6 +67,7 @@ export declare class ThermostatSetpointCCGet extends ThermostatSetpointCC {
65
67
  constructor(options: WithAddress<ThermostatSetpointCCGetOptions>);
66
68
  static from(raw: CCRaw, ctx: CCParsingContext): ThermostatSetpointCCGet;
67
69
  setpointType: ThermostatSetpointType;
70
+ protected determineRelation(other: CommandClass): CommandRelation;
68
71
  serialize(ctx: CCEncodingContext): Promise<Bytes>;
69
72
  toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry;
70
73
  }
@@ -405,6 +405,12 @@ let ThermostatSetpointCCSet = (() => {
405
405
  setpointType;
406
406
  value;
407
407
  scale;
408
+ determineRelation(other) {
409
+ if (other instanceof ThermostatSetpointCCSet2 && this.setpointType === other.setpointType) {
410
+ return this.value === other.value && this.scale === other.scale ? import_CommandClass.CommandRelation.Redundant : import_CommandClass.CommandRelation.Supersedes;
411
+ }
412
+ return import_CommandClass.CommandRelation.Unrelated;
413
+ }
408
414
  serialize(ctx) {
409
415
  const override = ctx.getDeviceConfig?.(this.nodeId)?.compat?.overrideFloatEncoding;
410
416
  this.payload = import_shared.Bytes.concat([
@@ -490,6 +496,12 @@ let ThermostatSetpointCCReport = (() => {
490
496
  type;
491
497
  scale;
492
498
  value;
499
+ determineRelation(other) {
500
+ if (other instanceof ThermostatSetpointCCReport2 && this.type === other.type) {
501
+ return this.value === other.value && this.scale === other.scale ? import_CommandClass.CommandRelation.Redundant : import_CommandClass.CommandRelation.Supersedes;
502
+ }
503
+ return import_CommandClass.CommandRelation.Unrelated;
504
+ }
493
505
  serialize(ctx) {
494
506
  this.payload = import_shared.Bytes.concat([
495
507
  [this.type & 15],
@@ -547,6 +559,12 @@ let ThermostatSetpointCCGet = (() => {
547
559
  });
548
560
  }
549
561
  setpointType;
562
+ determineRelation(other) {
563
+ if (other instanceof ThermostatSetpointCCGet2 && this.setpointType === other.setpointType) {
564
+ return import_CommandClass.CommandRelation.Redundant;
565
+ }
566
+ return import_CommandClass.CommandRelation.Unrelated;
567
+ }
550
568
  serialize(ctx) {
551
569
  this.payload = import_shared.Bytes.from([this.setpointType & 15]);
552
570
  return super.serialize(ctx);