@zwave-js/cc 14.0.0-beta.4 → 14.0.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 (331) hide show
  1. package/build/cjs/cc/AlarmSensorCC.js +381 -266
  2. package/build/cjs/cc/AlarmSensorCC.js.map +3 -3
  3. package/build/cjs/cc/AssociationCC.js +669 -503
  4. package/build/cjs/cc/AssociationCC.js.map +3 -3
  5. package/build/cjs/cc/AssociationGroupInfoCC.js +633 -492
  6. package/build/cjs/cc/AssociationGroupInfoCC.js.map +3 -3
  7. package/build/cjs/cc/BarrierOperatorCC.js +595 -429
  8. package/build/cjs/cc/BarrierOperatorCC.js.map +3 -3
  9. package/build/cjs/cc/BasicCC.js +354 -260
  10. package/build/cjs/cc/BasicCC.js.map +3 -3
  11. package/build/cjs/cc/BatteryCC.js +427 -345
  12. package/build/cjs/cc/BatteryCC.js.map +3 -3
  13. package/build/cjs/cc/BinarySensorCC.js +391 -276
  14. package/build/cjs/cc/BinarySensorCC.js.map +3 -3
  15. package/build/cjs/cc/BinarySwitchCC.js +347 -253
  16. package/build/cjs/cc/BinarySwitchCC.js.map +3 -3
  17. package/build/cjs/cc/CRC16CC.js +160 -85
  18. package/build/cjs/cc/CRC16CC.js.map +3 -3
  19. package/build/cjs/cc/CentralSceneCC.js +459 -324
  20. package/build/cjs/cc/CentralSceneCC.js.map +3 -3
  21. package/build/cjs/cc/ClimateControlScheduleCC.js +459 -293
  22. package/build/cjs/cc/ClimateControlScheduleCC.js.map +3 -3
  23. package/build/cjs/cc/ClockCC.js +254 -150
  24. package/build/cjs/cc/ClockCC.js.map +3 -3
  25. package/build/cjs/cc/ColorSwitchCC.js +758 -610
  26. package/build/cjs/cc/ColorSwitchCC.js.map +3 -3
  27. package/build/cjs/cc/ConfigurationCC.js +1700 -1453
  28. package/build/cjs/cc/ConfigurationCC.js.map +3 -3
  29. package/build/cjs/cc/DeviceResetLocallyCC.js +125 -49
  30. package/build/cjs/cc/DeviceResetLocallyCC.js.map +3 -3
  31. package/build/cjs/cc/DoorLockCC.js +904 -777
  32. package/build/cjs/cc/DoorLockCC.js.map +3 -3
  33. package/build/cjs/cc/DoorLockLoggingCC.js +321 -206
  34. package/build/cjs/cc/DoorLockLoggingCC.js.map +3 -3
  35. package/build/cjs/cc/EnergyProductionCC.js +249 -160
  36. package/build/cjs/cc/EnergyProductionCC.js.map +3 -3
  37. package/build/cjs/cc/EntryControlCC.js +619 -458
  38. package/build/cjs/cc/EntryControlCC.js.map +3 -3
  39. package/build/cjs/cc/FirmwareUpdateMetaDataCC.js +898 -698
  40. package/build/cjs/cc/FirmwareUpdateMetaDataCC.js.map +3 -3
  41. package/build/cjs/cc/HailCC.js +57 -11
  42. package/build/cjs/cc/HailCC.js.map +2 -2
  43. package/build/cjs/cc/HumidityControlModeCC.js +359 -233
  44. package/build/cjs/cc/HumidityControlModeCC.js.map +3 -3
  45. package/build/cjs/cc/HumidityControlOperatingStateCC.js +189 -103
  46. package/build/cjs/cc/HumidityControlOperatingStateCC.js.map +3 -3
  47. package/build/cjs/cc/HumidityControlSetpointCC.js +682 -495
  48. package/build/cjs/cc/HumidityControlSetpointCC.js.map +3 -3
  49. package/build/cjs/cc/InclusionControllerCC.js +205 -114
  50. package/build/cjs/cc/InclusionControllerCC.js.map +3 -3
  51. package/build/cjs/cc/IndicatorCC.js +897 -736
  52. package/build/cjs/cc/IndicatorCC.js.map +3 -3
  53. package/build/cjs/cc/IrrigationCC.js +1651 -1405
  54. package/build/cjs/cc/IrrigationCC.js.map +3 -3
  55. package/build/cjs/cc/LanguageCC.js +268 -171
  56. package/build/cjs/cc/LanguageCC.js.map +3 -3
  57. package/build/cjs/cc/LockCC.js +254 -154
  58. package/build/cjs/cc/LockCC.js.map +3 -3
  59. package/build/cjs/cc/ManufacturerProprietaryCC.js +189 -129
  60. package/build/cjs/cc/ManufacturerProprietaryCC.js.map +2 -2
  61. package/build/cjs/cc/ManufacturerSpecificCC.js +319 -213
  62. package/build/cjs/cc/ManufacturerSpecificCC.js.map +3 -3
  63. package/build/cjs/cc/MeterCC.js +827 -707
  64. package/build/cjs/cc/MeterCC.js.map +3 -3
  65. package/build/cjs/cc/MultiChannelAssociationCC.js +612 -478
  66. package/build/cjs/cc/MultiChannelAssociationCC.js.map +3 -3
  67. package/build/cjs/cc/MultiChannelCC.js +1037 -819
  68. package/build/cjs/cc/MultiChannelCC.js.map +3 -3
  69. package/build/cjs/cc/MultiCommandCC.js +172 -97
  70. package/build/cjs/cc/MultiCommandCC.js.map +3 -3
  71. package/build/cjs/cc/MultilevelSensorCC.js +589 -449
  72. package/build/cjs/cc/MultilevelSensorCC.js.map +3 -3
  73. package/build/cjs/cc/MultilevelSwitchCC.js +587 -439
  74. package/build/cjs/cc/MultilevelSwitchCC.js.map +3 -3
  75. package/build/cjs/cc/NoOperationCC.js +89 -27
  76. package/build/cjs/cc/NoOperationCC.js.map +2 -2
  77. package/build/cjs/cc/NodeNamingCC.js +417 -277
  78. package/build/cjs/cc/NodeNamingCC.js.map +3 -3
  79. package/build/cjs/cc/NotificationCC.js +972 -818
  80. package/build/cjs/cc/NotificationCC.js.map +3 -3
  81. package/build/cjs/cc/PowerlevelCC.js +450 -303
  82. package/build/cjs/cc/PowerlevelCC.js.map +3 -3
  83. package/build/cjs/cc/ProtectionCC.js +686 -494
  84. package/build/cjs/cc/ProtectionCC.js.map +3 -3
  85. package/build/cjs/cc/SceneActivationCC.js +165 -97
  86. package/build/cjs/cc/SceneActivationCC.js.map +3 -3
  87. package/build/cjs/cc/SceneActuatorConfigurationCC.js +346 -243
  88. package/build/cjs/cc/SceneActuatorConfigurationCC.js.map +3 -3
  89. package/build/cjs/cc/SceneControllerConfigurationCC.js +401 -298
  90. package/build/cjs/cc/SceneControllerConfigurationCC.js.map +3 -3
  91. package/build/cjs/cc/ScheduleEntryLockCC.js +1552 -1272
  92. package/build/cjs/cc/ScheduleEntryLockCC.js.map +3 -3
  93. package/build/cjs/cc/Security2CC.js +1483 -1219
  94. package/build/cjs/cc/Security2CC.js.map +3 -3
  95. package/build/cjs/cc/SecurityCC.js +839 -619
  96. package/build/cjs/cc/SecurityCC.js.map +3 -3
  97. package/build/cjs/cc/SoundSwitchCC.js +707 -515
  98. package/build/cjs/cc/SoundSwitchCC.js.map +3 -3
  99. package/build/cjs/cc/SupervisionCC.js +327 -237
  100. package/build/cjs/cc/SupervisionCC.js.map +3 -3
  101. package/build/cjs/cc/ThermostatFanModeCC.js +386 -263
  102. package/build/cjs/cc/ThermostatFanModeCC.js.map +3 -3
  103. package/build/cjs/cc/ThermostatFanStateCC.js +192 -106
  104. package/build/cjs/cc/ThermostatFanStateCC.js.map +3 -3
  105. package/build/cjs/cc/ThermostatModeCC.js +425 -302
  106. package/build/cjs/cc/ThermostatModeCC.js.map +3 -3
  107. package/build/cjs/cc/ThermostatOperatingStateCC.js +188 -102
  108. package/build/cjs/cc/ThermostatOperatingStateCC.js.map +3 -3
  109. package/build/cjs/cc/ThermostatSetbackCC.js +277 -173
  110. package/build/cjs/cc/ThermostatSetbackCC.js.map +3 -3
  111. package/build/cjs/cc/ThermostatSetpointCC.js +645 -491
  112. package/build/cjs/cc/ThermostatSetpointCC.js.map +3 -3
  113. package/build/cjs/cc/TimeCC.js +515 -353
  114. package/build/cjs/cc/TimeCC.js.map +3 -3
  115. package/build/cjs/cc/TimeParametersCC.js +302 -202
  116. package/build/cjs/cc/TimeParametersCC.js.map +3 -3
  117. package/build/cjs/cc/TransportServiceCC.js +433 -315
  118. package/build/cjs/cc/TransportServiceCC.js.map +3 -3
  119. package/build/cjs/cc/UserCodeCC.js +1385 -1102
  120. package/build/cjs/cc/UserCodeCC.js.map +3 -3
  121. package/build/cjs/cc/VersionCC.js +696 -562
  122. package/build/cjs/cc/VersionCC.js.map +3 -3
  123. package/build/cjs/cc/WakeUpCC.js +499 -346
  124. package/build/cjs/cc/WakeUpCC.js.map +3 -3
  125. package/build/cjs/cc/WindowCoveringCC.js +626 -478
  126. package/build/cjs/cc/WindowCoveringCC.js.map +3 -3
  127. package/build/cjs/cc/ZWaveLongRangeCC.js +57 -10
  128. package/build/cjs/cc/ZWaveLongRangeCC.js.map +2 -2
  129. package/build/cjs/cc/ZWavePlusCC.js +233 -159
  130. package/build/cjs/cc/ZWavePlusCC.js.map +3 -3
  131. package/build/cjs/cc/ZWaveProtocolCC.js +1515 -948
  132. package/build/cjs/cc/ZWaveProtocolCC.js.map +3 -3
  133. package/build/cjs/cc/manufacturerProprietary/Decorators.d.ts +4 -4
  134. package/build/cjs/cc/manufacturerProprietary/Decorators.js.map +1 -1
  135. package/build/cjs/cc/manufacturerProprietary/FibaroCC.js +395 -274
  136. package/build/cjs/cc/manufacturerProprietary/FibaroCC.js.map +3 -3
  137. package/build/cjs/lib/CommandClassDecorators.d.ts +11 -15
  138. package/build/cjs/lib/CommandClassDecorators.js +19 -20
  139. package/build/cjs/lib/CommandClassDecorators.js.map +2 -2
  140. package/build/cjs/lib/Security2/Extension.d.ts +1 -1
  141. package/build/cjs/lib/Security2/Extension.js +217 -126
  142. package/build/cjs/lib/Security2/Extension.js.map +3 -3
  143. package/build/esm/cc/AlarmSensorCC.d.ts.map +1 -1
  144. package/build/esm/cc/AlarmSensorCC.js +389 -291
  145. package/build/esm/cc/AlarmSensorCC.js.map +1 -1
  146. package/build/esm/cc/AssociationCC.d.ts.map +1 -1
  147. package/build/esm/cc/AssociationCC.js +678 -537
  148. package/build/esm/cc/AssociationCC.js.map +1 -1
  149. package/build/esm/cc/AssociationGroupInfoCC.d.ts.map +1 -1
  150. package/build/esm/cc/AssociationGroupInfoCC.js +659 -539
  151. package/build/esm/cc/AssociationGroupInfoCC.js.map +1 -1
  152. package/build/esm/cc/BarrierOperatorCC.d.ts.map +1 -1
  153. package/build/esm/cc/BarrierOperatorCC.js +634 -493
  154. package/build/esm/cc/BarrierOperatorCC.js.map +1 -1
  155. package/build/esm/cc/BasicCC.d.ts.map +1 -1
  156. package/build/esm/cc/BasicCC.js +380 -302
  157. package/build/esm/cc/BasicCC.js.map +1 -1
  158. package/build/esm/cc/BatteryCC.d.ts.map +1 -1
  159. package/build/esm/cc/BatteryCC.js +449 -384
  160. package/build/esm/cc/BatteryCC.js.map +1 -1
  161. package/build/esm/cc/BinarySensorCC.d.ts.map +1 -1
  162. package/build/esm/cc/BinarySensorCC.js +395 -297
  163. package/build/esm/cc/BinarySensorCC.js.map +1 -1
  164. package/build/esm/cc/BinarySwitchCC.d.ts.map +1 -1
  165. package/build/esm/cc/BinarySwitchCC.js +353 -274
  166. package/build/esm/cc/BinarySwitchCC.js.map +1 -1
  167. package/build/esm/cc/CRC16CC.js +162 -98
  168. package/build/esm/cc/CRC16CC.js.map +1 -1
  169. package/build/esm/cc/CentralSceneCC.d.ts.map +1 -1
  170. package/build/esm/cc/CentralSceneCC.js +465 -351
  171. package/build/esm/cc/CentralSceneCC.js.map +1 -1
  172. package/build/esm/cc/ClimateControlScheduleCC.d.ts.map +1 -1
  173. package/build/esm/cc/ClimateControlScheduleCC.js +454 -313
  174. package/build/esm/cc/ClimateControlScheduleCC.js.map +1 -1
  175. package/build/esm/cc/ClockCC.js +248 -159
  176. package/build/esm/cc/ClockCC.js.map +1 -1
  177. package/build/esm/cc/ColorSwitchCC.d.ts.map +1 -1
  178. package/build/esm/cc/ColorSwitchCC.js +802 -677
  179. package/build/esm/cc/ColorSwitchCC.js.map +1 -1
  180. package/build/esm/cc/ConfigurationCC.js +1899 -1687
  181. package/build/esm/cc/ConfigurationCC.js.map +1 -1
  182. package/build/esm/cc/DeviceResetLocallyCC.js +124 -59
  183. package/build/esm/cc/DeviceResetLocallyCC.js.map +1 -1
  184. package/build/esm/cc/DoorLockCC.d.ts.map +1 -1
  185. package/build/esm/cc/DoorLockCC.js +951 -849
  186. package/build/esm/cc/DoorLockCC.js.map +1 -1
  187. package/build/esm/cc/DoorLockLoggingCC.d.ts.map +1 -1
  188. package/build/esm/cc/DoorLockLoggingCC.js +316 -218
  189. package/build/esm/cc/DoorLockLoggingCC.js.map +1 -1
  190. package/build/esm/cc/EnergyProductionCC.js +240 -164
  191. package/build/esm/cc/EnergyProductionCC.js.map +1 -1
  192. package/build/esm/cc/EntryControlCC.d.ts.map +1 -1
  193. package/build/esm/cc/EntryControlCC.js +629 -493
  194. package/build/esm/cc/EntryControlCC.js.map +1 -1
  195. package/build/esm/cc/FirmwareUpdateMetaDataCC.d.ts.map +1 -1
  196. package/build/esm/cc/FirmwareUpdateMetaDataCC.js +938 -769
  197. package/build/esm/cc/FirmwareUpdateMetaDataCC.js.map +1 -1
  198. package/build/esm/cc/HailCC.js +51 -12
  199. package/build/esm/cc/HailCC.js.map +1 -1
  200. package/build/esm/cc/HumidityControlModeCC.d.ts.map +1 -1
  201. package/build/esm/cc/HumidityControlModeCC.js +357 -250
  202. package/build/esm/cc/HumidityControlModeCC.js.map +1 -1
  203. package/build/esm/cc/HumidityControlOperatingStateCC.d.ts.map +1 -1
  204. package/build/esm/cc/HumidityControlOperatingStateCC.js +182 -109
  205. package/build/esm/cc/HumidityControlOperatingStateCC.js.map +1 -1
  206. package/build/esm/cc/HumidityControlSetpointCC.d.ts.map +1 -1
  207. package/build/esm/cc/HumidityControlSetpointCC.js +706 -546
  208. package/build/esm/cc/HumidityControlSetpointCC.js.map +1 -1
  209. package/build/esm/cc/InclusionControllerCC.js +197 -119
  210. package/build/esm/cc/InclusionControllerCC.js.map +1 -1
  211. package/build/esm/cc/IndicatorCC.js +973 -835
  212. package/build/esm/cc/IndicatorCC.js.map +1 -1
  213. package/build/esm/cc/IrrigationCC.d.ts.map +1 -1
  214. package/build/esm/cc/IrrigationCC.js +1697 -1496
  215. package/build/esm/cc/IrrigationCC.js.map +1 -1
  216. package/build/esm/cc/LanguageCC.d.ts.map +1 -1
  217. package/build/esm/cc/LanguageCC.js +266 -184
  218. package/build/esm/cc/LanguageCC.js.map +1 -1
  219. package/build/esm/cc/LockCC.d.ts.map +1 -1
  220. package/build/esm/cc/LockCC.js +247 -162
  221. package/build/esm/cc/LockCC.js.map +1 -1
  222. package/build/esm/cc/ManufacturerProprietaryCC.js +192 -141
  223. package/build/esm/cc/ManufacturerProprietaryCC.js.map +1 -1
  224. package/build/esm/cc/ManufacturerSpecificCC.d.ts.map +1 -1
  225. package/build/esm/cc/ManufacturerSpecificCC.js +312 -223
  226. package/build/esm/cc/ManufacturerSpecificCC.js.map +1 -1
  227. package/build/esm/cc/MeterCC.d.ts.map +1 -1
  228. package/build/esm/cc/MeterCC.js +896 -795
  229. package/build/esm/cc/MeterCC.js.map +1 -1
  230. package/build/esm/cc/MultiChannelAssociationCC.d.ts.map +1 -1
  231. package/build/esm/cc/MultiChannelAssociationCC.js +631 -518
  232. package/build/esm/cc/MultiChannelAssociationCC.js.map +1 -1
  233. package/build/esm/cc/MultiChannelCC.d.ts.map +1 -1
  234. package/build/esm/cc/MultiChannelCC.js +1106 -921
  235. package/build/esm/cc/MultiChannelCC.js.map +1 -1
  236. package/build/esm/cc/MultiCommandCC.js +166 -102
  237. package/build/esm/cc/MultiCommandCC.js.map +1 -1
  238. package/build/esm/cc/MultilevelSensorCC.d.ts.map +1 -1
  239. package/build/esm/cc/MultilevelSensorCC.js +616 -497
  240. package/build/esm/cc/MultilevelSensorCC.js.map +1 -1
  241. package/build/esm/cc/MultilevelSwitchCC.d.ts.map +1 -1
  242. package/build/esm/cc/MultilevelSwitchCC.js +621 -496
  243. package/build/esm/cc/MultilevelSwitchCC.js.map +1 -1
  244. package/build/esm/cc/NoOperationCC.js +82 -29
  245. package/build/esm/cc/NoOperationCC.js.map +1 -1
  246. package/build/esm/cc/NodeNamingCC.d.ts.map +1 -1
  247. package/build/esm/cc/NodeNamingCC.js +413 -294
  248. package/build/esm/cc/NodeNamingCC.js.map +1 -1
  249. package/build/esm/cc/NotificationCC.d.ts.map +1 -1
  250. package/build/esm/cc/NotificationCC.js +1097 -966
  251. package/build/esm/cc/NotificationCC.js.map +1 -1
  252. package/build/esm/cc/PowerlevelCC.js +437 -311
  253. package/build/esm/cc/PowerlevelCC.js.map +1 -1
  254. package/build/esm/cc/ProtectionCC.d.ts.map +1 -1
  255. package/build/esm/cc/ProtectionCC.js +704 -543
  256. package/build/esm/cc/ProtectionCC.js.map +1 -1
  257. package/build/esm/cc/SceneActivationCC.d.ts.map +1 -1
  258. package/build/esm/cc/SceneActivationCC.js +157 -100
  259. package/build/esm/cc/SceneActivationCC.js.map +1 -1
  260. package/build/esm/cc/SceneActuatorConfigurationCC.js +357 -269
  261. package/build/esm/cc/SceneActuatorConfigurationCC.js.map +1 -1
  262. package/build/esm/cc/SceneControllerConfigurationCC.js +434 -346
  263. package/build/esm/cc/SceneControllerConfigurationCC.js.map +1 -1
  264. package/build/esm/cc/ScheduleEntryLockCC.d.ts.map +1 -1
  265. package/build/esm/cc/ScheduleEntryLockCC.js +1596 -1357
  266. package/build/esm/cc/ScheduleEntryLockCC.js.map +1 -1
  267. package/build/esm/cc/Security2CC.js +1633 -1406
  268. package/build/esm/cc/Security2CC.js.map +1 -1
  269. package/build/esm/cc/SecurityCC.js +876 -687
  270. package/build/esm/cc/SecurityCC.js.map +1 -1
  271. package/build/esm/cc/SoundSwitchCC.d.ts.map +1 -1
  272. package/build/esm/cc/SoundSwitchCC.js +689 -526
  273. package/build/esm/cc/SoundSwitchCC.js.map +1 -1
  274. package/build/esm/cc/SupervisionCC.js +349 -272
  275. package/build/esm/cc/SupervisionCC.js.map +1 -1
  276. package/build/esm/cc/ThermostatFanModeCC.d.ts.map +1 -1
  277. package/build/esm/cc/ThermostatFanModeCC.js +388 -284
  278. package/build/esm/cc/ThermostatFanModeCC.js.map +1 -1
  279. package/build/esm/cc/ThermostatFanStateCC.d.ts.map +1 -1
  280. package/build/esm/cc/ThermostatFanStateCC.js +184 -111
  281. package/build/esm/cc/ThermostatFanStateCC.js.map +1 -1
  282. package/build/esm/cc/ThermostatModeCC.d.ts.map +1 -1
  283. package/build/esm/cc/ThermostatModeCC.js +435 -331
  284. package/build/esm/cc/ThermostatModeCC.js.map +1 -1
  285. package/build/esm/cc/ThermostatOperatingStateCC.d.ts.map +1 -1
  286. package/build/esm/cc/ThermostatOperatingStateCC.js +180 -107
  287. package/build/esm/cc/ThermostatOperatingStateCC.js.map +1 -1
  288. package/build/esm/cc/ThermostatSetbackCC.js +274 -185
  289. package/build/esm/cc/ThermostatSetbackCC.js.map +1 -1
  290. package/build/esm/cc/ThermostatSetpointCC.d.ts.map +1 -1
  291. package/build/esm/cc/ThermostatSetpointCC.js +674 -543
  292. package/build/esm/cc/ThermostatSetpointCC.js.map +1 -1
  293. package/build/esm/cc/TimeCC.js +499 -360
  294. package/build/esm/cc/TimeCC.js.map +1 -1
  295. package/build/esm/cc/TimeParametersCC.d.ts.map +1 -1
  296. package/build/esm/cc/TimeParametersCC.js +296 -211
  297. package/build/esm/cc/TimeParametersCC.js.map +1 -1
  298. package/build/esm/cc/TransportServiceCC.js +464 -363
  299. package/build/esm/cc/TransportServiceCC.js.map +1 -1
  300. package/build/esm/cc/UserCodeCC.d.ts.map +1 -1
  301. package/build/esm/cc/UserCodeCC.js +1443 -1205
  302. package/build/esm/cc/UserCodeCC.js.map +1 -1
  303. package/build/esm/cc/VersionCC.d.ts.map +1 -1
  304. package/build/esm/cc/VersionCC.js +744 -635
  305. package/build/esm/cc/VersionCC.js.map +1 -1
  306. package/build/esm/cc/WakeUpCC.d.ts.map +1 -1
  307. package/build/esm/cc/WakeUpCC.js +494 -364
  308. package/build/esm/cc/WakeUpCC.js.map +1 -1
  309. package/build/esm/cc/WindowCoveringCC.d.ts.map +1 -1
  310. package/build/esm/cc/WindowCoveringCC.js +655 -530
  311. package/build/esm/cc/WindowCoveringCC.js.map +1 -1
  312. package/build/esm/cc/ZWaveLongRangeCC.js +51 -11
  313. package/build/esm/cc/ZWaveLongRangeCC.js.map +1 -1
  314. package/build/esm/cc/ZWavePlusCC.d.ts.map +1 -1
  315. package/build/esm/cc/ZWavePlusCC.js +223 -162
  316. package/build/esm/cc/ZWavePlusCC.js.map +1 -1
  317. package/build/esm/cc/ZWaveProtocolCC.js +1443 -953
  318. package/build/esm/cc/ZWaveProtocolCC.js.map +1 -1
  319. package/build/esm/cc/manufacturerProprietary/Decorators.d.ts +4 -4
  320. package/build/esm/cc/manufacturerProprietary/Decorators.d.ts.map +1 -1
  321. package/build/esm/cc/manufacturerProprietary/FibaroCC.js +390 -286
  322. package/build/esm/cc/manufacturerProprietary/FibaroCC.js.map +1 -1
  323. package/build/esm/lib/CommandClassDecorators.d.ts +11 -15
  324. package/build/esm/lib/CommandClassDecorators.d.ts.map +1 -1
  325. package/build/esm/lib/CommandClassDecorators.js +24 -24
  326. package/build/esm/lib/CommandClassDecorators.js.map +1 -1
  327. package/build/esm/lib/Security2/Extension.d.ts +1 -1
  328. package/build/esm/lib/Security2/Extension.d.ts.map +1 -1
  329. package/build/esm/lib/Security2/Extension.js +207 -123
  330. package/build/esm/lib/Security2/Extension.js.map +1 -1
  331. package/package.json +6 -6
@@ -1,10 +1,37 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
1
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
2
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
3
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
4
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
5
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
6
+ var _, done = false;
7
+ for (var i = decorators.length - 1; i >= 0; i--) {
8
+ var context = {};
9
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
10
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
11
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
12
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
13
+ if (kind === "accessor") {
14
+ if (result === void 0) continue;
15
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
16
+ if (_ = accept(result.get)) descriptor.get = _;
17
+ if (_ = accept(result.set)) descriptor.set = _;
18
+ if (_ = accept(result.init)) initializers.unshift(_);
19
+ }
20
+ else if (_ = accept(result)) {
21
+ if (kind === "field") initializers.unshift(_);
22
+ else descriptor[key] = _;
23
+ }
24
+ }
25
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
26
+ done = true;
27
+ };
28
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
29
+ var useValue = arguments.length > 2;
30
+ for (var i = 0; i < initializers.length; i++) {
31
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
32
+ }
33
+ return useValue ? value : void 0;
6
34
  };
7
- var IrrigationCC_1, IrrigationCCSystemInfoReport_1, IrrigationCCSystemStatusReport_1, IrrigationCCSystemConfigReport_1, IrrigationCCValveInfoReport_1, IrrigationCCValveConfigReport_1, IrrigationCCValveTableReport_1;
8
35
  function __assertType(argName, typeName, boundHasError) {
9
36
  const { ZWaveError, ZWaveErrorCodes } = require("@zwave-js/core");
10
37
  if (boundHasError()) {
@@ -219,7 +246,7 @@ import { getEnumMemberName, pick } from "@zwave-js/shared/safe";
219
246
  import { padStart } from "alcalzone-shared/strings/index.js";
220
247
  import { CCAPI, POLL_VALUE, SET_VALUE, throwMissingPropertyKey, throwUnsupportedProperty, throwUnsupportedPropertyKey, throwWrongValueType, } from "../lib/API.js";
221
248
  import { CommandClass, } from "../lib/CommandClass.js";
222
- import { API, CCCommand, ccValue, ccValues, commandClass, expectedCCResponse, implementedVersion, useSupervision, } from "../lib/CommandClassDecorators.js";
249
+ import { API, CCCommand, ccValueProperty, ccValues, commandClass, expectedCCResponse, implementedVersion, useSupervision, } from "../lib/CommandClassDecorators.js";
223
250
  import { V } from "../lib/Values.js";
224
251
  import { IrrigationCommand, IrrigationSensorPolarity, ValveType, } from "../lib/_Types.js";
225
252
  export const IrrigationCCValues = Object.freeze({
@@ -460,1579 +487,1753 @@ const valveConfigPropertyKeys = [
460
487
  "useRainSensor",
461
488
  "useMoistureSensor",
462
489
  ];
463
- let IrrigationCCAPI = class IrrigationCCAPI extends CCAPI {
464
- supportsCommand(cmd) {
465
- switch (cmd) {
466
- case IrrigationCommand.SystemInfoGet:
467
- case IrrigationCommand.SystemStatusGet:
468
- case IrrigationCommand.SystemConfigSet:
469
- case IrrigationCommand.SystemConfigGet:
470
- case IrrigationCommand.ValveInfoGet:
471
- case IrrigationCommand.ValveConfigSet:
472
- case IrrigationCommand.ValveConfigGet:
473
- case IrrigationCommand.ValveRun:
474
- case IrrigationCommand.ValveTableSet:
475
- case IrrigationCommand.ValveTableGet:
476
- case IrrigationCommand.ValveTableRun:
477
- case IrrigationCommand.SystemShutoff:
478
- // These are all mandatory in V1
479
- return true;
480
- }
481
- return super.supportsCommand(cmd);
482
- }
483
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
484
- async getSystemInfo() {
485
- this.assertSupportsCommand(IrrigationCommand, IrrigationCommand.SystemInfoGet);
486
- const cc = new IrrigationCCSystemInfoGet({
487
- nodeId: this.endpoint.nodeId,
488
- endpointIndex: this.endpoint.index,
489
- });
490
- const response = await this.host.sendCommand(cc, this.commandOptions);
491
- if (response) {
492
- return pick(response, [
493
- "numValves",
494
- "numValveTables",
495
- "supportsMasterValve",
496
- "maxValveTableSize",
497
- ]);
498
- }
499
- }
500
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
501
- async getSystemStatus() {
502
- this.assertSupportsCommand(IrrigationCommand, IrrigationCommand.SystemStatusGet);
503
- const cc = new IrrigationCCSystemStatusGet({
504
- nodeId: this.endpoint.nodeId,
505
- endpointIndex: this.endpoint.index,
506
- });
507
- const response = await this.host.sendCommand(cc, this.commandOptions);
508
- if (response) {
509
- return pick(response, [
510
- "systemVoltage",
511
- "flowSensorActive",
512
- "pressureSensorActive",
513
- "rainSensorActive",
514
- "moistureSensorActive",
515
- "flow",
516
- "pressure",
517
- "shutoffDuration",
518
- "errorNotProgrammed",
519
- "errorEmergencyShutdown",
520
- "errorHighPressure",
521
- "errorLowPressure",
522
- "errorValve",
523
- "masterValveOpen",
524
- "firstOpenZoneId",
525
- ]);
526
- }
527
- }
528
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
529
- async getSystemConfig() {
530
- this.assertSupportsCommand(IrrigationCommand, IrrigationCommand.SystemConfigGet);
531
- const cc = new IrrigationCCSystemConfigGet({
532
- nodeId: this.endpoint.nodeId,
533
- endpointIndex: this.endpoint.index,
534
- });
535
- const response = await this.host.sendCommand(cc, this.commandOptions);
536
- if (response) {
537
- return pick(response, [
538
- "masterValveDelay",
539
- "highPressureThreshold",
540
- "lowPressureThreshold",
541
- "rainSensorPolarity",
542
- "moistureSensorPolarity",
543
- ]);
490
+ let IrrigationCCAPI = (() => {
491
+ let _classDecorators = [API(CommandClasses.Irrigation)];
492
+ let _classDescriptor;
493
+ let _classExtraInitializers = [];
494
+ let _classThis;
495
+ let _classSuper = CCAPI;
496
+ var IrrigationCCAPI = class extends _classSuper {
497
+ static { _classThis = this; }
498
+ static {
499
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
500
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
501
+ IrrigationCCAPI = _classThis = _classDescriptor.value;
502
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
503
+ __runInitializers(_classThis, _classExtraInitializers);
504
+ }
505
+ supportsCommand(cmd) {
506
+ switch (cmd) {
507
+ case IrrigationCommand.SystemInfoGet:
508
+ case IrrigationCommand.SystemStatusGet:
509
+ case IrrigationCommand.SystemConfigSet:
510
+ case IrrigationCommand.SystemConfigGet:
511
+ case IrrigationCommand.ValveInfoGet:
512
+ case IrrigationCommand.ValveConfigSet:
513
+ case IrrigationCommand.ValveConfigGet:
514
+ case IrrigationCommand.ValveRun:
515
+ case IrrigationCommand.ValveTableSet:
516
+ case IrrigationCommand.ValveTableGet:
517
+ case IrrigationCommand.ValveTableRun:
518
+ case IrrigationCommand.SystemShutoff:
519
+ // These are all mandatory in V1
520
+ return true;
521
+ }
522
+ return super.supportsCommand(cmd);
523
+ }
524
+ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
525
+ async getSystemInfo() {
526
+ this.assertSupportsCommand(IrrigationCommand, IrrigationCommand.SystemInfoGet);
527
+ const cc = new IrrigationCCSystemInfoGet({
528
+ nodeId: this.endpoint.nodeId,
529
+ endpointIndex: this.endpoint.index,
530
+ });
531
+ const response = await this.host.sendCommand(cc, this.commandOptions);
532
+ if (response) {
533
+ return pick(response, [
534
+ "numValves",
535
+ "numValveTables",
536
+ "supportsMasterValve",
537
+ "maxValveTableSize",
538
+ ]);
539
+ }
544
540
  }
545
- }
546
- async setSystemConfig(config) {
547
- __assertType("config", "IrrigationCCSystemConfigSetOptions", __assertType__IrrigationCCSystemConfigSetOptions.bind(void 0, config));
548
- this.assertSupportsCommand(IrrigationCommand, IrrigationCommand.SystemConfigSet);
549
- const cc = new IrrigationCCSystemConfigSet({
550
- nodeId: this.endpoint.nodeId,
551
- endpointIndex: this.endpoint.index,
552
- ...config,
553
- });
554
- return this.host.sendCommand(cc, this.commandOptions);
555
- }
556
- async getValveInfo(valveId) {
557
- __assertType("valveId", "ValveId", __assertType__ValveId.bind(void 0, valveId));
558
- this.assertSupportsCommand(IrrigationCommand, IrrigationCommand.ValveInfoGet);
559
- const cc = new IrrigationCCValveInfoGet({
560
- nodeId: this.endpoint.nodeId,
561
- endpointIndex: this.endpoint.index,
562
- valveId,
563
- });
564
- const response = await this.host.sendCommand(cc, this.commandOptions);
565
- if (response) {
566
- return pick(response, [
567
- "connected",
568
- "nominalCurrent",
569
- "errorShortCircuit",
570
- "errorHighCurrent",
571
- "errorLowCurrent",
572
- "errorMaximumFlow",
573
- "errorHighFlow",
574
- "errorLowFlow",
575
- ]);
541
+ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
542
+ async getSystemStatus() {
543
+ this.assertSupportsCommand(IrrigationCommand, IrrigationCommand.SystemStatusGet);
544
+ const cc = new IrrigationCCSystemStatusGet({
545
+ nodeId: this.endpoint.nodeId,
546
+ endpointIndex: this.endpoint.index,
547
+ });
548
+ const response = await this.host.sendCommand(cc, this.commandOptions);
549
+ if (response) {
550
+ return pick(response, [
551
+ "systemVoltage",
552
+ "flowSensorActive",
553
+ "pressureSensorActive",
554
+ "rainSensorActive",
555
+ "moistureSensorActive",
556
+ "flow",
557
+ "pressure",
558
+ "shutoffDuration",
559
+ "errorNotProgrammed",
560
+ "errorEmergencyShutdown",
561
+ "errorHighPressure",
562
+ "errorLowPressure",
563
+ "errorValve",
564
+ "masterValveOpen",
565
+ "firstOpenZoneId",
566
+ ]);
567
+ }
576
568
  }
577
- }
578
- async setValveConfig(options) {
579
- __assertType("options", "IrrigationCCValveConfigSetOptions", __assertType__IrrigationCCValveConfigSetOptions.bind(void 0, options));
580
- this.assertSupportsCommand(IrrigationCommand, IrrigationCommand.ValveConfigSet);
581
- const cc = new IrrigationCCValveConfigSet({
582
- nodeId: this.endpoint.nodeId,
583
- endpointIndex: this.endpoint.index,
584
- ...options,
585
- });
586
- return this.host.sendCommand(cc, this.commandOptions);
587
- }
588
- async getValveConfig(valveId) {
589
- __assertType("valveId", "ValveId", __assertType__ValveId.bind(void 0, valveId));
590
- this.assertSupportsCommand(IrrigationCommand, IrrigationCommand.ValveConfigGet);
591
- const cc = new IrrigationCCValveConfigGet({
592
- nodeId: this.endpoint.nodeId,
593
- endpointIndex: this.endpoint.index,
594
- valveId,
595
- });
596
- const response = await this.host.sendCommand(cc, this.commandOptions);
597
- if (response) {
598
- return pick(response, [
599
- "nominalCurrentHighThreshold",
600
- "nominalCurrentLowThreshold",
601
- "maximumFlow",
602
- "highFlowThreshold",
603
- "lowFlowThreshold",
604
- "useRainSensor",
605
- "useMoistureSensor",
606
- ]);
569
+ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
570
+ async getSystemConfig() {
571
+ this.assertSupportsCommand(IrrigationCommand, IrrigationCommand.SystemConfigGet);
572
+ const cc = new IrrigationCCSystemConfigGet({
573
+ nodeId: this.endpoint.nodeId,
574
+ endpointIndex: this.endpoint.index,
575
+ });
576
+ const response = await this.host.sendCommand(cc, this.commandOptions);
577
+ if (response) {
578
+ return pick(response, [
579
+ "masterValveDelay",
580
+ "highPressureThreshold",
581
+ "lowPressureThreshold",
582
+ "rainSensorPolarity",
583
+ "moistureSensorPolarity",
584
+ ]);
585
+ }
607
586
  }
608
- }
609
- async runValve(valveId, duration) {
610
- __assertType("valveId", "ValveId", __assertType__ValveId.bind(void 0, valveId));
611
- __assertType("duration", "number", __assertType__number.bind(void 0, duration));
612
- this.assertSupportsCommand(IrrigationCommand, IrrigationCommand.ValveRun);
613
- const cc = new IrrigationCCValveRun({
614
- nodeId: this.endpoint.nodeId,
615
- endpointIndex: this.endpoint.index,
616
- valveId,
617
- duration,
618
- });
619
- return this.host.sendCommand(cc, this.commandOptions);
620
- }
621
- shutoffValve(valveId) {
622
- __assertType("valveId", "ValveId", __assertType__ValveId.bind(void 0, valveId));
623
- return this.runValve(valveId, 0);
624
- }
625
- async setValveTable(tableId, entries) {
626
- __assertType("tableId", "number", __assertType__number.bind(void 0, tableId));
627
- __assertType("entries", undefined, __assertType__sa__2_ea_2.bind(void 0, entries));
628
- this.assertSupportsCommand(IrrigationCommand, IrrigationCommand.ValveTableSet);
629
- if (!this.endpoint.virtual) {
630
- const maxValveTableSize = IrrigationCC.getMaxValveTableSizeCached(this.host, this.endpoint);
631
- if (maxValveTableSize != undefined
632
- && entries.length > maxValveTableSize) {
633
- throw new ZWaveError(`The number of valve table entries must not exceed ${maxValveTableSize}.`, ZWaveErrorCodes.Argument_Invalid);
587
+ async setSystemConfig(config) {
588
+ __assertType("config", "IrrigationCCSystemConfigSetOptions", __assertType__IrrigationCCSystemConfigSetOptions.bind(void 0, config));
589
+ this.assertSupportsCommand(IrrigationCommand, IrrigationCommand.SystemConfigSet);
590
+ const cc = new IrrigationCCSystemConfigSet({
591
+ nodeId: this.endpoint.nodeId,
592
+ endpointIndex: this.endpoint.index,
593
+ ...config,
594
+ });
595
+ return this.host.sendCommand(cc, this.commandOptions);
596
+ }
597
+ async getValveInfo(valveId) {
598
+ __assertType("valveId", "ValveId", __assertType__ValveId.bind(void 0, valveId));
599
+ this.assertSupportsCommand(IrrigationCommand, IrrigationCommand.ValveInfoGet);
600
+ const cc = new IrrigationCCValveInfoGet({
601
+ nodeId: this.endpoint.nodeId,
602
+ endpointIndex: this.endpoint.index,
603
+ valveId,
604
+ });
605
+ const response = await this.host.sendCommand(cc, this.commandOptions);
606
+ if (response) {
607
+ return pick(response, [
608
+ "connected",
609
+ "nominalCurrent",
610
+ "errorShortCircuit",
611
+ "errorHighCurrent",
612
+ "errorLowCurrent",
613
+ "errorMaximumFlow",
614
+ "errorHighFlow",
615
+ "errorLowFlow",
616
+ ]);
634
617
  }
635
618
  }
636
- const cc = new IrrigationCCValveTableSet({
637
- nodeId: this.endpoint.nodeId,
638
- endpointIndex: this.endpoint.index,
639
- tableId,
640
- entries,
641
- });
642
- return this.host.sendCommand(cc, this.commandOptions);
643
- }
644
- async getValveTable(tableId) {
645
- __assertType("tableId", "number", __assertType__number.bind(void 0, tableId));
646
- this.assertSupportsCommand(IrrigationCommand, IrrigationCommand.ValveTableGet);
647
- const cc = new IrrigationCCValveTableGet({
648
- nodeId: this.endpoint.nodeId,
649
- endpointIndex: this.endpoint.index,
650
- tableId,
651
- });
652
- const response = await this.host.sendCommand(cc, this.commandOptions);
653
- if (response) {
654
- return response?.entries;
619
+ async setValveConfig(options) {
620
+ __assertType("options", "IrrigationCCValveConfigSetOptions", __assertType__IrrigationCCValveConfigSetOptions.bind(void 0, options));
621
+ this.assertSupportsCommand(IrrigationCommand, IrrigationCommand.ValveConfigSet);
622
+ const cc = new IrrigationCCValveConfigSet({
623
+ nodeId: this.endpoint.nodeId,
624
+ endpointIndex: this.endpoint.index,
625
+ ...options,
626
+ });
627
+ return this.host.sendCommand(cc, this.commandOptions);
628
+ }
629
+ async getValveConfig(valveId) {
630
+ __assertType("valveId", "ValveId", __assertType__ValveId.bind(void 0, valveId));
631
+ this.assertSupportsCommand(IrrigationCommand, IrrigationCommand.ValveConfigGet);
632
+ const cc = new IrrigationCCValveConfigGet({
633
+ nodeId: this.endpoint.nodeId,
634
+ endpointIndex: this.endpoint.index,
635
+ valveId,
636
+ });
637
+ const response = await this.host.sendCommand(cc, this.commandOptions);
638
+ if (response) {
639
+ return pick(response, [
640
+ "nominalCurrentHighThreshold",
641
+ "nominalCurrentLowThreshold",
642
+ "maximumFlow",
643
+ "highFlowThreshold",
644
+ "lowFlowThreshold",
645
+ "useRainSensor",
646
+ "useMoistureSensor",
647
+ ]);
648
+ }
655
649
  }
656
- }
657
- async runTables(tableIDs) {
658
- __assertType("tableIDs", undefined, __assertType__sa__number_ea_2.bind(void 0, tableIDs));
659
- this.assertSupportsCommand(IrrigationCommand, IrrigationCommand.ValveTableRun);
660
- const cc = new IrrigationCCValveTableRun({
661
- nodeId: this.endpoint.nodeId,
662
- endpointIndex: this.endpoint.index,
663
- tableIDs,
664
- });
665
- return this.host.sendCommand(cc, this.commandOptions);
666
- }
667
- /**
668
- * Shuts off the entire system for the given duration.
669
- * @param duration Shutoff duration in hours. A value of 255 will shut off the entire system permanently and prevents schedules from running.
670
- */
671
- async shutoffSystem(duration) {
672
- __assertType("duration", "number", __assertType__number.bind(void 0, duration));
673
- this.assertSupportsCommand(IrrigationCommand, IrrigationCommand.SystemShutoff);
674
- const cc = new IrrigationCCSystemShutoff({
675
- nodeId: this.endpoint.nodeId,
676
- endpointIndex: this.endpoint.index,
677
- duration,
678
- });
679
- return this.host.sendCommand(cc, this.commandOptions);
680
- }
681
- /** Shuts off the entire system permanently and prevents schedules from running */
682
- shutoffSystemPermanently() {
683
- return this.shutoffSystem(255);
684
- }
685
- get [SET_VALUE]() {
686
- return async function ({ property, propertyKey }, value) {
687
- const valueDB = this.getValueDB();
688
- if (systemConfigProperties.includes(property)) {
689
- const options = {};
690
- for (const prop of systemConfigProperties) {
691
- if (prop === property)
692
- continue;
693
- const valueId = {
694
- commandClass: this.ccId,
695
- endpoint: this.endpoint.index,
696
- property: prop,
697
- };
698
- const cachedVal = valueDB.getValue(valueId);
699
- if (cachedVal == undefined) {
700
- throw new ZWaveError(`The "${property}" property cannot be changed before ${prop} is known!`, ZWaveErrorCodes.Argument_Invalid);
701
- }
702
- options[prop] = cachedVal;
650
+ async runValve(valveId, duration) {
651
+ __assertType("valveId", "ValveId", __assertType__ValveId.bind(void 0, valveId));
652
+ __assertType("duration", "number", __assertType__number.bind(void 0, duration));
653
+ this.assertSupportsCommand(IrrigationCommand, IrrigationCommand.ValveRun);
654
+ const cc = new IrrigationCCValveRun({
655
+ nodeId: this.endpoint.nodeId,
656
+ endpointIndex: this.endpoint.index,
657
+ valveId,
658
+ duration,
659
+ });
660
+ return this.host.sendCommand(cc, this.commandOptions);
661
+ }
662
+ shutoffValve(valveId) {
663
+ __assertType("valveId", "ValveId", __assertType__ValveId.bind(void 0, valveId));
664
+ return this.runValve(valveId, 0);
665
+ }
666
+ async setValveTable(tableId, entries) {
667
+ __assertType("tableId", "number", __assertType__number.bind(void 0, tableId));
668
+ __assertType("entries", undefined, __assertType__sa__2_ea_2.bind(void 0, entries));
669
+ this.assertSupportsCommand(IrrigationCommand, IrrigationCommand.ValveTableSet);
670
+ if (!this.endpoint.virtual) {
671
+ const maxValveTableSize = IrrigationCC.getMaxValveTableSizeCached(this.host, this.endpoint);
672
+ if (maxValveTableSize != undefined
673
+ && entries.length > maxValveTableSize) {
674
+ throw new ZWaveError(`The number of valve table entries must not exceed ${maxValveTableSize}.`, ZWaveErrorCodes.Argument_Invalid);
703
675
  }
704
- options[property] =
705
- value;
706
- return this.setSystemConfig(options);
707
676
  }
708
- else if (property === "shutoff") {
709
- return this.shutoffSystem(0);
677
+ const cc = new IrrigationCCValveTableSet({
678
+ nodeId: this.endpoint.nodeId,
679
+ endpointIndex: this.endpoint.index,
680
+ tableId,
681
+ entries,
682
+ });
683
+ return this.host.sendCommand(cc, this.commandOptions);
684
+ }
685
+ async getValveTable(tableId) {
686
+ __assertType("tableId", "number", __assertType__number.bind(void 0, tableId));
687
+ this.assertSupportsCommand(IrrigationCommand, IrrigationCommand.ValveTableGet);
688
+ const cc = new IrrigationCCValveTableGet({
689
+ nodeId: this.endpoint.nodeId,
690
+ endpointIndex: this.endpoint.index,
691
+ tableId,
692
+ });
693
+ const response = await this.host.sendCommand(cc, this.commandOptions);
694
+ if (response) {
695
+ return response?.entries;
710
696
  }
711
- else if (property === "master"
712
- || (typeof property === "number" && property >= 1)) {
713
- // This is a value of a valve
714
- if (propertyKey == undefined) {
715
- throwMissingPropertyKey(this.ccId, property);
716
- }
717
- if (valveConfigPropertyKeys.includes(propertyKey)) {
718
- const options = {
719
- valveId: property,
720
- };
721
- for (const prop of valveConfigPropertyKeys) {
722
- if (prop === propertyKey)
697
+ }
698
+ async runTables(tableIDs) {
699
+ __assertType("tableIDs", undefined, __assertType__sa__number_ea_2.bind(void 0, tableIDs));
700
+ this.assertSupportsCommand(IrrigationCommand, IrrigationCommand.ValveTableRun);
701
+ const cc = new IrrigationCCValveTableRun({
702
+ nodeId: this.endpoint.nodeId,
703
+ endpointIndex: this.endpoint.index,
704
+ tableIDs,
705
+ });
706
+ return this.host.sendCommand(cc, this.commandOptions);
707
+ }
708
+ /**
709
+ * Shuts off the entire system for the given duration.
710
+ * @param duration Shutoff duration in hours. A value of 255 will shut off the entire system permanently and prevents schedules from running.
711
+ */
712
+ async shutoffSystem(duration) {
713
+ __assertType("duration", "number", __assertType__number.bind(void 0, duration));
714
+ this.assertSupportsCommand(IrrigationCommand, IrrigationCommand.SystemShutoff);
715
+ const cc = new IrrigationCCSystemShutoff({
716
+ nodeId: this.endpoint.nodeId,
717
+ endpointIndex: this.endpoint.index,
718
+ duration,
719
+ });
720
+ return this.host.sendCommand(cc, this.commandOptions);
721
+ }
722
+ /** Shuts off the entire system permanently and prevents schedules from running */
723
+ shutoffSystemPermanently() {
724
+ return this.shutoffSystem(255);
725
+ }
726
+ get [SET_VALUE]() {
727
+ return async function ({ property, propertyKey }, value) {
728
+ const valueDB = this.getValueDB();
729
+ if (systemConfigProperties.includes(property)) {
730
+ const options = {};
731
+ for (const prop of systemConfigProperties) {
732
+ if (prop === property)
723
733
  continue;
724
734
  const valueId = {
725
735
  commandClass: this.ccId,
726
736
  endpoint: this.endpoint.index,
727
- property,
728
- propertyKey: prop,
737
+ property: prop,
729
738
  };
730
739
  const cachedVal = valueDB.getValue(valueId);
731
740
  if (cachedVal == undefined) {
732
- throw new ZWaveError(`The "${property}_${propertyKey}" property cannot be changed before ${property}_${prop} is known!`, ZWaveErrorCodes.Argument_Invalid);
741
+ throw new ZWaveError(`The "${property}" property cannot be changed before ${prop} is known!`, ZWaveErrorCodes.Argument_Invalid);
733
742
  }
734
743
  options[prop] = cachedVal;
735
744
  }
736
- options[propertyKey] = value;
737
- return this.setValveConfig(options);
745
+ options[property] =
746
+ value;
747
+ return this.setSystemConfig(options);
738
748
  }
739
- else if (propertyKey === "duration") {
740
- // The run duration needs to be set separately from triggering the run
741
- // So this is okay
742
- return;
749
+ else if (property === "shutoff") {
750
+ return this.shutoffSystem(0);
743
751
  }
744
- else if (propertyKey === "startStop") {
745
- // Trigger or stop a valve run, depending on the value
746
- if (typeof value !== "boolean") {
747
- throwWrongValueType(this.ccId, property, "boolean", typeof value);
752
+ else if (property === "master"
753
+ || (typeof property === "number" && property >= 1)) {
754
+ // This is a value of a valve
755
+ if (propertyKey == undefined) {
756
+ throwMissingPropertyKey(this.ccId, property);
757
+ }
758
+ if (valveConfigPropertyKeys.includes(propertyKey)) {
759
+ const options = {
760
+ valveId: property,
761
+ };
762
+ for (const prop of valveConfigPropertyKeys) {
763
+ if (prop === propertyKey)
764
+ continue;
765
+ const valueId = {
766
+ commandClass: this.ccId,
767
+ endpoint: this.endpoint.index,
768
+ property,
769
+ propertyKey: prop,
770
+ };
771
+ const cachedVal = valueDB.getValue(valueId);
772
+ if (cachedVal == undefined) {
773
+ throw new ZWaveError(`The "${property}_${propertyKey}" property cannot be changed before ${property}_${prop} is known!`, ZWaveErrorCodes.Argument_Invalid);
774
+ }
775
+ options[prop] = cachedVal;
776
+ }
777
+ options[propertyKey] = value;
778
+ return this.setValveConfig(options);
779
+ }
780
+ else if (propertyKey === "duration") {
781
+ // The run duration needs to be set separately from triggering the run
782
+ // So this is okay
783
+ return;
748
784
  }
749
- if (value) {
750
- // Start a valve run
751
- const duration = valueDB.getValue(IrrigationCCValues.valveRunDuration(property).endpoint(this.endpoint.index));
752
- if (duration == undefined) {
753
- throw new ZWaveError(`Cannot start a valve run without specifying a duration first!`, ZWaveErrorCodes.Argument_Invalid);
785
+ else if (propertyKey === "startStop") {
786
+ // Trigger or stop a valve run, depending on the value
787
+ if (typeof value !== "boolean") {
788
+ throwWrongValueType(this.ccId, property, "boolean", typeof value);
789
+ }
790
+ if (value) {
791
+ // Start a valve run
792
+ const duration = valueDB.getValue(IrrigationCCValues.valveRunDuration(property).endpoint(this.endpoint.index));
793
+ if (duration == undefined) {
794
+ throw new ZWaveError(`Cannot start a valve run without specifying a duration first!`, ZWaveErrorCodes.Argument_Invalid);
795
+ }
796
+ return this.runValve(property, duration);
797
+ }
798
+ else {
799
+ // Stop a valve run
800
+ return this.shutoffValve(property);
754
801
  }
755
- return this.runValve(property, duration);
756
802
  }
757
803
  else {
758
- // Stop a valve run
759
- return this.shutoffValve(property);
804
+ throwUnsupportedPropertyKey(this.ccId, property, propertyKey);
760
805
  }
761
806
  }
762
- else {
763
- throwUnsupportedPropertyKey(this.ccId, property, propertyKey);
807
+ };
808
+ }
809
+ get [POLL_VALUE]() {
810
+ return async function ({ property, propertyKey }) {
811
+ switch (property) {
812
+ case "systemVoltage":
813
+ case "flowSensorActive":
814
+ case "pressureSensorActive":
815
+ case "rainSensorActive":
816
+ case "moistureSensorActive":
817
+ case "flow":
818
+ case "pressure":
819
+ case "shutoffDuration":
820
+ case "errorNotProgrammed":
821
+ case "errorEmergencyShutdown":
822
+ case "errorHighPressure":
823
+ case "errorLowPressure":
824
+ case "errorValve":
825
+ case "masterValveOpen":
826
+ case "firstOpenZoneId":
827
+ return (await this.getSystemStatus())?.[property];
828
+ case "masterValveDelay":
829
+ case "highPressureThreshold":
830
+ case "lowPressureThreshold":
831
+ case "rainSensorPolarity":
832
+ case "moistureSensorPolarity":
833
+ return (await this.getSystemConfig())?.[property];
764
834
  }
765
- }
766
- };
767
- }
768
- get [POLL_VALUE]() {
769
- return async function ({ property, propertyKey }) {
770
- switch (property) {
771
- case "systemVoltage":
772
- case "flowSensorActive":
773
- case "pressureSensorActive":
774
- case "rainSensorActive":
775
- case "moistureSensorActive":
776
- case "flow":
777
- case "pressure":
778
- case "shutoffDuration":
779
- case "errorNotProgrammed":
780
- case "errorEmergencyShutdown":
781
- case "errorHighPressure":
782
- case "errorLowPressure":
783
- case "errorValve":
784
- case "masterValveOpen":
785
- case "firstOpenZoneId":
786
- return (await this.getSystemStatus())?.[property];
787
- case "masterValveDelay":
788
- case "highPressureThreshold":
789
- case "lowPressureThreshold":
790
- case "rainSensorPolarity":
791
- case "moistureSensorPolarity":
792
- return (await this.getSystemConfig())?.[property];
793
- }
794
- if (property === "master"
795
- || (typeof property === "number" && property >= 1)) {
796
- // This is a value of a valve
797
- switch (propertyKey) {
798
- case "connected":
799
- case "nominalCurrent":
800
- case "errorShortCircuit":
801
- case "errorHighCurrent":
802
- case "errorLowCurrent":
803
- case "errorMaximumFlow":
804
- case "errorHighFlow":
805
- case "errorLowFlow":
806
- return (await this.getValveInfo(property))?.[propertyKey];
807
- case "nominalCurrentHighThreshold":
808
- case "nominalCurrentLowThreshold":
809
- case "maximumFlow":
810
- case "highFlowThreshold":
811
- case "lowFlowThreshold":
812
- case "useRainSensor":
813
- case "useMoistureSensor":
814
- return (await this.getValveConfig(property))?.[propertyKey];
815
- case undefined:
816
- throwMissingPropertyKey(this.ccId, property);
817
- default:
818
- throwUnsupportedPropertyKey(this.ccId, property, propertyKey);
835
+ if (property === "master"
836
+ || (typeof property === "number" && property >= 1)) {
837
+ // This is a value of a valve
838
+ switch (propertyKey) {
839
+ case "connected":
840
+ case "nominalCurrent":
841
+ case "errorShortCircuit":
842
+ case "errorHighCurrent":
843
+ case "errorLowCurrent":
844
+ case "errorMaximumFlow":
845
+ case "errorHighFlow":
846
+ case "errorLowFlow":
847
+ return (await this.getValveInfo(property))?.[propertyKey];
848
+ case "nominalCurrentHighThreshold":
849
+ case "nominalCurrentLowThreshold":
850
+ case "maximumFlow":
851
+ case "highFlowThreshold":
852
+ case "lowFlowThreshold":
853
+ case "useRainSensor":
854
+ case "useMoistureSensor":
855
+ return (await this.getValveConfig(property))?.[propertyKey];
856
+ case undefined:
857
+ throwMissingPropertyKey(this.ccId, property);
858
+ default:
859
+ throwUnsupportedPropertyKey(this.ccId, property, propertyKey);
860
+ }
819
861
  }
820
- }
821
- throwUnsupportedProperty(this.ccId, property);
822
- };
823
- }
824
- };
825
- IrrigationCCAPI = __decorate([
826
- API(CommandClasses.Irrigation)
827
- ], IrrigationCCAPI);
862
+ throwUnsupportedProperty(this.ccId, property);
863
+ };
864
+ }
865
+ };
866
+ return IrrigationCCAPI = _classThis;
867
+ })();
828
868
  export { IrrigationCCAPI };
829
- let IrrigationCC = IrrigationCC_1 = class IrrigationCC extends CommandClass {
830
- /**
831
- * Returns the maximum number of valve table entries reported by the node.
832
- * This only works AFTER the node has been interviewed.
833
- */
834
- static getMaxValveTableSizeCached(ctx, endpoint) {
835
- return ctx
836
- .getValueDB(endpoint.nodeId)
837
- .getValue(IrrigationCCValues.maxValveTableSize.endpoint(endpoint.index));
838
- }
839
- /**
840
- * Returns the number of zone valves reported by the node.
841
- * This only works AFTER the node has been interviewed.
842
- */
843
- static getNumValvesCached(ctx, endpoint) {
844
- return ctx
845
- .getValueDB(endpoint.nodeId)
846
- .getValue(IrrigationCCValues.numValves.endpoint(endpoint.index));
847
- }
848
- /**
849
- * Returns whether the node supports a master valve
850
- * This only works AFTER the node has been interviewed.
851
- */
852
- static supportsMasterValveCached(ctx, endpoint) {
853
- return !!ctx
854
- .getValueDB(endpoint.nodeId)
855
- .getValue(IrrigationCCValues.supportsMasterValve.endpoint(endpoint.index));
856
- }
857
- async interview(ctx) {
858
- const node = this.getNode(ctx);
859
- const endpoint = this.getEndpoint(ctx);
860
- const api = CCAPI.create(CommandClasses.Irrigation, ctx, endpoint).withOptions({
861
- priority: MessagePriority.NodeQuery,
862
- });
863
- ctx.logNode(node.id, {
864
- endpoint: this.endpointIndex,
865
- message: `Interviewing ${this.ccName}...`,
866
- direction: "none",
867
- });
868
- ctx.logNode(node.id, {
869
- endpoint: this.endpointIndex,
870
- message: "Querying irrigation system info...",
871
- direction: "outbound",
872
- });
873
- const systemInfo = await api.getSystemInfo();
874
- if (!systemInfo) {
869
+ let IrrigationCC = (() => {
870
+ let _classDecorators = [commandClass(CommandClasses.Irrigation), implementedVersion(1), ccValues(IrrigationCCValues)];
871
+ let _classDescriptor;
872
+ let _classExtraInitializers = [];
873
+ let _classThis;
874
+ let _classSuper = CommandClass;
875
+ var IrrigationCC = class extends _classSuper {
876
+ static { _classThis = this; }
877
+ static {
878
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
879
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
880
+ IrrigationCC = _classThis = _classDescriptor.value;
881
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
882
+ __runInitializers(_classThis, _classExtraInitializers);
883
+ }
884
+ /**
885
+ * Returns the maximum number of valve table entries reported by the node.
886
+ * This only works AFTER the node has been interviewed.
887
+ */
888
+ static getMaxValveTableSizeCached(ctx, endpoint) {
889
+ return ctx
890
+ .getValueDB(endpoint.nodeId)
891
+ .getValue(IrrigationCCValues.maxValveTableSize.endpoint(endpoint.index));
892
+ }
893
+ /**
894
+ * Returns the number of zone valves reported by the node.
895
+ * This only works AFTER the node has been interviewed.
896
+ */
897
+ static getNumValvesCached(ctx, endpoint) {
898
+ return ctx
899
+ .getValueDB(endpoint.nodeId)
900
+ .getValue(IrrigationCCValues.numValves.endpoint(endpoint.index));
901
+ }
902
+ /**
903
+ * Returns whether the node supports a master valve
904
+ * This only works AFTER the node has been interviewed.
905
+ */
906
+ static supportsMasterValveCached(ctx, endpoint) {
907
+ return !!ctx
908
+ .getValueDB(endpoint.nodeId)
909
+ .getValue(IrrigationCCValues.supportsMasterValve.endpoint(endpoint.index));
910
+ }
911
+ async interview(ctx) {
912
+ const node = this.getNode(ctx);
913
+ const endpoint = this.getEndpoint(ctx);
914
+ const api = CCAPI.create(CommandClasses.Irrigation, ctx, endpoint).withOptions({
915
+ priority: MessagePriority.NodeQuery,
916
+ });
875
917
  ctx.logNode(node.id, {
876
918
  endpoint: this.endpointIndex,
877
- message: "Time out while querying irrigation system info, skipping interview...",
878
- level: "warn",
919
+ message: `Interviewing ${this.ccName}...`,
920
+ direction: "none",
879
921
  });
880
- return;
881
- }
882
- const logMessage = `received irrigation system info:
922
+ ctx.logNode(node.id, {
923
+ endpoint: this.endpointIndex,
924
+ message: "Querying irrigation system info...",
925
+ direction: "outbound",
926
+ });
927
+ const systemInfo = await api.getSystemInfo();
928
+ if (!systemInfo) {
929
+ ctx.logNode(node.id, {
930
+ endpoint: this.endpointIndex,
931
+ message: "Time out while querying irrigation system info, skipping interview...",
932
+ level: "warn",
933
+ });
934
+ return;
935
+ }
936
+ const logMessage = `received irrigation system info:
883
937
  supports master valve: ${systemInfo.supportsMasterValve}
884
938
  no. of valves: ${systemInfo.numValves}
885
939
  no. of valve tables: ${systemInfo.numValveTables}
886
940
  max. valve table size: ${systemInfo.maxValveTableSize}`;
887
- ctx.logNode(node.id, {
888
- endpoint: this.endpointIndex,
889
- message: logMessage,
890
- direction: "inbound",
891
- });
892
- // For each valve, create the values to start/stop a run
893
- for (let i = 1; i <= systemInfo.numValves; i++) {
894
- this.ensureMetadata(ctx, IrrigationCCValues.valveRunDuration(i));
895
- this.ensureMetadata(ctx, IrrigationCCValues.valveRunStartStop(i));
896
- }
897
- // And create a shutoff value
898
- this.ensureMetadata(ctx, IrrigationCCValues.shutoffSystem);
899
- // Query current values
900
- await this.refreshValues(ctx);
901
- // Remember that the interview is complete
902
- this.setInterviewComplete(ctx, true);
903
- }
904
- async refreshValues(ctx) {
905
- const node = this.getNode(ctx);
906
- const endpoint = this.getEndpoint(ctx);
907
- const api = CCAPI.create(CommandClasses.Irrigation, ctx, endpoint).withOptions({
908
- priority: MessagePriority.NodeQuery,
909
- });
910
- // Query the current system config
911
- ctx.logNode(node.id, {
912
- endpoint: this.endpointIndex,
913
- message: "Querying irrigation system configuration...",
914
- direction: "outbound",
915
- });
916
- const systemConfig = await api.getSystemConfig();
917
- if (systemConfig) {
918
- let logMessage = `received irrigation system configuration:
919
- master valve delay: ${systemConfig.masterValveDelay} seconds
920
- high pressure threshold: ${systemConfig.highPressureThreshold} kPa
921
- low pressure threshold: ${systemConfig.lowPressureThreshold} kPa`;
922
- if (systemConfig.rainSensorPolarity != undefined) {
923
- logMessage += `
924
- rain sensor polarity: ${getEnumMemberName(IrrigationSensorPolarity, systemConfig.rainSensorPolarity)}`;
925
- }
926
- if (systemConfig.moistureSensorPolarity != undefined) {
927
- logMessage += `
928
- moisture sensor polarity: ${getEnumMemberName(IrrigationSensorPolarity, systemConfig.moistureSensorPolarity)}`;
929
- }
930
941
  ctx.logNode(node.id, {
931
942
  endpoint: this.endpointIndex,
932
943
  message: logMessage,
933
944
  direction: "inbound",
934
945
  });
935
- }
936
- // and status
937
- // Query the current system config
938
- ctx.logNode(node.id, {
939
- endpoint: this.endpointIndex,
940
- message: "Querying irrigation system status...",
941
- direction: "outbound",
942
- });
943
- await api.getSystemStatus();
944
- // for each valve, query the current status and configuration
945
- if (IrrigationCC_1.supportsMasterValveCached(ctx, endpoint)) {
946
- ctx.logNode(node.id, {
947
- endpoint: this.endpointIndex,
948
- message: "Querying master valve configuration...",
949
- direction: "outbound",
950
- });
951
- await api.getValveConfig("master");
952
- ctx.logNode(node.id, {
953
- endpoint: this.endpointIndex,
954
- message: "Querying master valve status...",
955
- direction: "outbound",
946
+ // For each valve, create the values to start/stop a run
947
+ for (let i = 1; i <= systemInfo.numValves; i++) {
948
+ this.ensureMetadata(ctx, IrrigationCCValues.valveRunDuration(i));
949
+ this.ensureMetadata(ctx, IrrigationCCValues.valveRunStartStop(i));
950
+ }
951
+ // And create a shutoff value
952
+ this.ensureMetadata(ctx, IrrigationCCValues.shutoffSystem);
953
+ // Query current values
954
+ await this.refreshValues(ctx);
955
+ // Remember that the interview is complete
956
+ this.setInterviewComplete(ctx, true);
957
+ }
958
+ async refreshValues(ctx) {
959
+ const node = this.getNode(ctx);
960
+ const endpoint = this.getEndpoint(ctx);
961
+ const api = CCAPI.create(CommandClasses.Irrigation, ctx, endpoint).withOptions({
962
+ priority: MessagePriority.NodeQuery,
956
963
  });
957
- await api.getValveInfo("master");
958
- }
959
- for (let i = 1; i <= (IrrigationCC_1.getNumValvesCached(ctx, endpoint) ?? 0); i++) {
964
+ // Query the current system config
960
965
  ctx.logNode(node.id, {
961
966
  endpoint: this.endpointIndex,
962
- message: `Querying configuration for valve ${padStart(i.toString(), 3, "0")}...`,
967
+ message: "Querying irrigation system configuration...",
963
968
  direction: "outbound",
964
969
  });
965
- await api.getValveConfig(i);
970
+ const systemConfig = await api.getSystemConfig();
971
+ if (systemConfig) {
972
+ let logMessage = `received irrigation system configuration:
973
+ master valve delay: ${systemConfig.masterValveDelay} seconds
974
+ high pressure threshold: ${systemConfig.highPressureThreshold} kPa
975
+ low pressure threshold: ${systemConfig.lowPressureThreshold} kPa`;
976
+ if (systemConfig.rainSensorPolarity != undefined) {
977
+ logMessage += `
978
+ rain sensor polarity: ${getEnumMemberName(IrrigationSensorPolarity, systemConfig.rainSensorPolarity)}`;
979
+ }
980
+ if (systemConfig.moistureSensorPolarity != undefined) {
981
+ logMessage += `
982
+ moisture sensor polarity: ${getEnumMemberName(IrrigationSensorPolarity, systemConfig.moistureSensorPolarity)}`;
983
+ }
984
+ ctx.logNode(node.id, {
985
+ endpoint: this.endpointIndex,
986
+ message: logMessage,
987
+ direction: "inbound",
988
+ });
989
+ }
990
+ // and status
991
+ // Query the current system config
966
992
  ctx.logNode(node.id, {
967
993
  endpoint: this.endpointIndex,
968
- message: `Querying status for valve ${padStart(i.toString(), 3, "0")}...`,
994
+ message: "Querying irrigation system status...",
969
995
  direction: "outbound",
970
996
  });
971
- await api.getValveInfo(i);
972
- }
973
- }
974
- translateProperty(ctx, property, propertyKey) {
975
- if (property === "master") {
976
- return "Master valve";
997
+ await api.getSystemStatus();
998
+ // for each valve, query the current status and configuration
999
+ if (IrrigationCC.supportsMasterValveCached(ctx, endpoint)) {
1000
+ ctx.logNode(node.id, {
1001
+ endpoint: this.endpointIndex,
1002
+ message: "Querying master valve configuration...",
1003
+ direction: "outbound",
1004
+ });
1005
+ await api.getValveConfig("master");
1006
+ ctx.logNode(node.id, {
1007
+ endpoint: this.endpointIndex,
1008
+ message: "Querying master valve status...",
1009
+ direction: "outbound",
1010
+ });
1011
+ await api.getValveInfo("master");
1012
+ }
1013
+ for (let i = 1; i <= (IrrigationCC.getNumValvesCached(ctx, endpoint) ?? 0); i++) {
1014
+ ctx.logNode(node.id, {
1015
+ endpoint: this.endpointIndex,
1016
+ message: `Querying configuration for valve ${padStart(i.toString(), 3, "0")}...`,
1017
+ direction: "outbound",
1018
+ });
1019
+ await api.getValveConfig(i);
1020
+ ctx.logNode(node.id, {
1021
+ endpoint: this.endpointIndex,
1022
+ message: `Querying status for valve ${padStart(i.toString(), 3, "0")}...`,
1023
+ direction: "outbound",
1024
+ });
1025
+ await api.getValveInfo(i);
1026
+ }
977
1027
  }
978
- else if (typeof property === "number") {
979
- return `Valve ${padStart(property.toString(), 3, "0")}`;
1028
+ translateProperty(ctx, property, propertyKey) {
1029
+ if (property === "master") {
1030
+ return "Master valve";
1031
+ }
1032
+ else if (typeof property === "number") {
1033
+ return `Valve ${padStart(property.toString(), 3, "0")}`;
1034
+ }
1035
+ return super.translateProperty(ctx, property, propertyKey);
980
1036
  }
981
- return super.translateProperty(ctx, property, propertyKey);
982
- }
983
- };
984
- IrrigationCC = IrrigationCC_1 = __decorate([
985
- commandClass(CommandClasses.Irrigation),
986
- implementedVersion(1),
987
- ccValues(IrrigationCCValues)
988
- ], IrrigationCC);
1037
+ };
1038
+ return IrrigationCC = _classThis;
1039
+ })();
989
1040
  export { IrrigationCC };
990
- let IrrigationCCSystemInfoReport = IrrigationCCSystemInfoReport_1 = class IrrigationCCSystemInfoReport extends IrrigationCC {
991
- constructor(options) {
992
- super(options);
993
- // TODO: Check implementation:
994
- this.supportsMasterValve = options.supportsMasterValve;
995
- this.numValves = options.numValves;
996
- this.numValveTables = options.numValveTables;
997
- this.maxValveTableSize = options.maxValveTableSize;
998
- }
999
- static from(raw, ctx) {
1000
- validatePayload(raw.payload.length >= 4);
1001
- const supportsMasterValve = !!(raw.payload[0] & 0x01);
1002
- const numValves = raw.payload[1];
1003
- const numValveTables = raw.payload[2];
1004
- const maxValveTableSize = raw.payload[3] & 0b1111;
1005
- return new IrrigationCCSystemInfoReport_1({
1006
- nodeId: ctx.sourceNodeId,
1007
- supportsMasterValve,
1008
- numValves,
1009
- numValveTables,
1010
- maxValveTableSize,
1011
- });
1012
- }
1013
- numValves;
1014
- numValveTables;
1015
- supportsMasterValve;
1016
- maxValveTableSize;
1017
- toLogEntry(ctx) {
1018
- return {
1019
- ...super.toLogEntry(ctx),
1020
- message: {
1021
- "supports master valve": this.supportsMasterValve,
1022
- "no. of valves": this.numValves,
1023
- "no. of valve tables": this.numValveTables,
1024
- "max. valve table size": this.maxValveTableSize,
1025
- },
1026
- };
1027
- }
1028
- };
1029
- __decorate([
1030
- ccValue(IrrigationCCValues.numValves)
1031
- ], IrrigationCCSystemInfoReport.prototype, "numValves", void 0);
1032
- __decorate([
1033
- ccValue(IrrigationCCValues.numValveTables)
1034
- ], IrrigationCCSystemInfoReport.prototype, "numValveTables", void 0);
1035
- __decorate([
1036
- ccValue(IrrigationCCValues.supportsMasterValve)
1037
- ], IrrigationCCSystemInfoReport.prototype, "supportsMasterValve", void 0);
1038
- __decorate([
1039
- ccValue(IrrigationCCValues.maxValveTableSize)
1040
- ], IrrigationCCSystemInfoReport.prototype, "maxValveTableSize", void 0);
1041
- IrrigationCCSystemInfoReport = IrrigationCCSystemInfoReport_1 = __decorate([
1042
- CCCommand(IrrigationCommand.SystemInfoReport)
1043
- ], IrrigationCCSystemInfoReport);
1041
+ let IrrigationCCSystemInfoReport = (() => {
1042
+ let _classDecorators = [CCCommand(IrrigationCommand.SystemInfoReport), ccValueProperty("numValves", IrrigationCCValues.numValves), ccValueProperty("numValveTables", IrrigationCCValues.numValveTables), ccValueProperty("supportsMasterValve", IrrigationCCValues.supportsMasterValve), ccValueProperty("maxValveTableSize", IrrigationCCValues.maxValveTableSize)];
1043
+ let _classDescriptor;
1044
+ let _classExtraInitializers = [];
1045
+ let _classThis;
1046
+ let _classSuper = IrrigationCC;
1047
+ var IrrigationCCSystemInfoReport = class extends _classSuper {
1048
+ static { _classThis = this; }
1049
+ static {
1050
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1051
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1052
+ IrrigationCCSystemInfoReport = _classThis = _classDescriptor.value;
1053
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1054
+ __runInitializers(_classThis, _classExtraInitializers);
1055
+ }
1056
+ constructor(options) {
1057
+ super(options);
1058
+ // TODO: Check implementation:
1059
+ this.supportsMasterValve = options.supportsMasterValve;
1060
+ this.numValves = options.numValves;
1061
+ this.numValveTables = options.numValveTables;
1062
+ this.maxValveTableSize = options.maxValveTableSize;
1063
+ }
1064
+ static from(raw, ctx) {
1065
+ validatePayload(raw.payload.length >= 4);
1066
+ const supportsMasterValve = !!(raw.payload[0] & 0x01);
1067
+ const numValves = raw.payload[1];
1068
+ const numValveTables = raw.payload[2];
1069
+ const maxValveTableSize = raw.payload[3] & 0b1111;
1070
+ return new this({
1071
+ nodeId: ctx.sourceNodeId,
1072
+ supportsMasterValve,
1073
+ numValves,
1074
+ numValveTables,
1075
+ maxValveTableSize,
1076
+ });
1077
+ }
1078
+ numValves;
1079
+ numValveTables;
1080
+ supportsMasterValve;
1081
+ maxValveTableSize;
1082
+ toLogEntry(ctx) {
1083
+ return {
1084
+ ...super.toLogEntry(ctx),
1085
+ message: {
1086
+ "supports master valve": this.supportsMasterValve,
1087
+ "no. of valves": this.numValves,
1088
+ "no. of valve tables": this.numValveTables,
1089
+ "max. valve table size": this.maxValveTableSize,
1090
+ },
1091
+ };
1092
+ }
1093
+ };
1094
+ return IrrigationCCSystemInfoReport = _classThis;
1095
+ })();
1044
1096
  export { IrrigationCCSystemInfoReport };
1045
- let IrrigationCCSystemInfoGet = class IrrigationCCSystemInfoGet extends IrrigationCC {
1046
- };
1047
- IrrigationCCSystemInfoGet = __decorate([
1048
- CCCommand(IrrigationCommand.SystemInfoGet),
1049
- expectedCCResponse(IrrigationCCSystemInfoReport)
1050
- ], IrrigationCCSystemInfoGet);
1097
+ let IrrigationCCSystemInfoGet = (() => {
1098
+ let _classDecorators = [CCCommand(IrrigationCommand.SystemInfoGet), expectedCCResponse(IrrigationCCSystemInfoReport)];
1099
+ let _classDescriptor;
1100
+ let _classExtraInitializers = [];
1101
+ let _classThis;
1102
+ let _classSuper = IrrigationCC;
1103
+ var IrrigationCCSystemInfoGet = class extends _classSuper {
1104
+ static { _classThis = this; }
1105
+ static {
1106
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1107
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1108
+ IrrigationCCSystemInfoGet = _classThis = _classDescriptor.value;
1109
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1110
+ __runInitializers(_classThis, _classExtraInitializers);
1111
+ }
1112
+ };
1113
+ return IrrigationCCSystemInfoGet = _classThis;
1114
+ })();
1051
1115
  export { IrrigationCCSystemInfoGet };
1052
- let IrrigationCCSystemStatusReport = IrrigationCCSystemStatusReport_1 = class IrrigationCCSystemStatusReport extends IrrigationCC {
1053
- constructor(options) {
1054
- super(options);
1055
- // TODO: Check implementation:
1056
- this.systemVoltage = options.systemVoltage;
1057
- this.flowSensorActive = options.flowSensorActive;
1058
- this.pressureSensorActive = options.pressureSensorActive;
1059
- this.rainSensorActive = options.rainSensorActive;
1060
- this.moistureSensorActive = options.moistureSensorActive;
1061
- this.flow = options.flow;
1062
- this.pressure = options.pressure;
1063
- this.shutoffDuration = options.shutoffDuration;
1064
- this.errorNotProgrammed = options.errorNotProgrammed;
1065
- this.errorEmergencyShutdown = options.errorEmergencyShutdown;
1066
- this.errorHighPressure = options.errorHighPressure;
1067
- this.errorLowPressure = options.errorLowPressure;
1068
- this.errorValve = options.errorValve;
1069
- this.masterValveOpen = options.masterValveOpen;
1070
- this.firstOpenZoneId = options.firstOpenZoneId;
1071
- }
1072
- static from(raw, ctx) {
1073
- validatePayload(raw.payload.length >= 2);
1074
- const systemVoltage = raw.payload[0];
1075
- const flowSensorActive = !!(raw.payload[1] & 0x01);
1076
- const pressureSensorActive = !!(raw.payload[1] & 0x02);
1077
- const rainSensorActive = !!(raw.payload[1] & 0x04);
1078
- const moistureSensorActive = !!(raw.payload[1] & 0x08);
1079
- let offset = 2;
1080
- let flow;
1081
- {
1082
- const { value, scale, bytesRead } = parseFloatWithScale(raw.payload.subarray(offset));
1083
- validatePayload(scale === 0);
1084
- if (flowSensorActive)
1085
- flow = value;
1086
- offset += bytesRead;
1087
- }
1088
- let pressure;
1089
- {
1090
- const { value, scale, bytesRead } = parseFloatWithScale(raw.payload.subarray(offset));
1091
- validatePayload(scale === 0);
1092
- if (pressureSensorActive)
1093
- pressure = value;
1094
- offset += bytesRead;
1095
- }
1096
- validatePayload(raw.payload.length >= offset + 4);
1097
- const shutoffDuration = raw.payload[offset];
1098
- const errorNotProgrammed = !!(raw.payload[offset + 1] & 0x01);
1099
- const errorEmergencyShutdown = !!(raw.payload[offset + 1] & 0x02);
1100
- const errorHighPressure = !!(raw.payload[offset + 1] & 0x04);
1101
- const errorLowPressure = !!(raw.payload[offset + 1] & 0x08);
1102
- const errorValve = !!(raw.payload[offset + 1] & 0x10);
1103
- const masterValveOpen = !!(raw.payload[offset + 2] & 0x01);
1104
- let firstOpenZoneId;
1105
- if (raw.payload[offset + 3]) {
1106
- firstOpenZoneId = raw.payload[offset + 3];
1107
- }
1108
- return new IrrigationCCSystemStatusReport_1({
1109
- nodeId: ctx.sourceNodeId,
1110
- systemVoltage,
1111
- flowSensorActive,
1112
- pressureSensorActive,
1113
- rainSensorActive,
1114
- moistureSensorActive,
1115
- flow,
1116
- pressure,
1117
- shutoffDuration,
1118
- errorNotProgrammed,
1119
- errorEmergencyShutdown,
1120
- errorHighPressure,
1121
- errorLowPressure,
1122
- errorValve,
1123
- masterValveOpen,
1124
- firstOpenZoneId,
1125
- });
1126
- }
1127
- systemVoltage;
1128
- flowSensorActive;
1129
- pressureSensorActive;
1130
- rainSensorActive;
1131
- moistureSensorActive;
1132
- flow;
1133
- pressure;
1134
- shutoffDuration;
1135
- errorNotProgrammed;
1136
- errorEmergencyShutdown;
1137
- errorHighPressure;
1138
- errorLowPressure;
1139
- errorValve;
1140
- masterValveOpen;
1141
- firstOpenZoneId;
1142
- toLogEntry(ctx) {
1143
- const message = {
1144
- "system voltage": `${this.systemVoltage} V`,
1145
- "active sensors": [
1146
- this.flowSensorActive ? "flow" : undefined,
1147
- this.pressureSensorActive ? "pressure" : undefined,
1148
- this.rainSensorActive ? "rain" : undefined,
1149
- this.moistureSensorActive ? "moisture" : undefined,
1150
- ]
1151
- .filter(Boolean)
1152
- .join(", "),
1153
- };
1154
- if (this.flow != undefined) {
1155
- message.flow = `${this.flow} l/h`;
1156
- }
1157
- if (this.pressure != undefined) {
1158
- message.pressure = `${this.pressure} kPa`;
1159
- }
1160
- message["remaining shutoff duration"] = `${this.shutoffDuration} hours`;
1161
- message["master valve status"] = this.masterValveOpen
1162
- ? "open"
1163
- : "closed";
1164
- message["first open zone valve"] = this.firstOpenZoneId || "none";
1165
- const errors = [
1166
- this.errorNotProgrammed ? "device not programmed" : undefined,
1167
- this.errorEmergencyShutdown ? "emergency shutdown" : undefined,
1168
- this.errorHighPressure
1169
- ? "high pressure threshold triggered"
1170
- : undefined,
1171
- this.errorLowPressure
1172
- ? "low pressure threshold triggered"
1173
- : undefined,
1174
- this.errorValve
1175
- ? "a valve or the master valve has an error"
1176
- : undefined,
1177
- ].filter(Boolean);
1178
- if (errors.length > 0) {
1179
- message.errors = errors.map((e) => `\n· ${e}`).join("");
1180
- }
1181
- return {
1182
- ...super.toLogEntry(ctx),
1183
- message,
1184
- };
1185
- }
1186
- };
1187
- __decorate([
1188
- ccValue(IrrigationCCValues.systemVoltage)
1189
- ], IrrigationCCSystemStatusReport.prototype, "systemVoltage", void 0);
1190
- __decorate([
1191
- ccValue(IrrigationCCValues.flowSensorActive)
1192
- ], IrrigationCCSystemStatusReport.prototype, "flowSensorActive", void 0);
1193
- __decorate([
1194
- ccValue(IrrigationCCValues.pressureSensorActive)
1195
- ], IrrigationCCSystemStatusReport.prototype, "pressureSensorActive", void 0);
1196
- __decorate([
1197
- ccValue(IrrigationCCValues.rainSensorActive)
1198
- ], IrrigationCCSystemStatusReport.prototype, "rainSensorActive", void 0);
1199
- __decorate([
1200
- ccValue(IrrigationCCValues.moistureSensorActive)
1201
- ], IrrigationCCSystemStatusReport.prototype, "moistureSensorActive", void 0);
1202
- __decorate([
1203
- ccValue(IrrigationCCValues.flow)
1204
- ], IrrigationCCSystemStatusReport.prototype, "flow", void 0);
1205
- __decorate([
1206
- ccValue(IrrigationCCValues.pressure)
1207
- ], IrrigationCCSystemStatusReport.prototype, "pressure", void 0);
1208
- __decorate([
1209
- ccValue(IrrigationCCValues.shutoffDuration)
1210
- ], IrrigationCCSystemStatusReport.prototype, "shutoffDuration", void 0);
1211
- __decorate([
1212
- ccValue(IrrigationCCValues.errorNotProgrammed)
1213
- ], IrrigationCCSystemStatusReport.prototype, "errorNotProgrammed", void 0);
1214
- __decorate([
1215
- ccValue(IrrigationCCValues.errorEmergencyShutdown)
1216
- ], IrrigationCCSystemStatusReport.prototype, "errorEmergencyShutdown", void 0);
1217
- __decorate([
1218
- ccValue(IrrigationCCValues.errorHighPressure)
1219
- ], IrrigationCCSystemStatusReport.prototype, "errorHighPressure", void 0);
1220
- __decorate([
1221
- ccValue(IrrigationCCValues.errorLowPressure)
1222
- ], IrrigationCCSystemStatusReport.prototype, "errorLowPressure", void 0);
1223
- __decorate([
1224
- ccValue(IrrigationCCValues.errorValve)
1225
- ], IrrigationCCSystemStatusReport.prototype, "errorValve", void 0);
1226
- __decorate([
1227
- ccValue(IrrigationCCValues.masterValveOpen)
1228
- ], IrrigationCCSystemStatusReport.prototype, "masterValveOpen", void 0);
1229
- __decorate([
1230
- ccValue(IrrigationCCValues.firstOpenZoneId)
1231
- ], IrrigationCCSystemStatusReport.prototype, "firstOpenZoneId", void 0);
1232
- IrrigationCCSystemStatusReport = IrrigationCCSystemStatusReport_1 = __decorate([
1233
- CCCommand(IrrigationCommand.SystemStatusReport)
1234
- ], IrrigationCCSystemStatusReport);
1116
+ let IrrigationCCSystemStatusReport = (() => {
1117
+ let _classDecorators = [CCCommand(IrrigationCommand.SystemStatusReport), ccValueProperty("systemVoltage", IrrigationCCValues.systemVoltage), ccValueProperty("flowSensorActive", IrrigationCCValues.flowSensorActive), ccValueProperty("pressureSensorActive", IrrigationCCValues.pressureSensorActive), ccValueProperty("rainSensorActive", IrrigationCCValues.rainSensorActive), ccValueProperty("moistureSensorActive", IrrigationCCValues.moistureSensorActive), ccValueProperty("flow", IrrigationCCValues.flow), ccValueProperty("pressure", IrrigationCCValues.pressure), ccValueProperty("shutoffDuration", IrrigationCCValues.shutoffDuration), ccValueProperty("errorNotProgrammed", IrrigationCCValues.errorNotProgrammed), ccValueProperty("errorEmergencyShutdown", IrrigationCCValues.errorEmergencyShutdown), ccValueProperty("errorHighPressure", IrrigationCCValues.errorHighPressure), ccValueProperty("errorLowPressure", IrrigationCCValues.errorLowPressure), ccValueProperty("errorValve", IrrigationCCValues.errorValve), ccValueProperty("masterValveOpen", IrrigationCCValues.masterValveOpen), ccValueProperty("firstOpenZoneId", IrrigationCCValues.firstOpenZoneId)];
1118
+ let _classDescriptor;
1119
+ let _classExtraInitializers = [];
1120
+ let _classThis;
1121
+ let _classSuper = IrrigationCC;
1122
+ var IrrigationCCSystemStatusReport = class extends _classSuper {
1123
+ static { _classThis = this; }
1124
+ static {
1125
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1126
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1127
+ IrrigationCCSystemStatusReport = _classThis = _classDescriptor.value;
1128
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1129
+ __runInitializers(_classThis, _classExtraInitializers);
1130
+ }
1131
+ constructor(options) {
1132
+ super(options);
1133
+ // TODO: Check implementation:
1134
+ this.systemVoltage = options.systemVoltage;
1135
+ this.flowSensorActive = options.flowSensorActive;
1136
+ this.pressureSensorActive = options.pressureSensorActive;
1137
+ this.rainSensorActive = options.rainSensorActive;
1138
+ this.moistureSensorActive = options.moistureSensorActive;
1139
+ this.flow = options.flow;
1140
+ this.pressure = options.pressure;
1141
+ this.shutoffDuration = options.shutoffDuration;
1142
+ this.errorNotProgrammed = options.errorNotProgrammed;
1143
+ this.errorEmergencyShutdown = options.errorEmergencyShutdown;
1144
+ this.errorHighPressure = options.errorHighPressure;
1145
+ this.errorLowPressure = options.errorLowPressure;
1146
+ this.errorValve = options.errorValve;
1147
+ this.masterValveOpen = options.masterValveOpen;
1148
+ this.firstOpenZoneId = options.firstOpenZoneId;
1149
+ }
1150
+ static from(raw, ctx) {
1151
+ validatePayload(raw.payload.length >= 2);
1152
+ const systemVoltage = raw.payload[0];
1153
+ const flowSensorActive = !!(raw.payload[1] & 0x01);
1154
+ const pressureSensorActive = !!(raw.payload[1] & 0x02);
1155
+ const rainSensorActive = !!(raw.payload[1] & 0x04);
1156
+ const moistureSensorActive = !!(raw.payload[1] & 0x08);
1157
+ let offset = 2;
1158
+ let flow;
1159
+ {
1160
+ const { value, scale, bytesRead } = parseFloatWithScale(raw.payload.subarray(offset));
1161
+ validatePayload(scale === 0);
1162
+ if (flowSensorActive)
1163
+ flow = value;
1164
+ offset += bytesRead;
1165
+ }
1166
+ let pressure;
1167
+ {
1168
+ const { value, scale, bytesRead } = parseFloatWithScale(raw.payload.subarray(offset));
1169
+ validatePayload(scale === 0);
1170
+ if (pressureSensorActive)
1171
+ pressure = value;
1172
+ offset += bytesRead;
1173
+ }
1174
+ validatePayload(raw.payload.length >= offset + 4);
1175
+ const shutoffDuration = raw.payload[offset];
1176
+ const errorNotProgrammed = !!(raw.payload[offset + 1] & 0x01);
1177
+ const errorEmergencyShutdown = !!(raw.payload[offset + 1] & 0x02);
1178
+ const errorHighPressure = !!(raw.payload[offset + 1] & 0x04);
1179
+ const errorLowPressure = !!(raw.payload[offset + 1] & 0x08);
1180
+ const errorValve = !!(raw.payload[offset + 1] & 0x10);
1181
+ const masterValveOpen = !!(raw.payload[offset + 2] & 0x01);
1182
+ let firstOpenZoneId;
1183
+ if (raw.payload[offset + 3]) {
1184
+ firstOpenZoneId = raw.payload[offset + 3];
1185
+ }
1186
+ return new this({
1187
+ nodeId: ctx.sourceNodeId,
1188
+ systemVoltage,
1189
+ flowSensorActive,
1190
+ pressureSensorActive,
1191
+ rainSensorActive,
1192
+ moistureSensorActive,
1193
+ flow,
1194
+ pressure,
1195
+ shutoffDuration,
1196
+ errorNotProgrammed,
1197
+ errorEmergencyShutdown,
1198
+ errorHighPressure,
1199
+ errorLowPressure,
1200
+ errorValve,
1201
+ masterValveOpen,
1202
+ firstOpenZoneId,
1203
+ });
1204
+ }
1205
+ systemVoltage;
1206
+ flowSensorActive;
1207
+ pressureSensorActive;
1208
+ rainSensorActive;
1209
+ moistureSensorActive;
1210
+ flow;
1211
+ pressure;
1212
+ shutoffDuration;
1213
+ errorNotProgrammed;
1214
+ errorEmergencyShutdown;
1215
+ errorHighPressure;
1216
+ errorLowPressure;
1217
+ errorValve;
1218
+ masterValveOpen;
1219
+ firstOpenZoneId;
1220
+ toLogEntry(ctx) {
1221
+ const message = {
1222
+ "system voltage": `${this.systemVoltage} V`,
1223
+ "active sensors": [
1224
+ this.flowSensorActive ? "flow" : undefined,
1225
+ this.pressureSensorActive ? "pressure" : undefined,
1226
+ this.rainSensorActive ? "rain" : undefined,
1227
+ this.moistureSensorActive ? "moisture" : undefined,
1228
+ ]
1229
+ .filter(Boolean)
1230
+ .join(", "),
1231
+ };
1232
+ if (this.flow != undefined) {
1233
+ message.flow = `${this.flow} l/h`;
1234
+ }
1235
+ if (this.pressure != undefined) {
1236
+ message.pressure = `${this.pressure} kPa`;
1237
+ }
1238
+ message["remaining shutoff duration"] = `${this.shutoffDuration} hours`;
1239
+ message["master valve status"] = this.masterValveOpen
1240
+ ? "open"
1241
+ : "closed";
1242
+ message["first open zone valve"] = this.firstOpenZoneId || "none";
1243
+ const errors = [
1244
+ this.errorNotProgrammed ? "device not programmed" : undefined,
1245
+ this.errorEmergencyShutdown ? "emergency shutdown" : undefined,
1246
+ this.errorHighPressure
1247
+ ? "high pressure threshold triggered"
1248
+ : undefined,
1249
+ this.errorLowPressure
1250
+ ? "low pressure threshold triggered"
1251
+ : undefined,
1252
+ this.errorValve
1253
+ ? "a valve or the master valve has an error"
1254
+ : undefined,
1255
+ ].filter(Boolean);
1256
+ if (errors.length > 0) {
1257
+ message.errors = errors.map((e) => `\n· ${e}`).join("");
1258
+ }
1259
+ return {
1260
+ ...super.toLogEntry(ctx),
1261
+ message,
1262
+ };
1263
+ }
1264
+ };
1265
+ return IrrigationCCSystemStatusReport = _classThis;
1266
+ })();
1235
1267
  export { IrrigationCCSystemStatusReport };
1236
- let IrrigationCCSystemStatusGet = class IrrigationCCSystemStatusGet extends IrrigationCC {
1237
- };
1238
- IrrigationCCSystemStatusGet = __decorate([
1239
- CCCommand(IrrigationCommand.SystemStatusGet),
1240
- expectedCCResponse(IrrigationCCSystemStatusReport)
1241
- ], IrrigationCCSystemStatusGet);
1268
+ let IrrigationCCSystemStatusGet = (() => {
1269
+ let _classDecorators = [CCCommand(IrrigationCommand.SystemStatusGet), expectedCCResponse(IrrigationCCSystemStatusReport)];
1270
+ let _classDescriptor;
1271
+ let _classExtraInitializers = [];
1272
+ let _classThis;
1273
+ let _classSuper = IrrigationCC;
1274
+ var IrrigationCCSystemStatusGet = class extends _classSuper {
1275
+ static { _classThis = this; }
1276
+ static {
1277
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1278
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1279
+ IrrigationCCSystemStatusGet = _classThis = _classDescriptor.value;
1280
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1281
+ __runInitializers(_classThis, _classExtraInitializers);
1282
+ }
1283
+ };
1284
+ return IrrigationCCSystemStatusGet = _classThis;
1285
+ })();
1242
1286
  export { IrrigationCCSystemStatusGet };
1243
- let IrrigationCCSystemConfigSet = class IrrigationCCSystemConfigSet extends IrrigationCC {
1244
- constructor(options) {
1245
- super(options);
1246
- this.masterValveDelay = options.masterValveDelay;
1247
- this.highPressureThreshold = options.highPressureThreshold;
1248
- this.lowPressureThreshold = options.lowPressureThreshold;
1249
- this.rainSensorPolarity = options.rainSensorPolarity;
1250
- this.moistureSensorPolarity = options.moistureSensorPolarity;
1251
- }
1252
- static from(_raw, _ctx) {
1253
- // TODO: Deserialize payload
1254
- throw new ZWaveError(`${this.name}: deserialization not implemented`, ZWaveErrorCodes.Deserialization_NotImplemented);
1255
- // return new IrrigationCCSystemConfigSet({
1256
- // nodeId: ctx.sourceNodeId,
1257
- // });
1258
- }
1259
- masterValveDelay;
1260
- highPressureThreshold;
1261
- lowPressureThreshold;
1262
- rainSensorPolarity;
1263
- moistureSensorPolarity;
1264
- serialize(ctx) {
1265
- let polarity = 0;
1266
- if (this.rainSensorPolarity != undefined)
1267
- polarity |= 0b1;
1268
- if (this.moistureSensorPolarity != undefined)
1269
- polarity |= 0b10;
1270
- if (this.rainSensorPolarity == undefined
1271
- && this.moistureSensorPolarity == undefined) {
1272
- // Valid bit
1273
- polarity |= 0b1000_0000;
1274
- }
1275
- this.payload = Bytes.concat([
1276
- Bytes.from([this.masterValveDelay]),
1277
- encodeFloatWithScale(this.highPressureThreshold, 0 /* kPa */),
1278
- encodeFloatWithScale(this.lowPressureThreshold, 0 /* kPa */),
1279
- Bytes.from([polarity]),
1280
- ]);
1281
- return super.serialize(ctx);
1282
- }
1283
- toLogEntry(ctx) {
1284
- const message = {
1285
- "master valve delay": `${this.masterValveDelay} s`,
1286
- "high pressure threshold": `${this.highPressureThreshold} kPa`,
1287
- "low pressure threshold": `${this.lowPressureThreshold} kPa`,
1288
- };
1289
- if (this.rainSensorPolarity != undefined) {
1290
- message["rain sensor polarity"] = getEnumMemberName(IrrigationSensorPolarity, this.rainSensorPolarity);
1291
- }
1292
- if (this.moistureSensorPolarity != undefined) {
1293
- message["moisture sensor polarity"] = getEnumMemberName(IrrigationSensorPolarity, this.moistureSensorPolarity);
1294
- }
1295
- return {
1296
- ...super.toLogEntry(ctx),
1297
- message,
1298
- };
1299
- }
1300
- };
1301
- IrrigationCCSystemConfigSet = __decorate([
1302
- CCCommand(IrrigationCommand.SystemConfigSet),
1303
- useSupervision()
1304
- ], IrrigationCCSystemConfigSet);
1287
+ let IrrigationCCSystemConfigSet = (() => {
1288
+ let _classDecorators = [CCCommand(IrrigationCommand.SystemConfigSet), useSupervision()];
1289
+ let _classDescriptor;
1290
+ let _classExtraInitializers = [];
1291
+ let _classThis;
1292
+ let _classSuper = IrrigationCC;
1293
+ var IrrigationCCSystemConfigSet = class extends _classSuper {
1294
+ static { _classThis = this; }
1295
+ static {
1296
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1297
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1298
+ IrrigationCCSystemConfigSet = _classThis = _classDescriptor.value;
1299
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1300
+ __runInitializers(_classThis, _classExtraInitializers);
1301
+ }
1302
+ constructor(options) {
1303
+ super(options);
1304
+ this.masterValveDelay = options.masterValveDelay;
1305
+ this.highPressureThreshold = options.highPressureThreshold;
1306
+ this.lowPressureThreshold = options.lowPressureThreshold;
1307
+ this.rainSensorPolarity = options.rainSensorPolarity;
1308
+ this.moistureSensorPolarity = options.moistureSensorPolarity;
1309
+ }
1310
+ static from(_raw, _ctx) {
1311
+ // TODO: Deserialize payload
1312
+ throw new ZWaveError(`${this.name}: deserialization not implemented`, ZWaveErrorCodes.Deserialization_NotImplemented);
1313
+ // return new IrrigationCCSystemConfigSet({
1314
+ // nodeId: ctx.sourceNodeId,
1315
+ // });
1316
+ }
1317
+ masterValveDelay;
1318
+ highPressureThreshold;
1319
+ lowPressureThreshold;
1320
+ rainSensorPolarity;
1321
+ moistureSensorPolarity;
1322
+ serialize(ctx) {
1323
+ let polarity = 0;
1324
+ if (this.rainSensorPolarity != undefined)
1325
+ polarity |= 0b1;
1326
+ if (this.moistureSensorPolarity != undefined)
1327
+ polarity |= 0b10;
1328
+ if (this.rainSensorPolarity == undefined
1329
+ && this.moistureSensorPolarity == undefined) {
1330
+ // Valid bit
1331
+ polarity |= 0b1000_0000;
1332
+ }
1333
+ this.payload = Bytes.concat([
1334
+ Bytes.from([this.masterValveDelay]),
1335
+ encodeFloatWithScale(this.highPressureThreshold, 0 /* kPa */),
1336
+ encodeFloatWithScale(this.lowPressureThreshold, 0 /* kPa */),
1337
+ Bytes.from([polarity]),
1338
+ ]);
1339
+ return super.serialize(ctx);
1340
+ }
1341
+ toLogEntry(ctx) {
1342
+ const message = {
1343
+ "master valve delay": `${this.masterValveDelay} s`,
1344
+ "high pressure threshold": `${this.highPressureThreshold} kPa`,
1345
+ "low pressure threshold": `${this.lowPressureThreshold} kPa`,
1346
+ };
1347
+ if (this.rainSensorPolarity != undefined) {
1348
+ message["rain sensor polarity"] = getEnumMemberName(IrrigationSensorPolarity, this.rainSensorPolarity);
1349
+ }
1350
+ if (this.moistureSensorPolarity != undefined) {
1351
+ message["moisture sensor polarity"] = getEnumMemberName(IrrigationSensorPolarity, this.moistureSensorPolarity);
1352
+ }
1353
+ return {
1354
+ ...super.toLogEntry(ctx),
1355
+ message,
1356
+ };
1357
+ }
1358
+ };
1359
+ return IrrigationCCSystemConfigSet = _classThis;
1360
+ })();
1305
1361
  export { IrrigationCCSystemConfigSet };
1306
- let IrrigationCCSystemConfigReport = IrrigationCCSystemConfigReport_1 = class IrrigationCCSystemConfigReport extends IrrigationCC {
1307
- constructor(options) {
1308
- super(options);
1309
- // TODO: Check implementation:
1310
- this.masterValveDelay = options.masterValveDelay;
1311
- this.highPressureThreshold = options.highPressureThreshold;
1312
- this.lowPressureThreshold = options.lowPressureThreshold;
1313
- this.rainSensorPolarity = options.rainSensorPolarity;
1314
- this.moistureSensorPolarity = options.moistureSensorPolarity;
1315
- }
1316
- static from(raw, ctx) {
1317
- validatePayload(raw.payload.length >= 2);
1318
- const masterValveDelay = raw.payload[0];
1319
- let offset = 1;
1320
- let highPressureThreshold;
1321
- {
1322
- const { value, scale, bytesRead } = parseFloatWithScale(raw.payload.subarray(offset));
1323
- validatePayload(scale === 0 /* kPa */);
1324
- highPressureThreshold = value;
1325
- offset += bytesRead;
1326
- }
1327
- let lowPressureThreshold;
1328
- {
1329
- const { value, scale, bytesRead } = parseFloatWithScale(raw.payload.subarray(offset));
1330
- validatePayload(scale === 0 /* kPa */);
1331
- lowPressureThreshold = value;
1332
- offset += bytesRead;
1333
- }
1334
- validatePayload(raw.payload.length >= offset + 1);
1335
- const polarity = raw.payload[offset];
1336
- let rainSensorPolarity;
1337
- let moistureSensorPolarity;
1338
- if (!!(polarity & 0b1000_0000)) {
1339
- // The valid bit is set
1340
- rainSensorPolarity = polarity & 0b1;
1341
- moistureSensorPolarity = (polarity & 0b10) >>> 1;
1342
- }
1343
- return new IrrigationCCSystemConfigReport_1({
1344
- nodeId: ctx.sourceNodeId,
1345
- masterValveDelay,
1346
- highPressureThreshold,
1347
- lowPressureThreshold,
1348
- rainSensorPolarity,
1349
- moistureSensorPolarity,
1350
- });
1351
- }
1352
- masterValveDelay;
1353
- highPressureThreshold;
1354
- lowPressureThreshold;
1355
- rainSensorPolarity;
1356
- moistureSensorPolarity;
1357
- toLogEntry(ctx) {
1358
- const message = {
1359
- "master valve delay": `${this.masterValveDelay} s`,
1360
- "high pressure threshold": `${this.highPressureThreshold} kPa`,
1361
- "low pressure threshold": `${this.lowPressureThreshold} kPa`,
1362
- };
1363
- if (this.rainSensorPolarity != undefined) {
1364
- message["rain sensor polarity"] = getEnumMemberName(IrrigationSensorPolarity, this.rainSensorPolarity);
1365
- }
1366
- if (this.moistureSensorPolarity != undefined) {
1367
- message["moisture sensor polarity"] = getEnumMemberName(IrrigationSensorPolarity, this.moistureSensorPolarity);
1368
- }
1369
- return {
1370
- ...super.toLogEntry(ctx),
1371
- message,
1372
- };
1373
- }
1374
- };
1375
- __decorate([
1376
- ccValue(IrrigationCCValues.masterValveDelay)
1377
- ], IrrigationCCSystemConfigReport.prototype, "masterValveDelay", void 0);
1378
- __decorate([
1379
- ccValue(IrrigationCCValues.highPressureThreshold)
1380
- ], IrrigationCCSystemConfigReport.prototype, "highPressureThreshold", void 0);
1381
- __decorate([
1382
- ccValue(IrrigationCCValues.lowPressureThreshold)
1383
- ], IrrigationCCSystemConfigReport.prototype, "lowPressureThreshold", void 0);
1384
- __decorate([
1385
- ccValue(IrrigationCCValues.rainSensorPolarity)
1386
- ], IrrigationCCSystemConfigReport.prototype, "rainSensorPolarity", void 0);
1387
- __decorate([
1388
- ccValue(IrrigationCCValues.moistureSensorPolarity)
1389
- ], IrrigationCCSystemConfigReport.prototype, "moistureSensorPolarity", void 0);
1390
- IrrigationCCSystemConfigReport = IrrigationCCSystemConfigReport_1 = __decorate([
1391
- CCCommand(IrrigationCommand.SystemConfigReport)
1392
- ], IrrigationCCSystemConfigReport);
1362
+ let IrrigationCCSystemConfigReport = (() => {
1363
+ let _classDecorators = [CCCommand(IrrigationCommand.SystemConfigReport), ccValueProperty("masterValveDelay", IrrigationCCValues.masterValveDelay), ccValueProperty("highPressureThreshold", IrrigationCCValues.highPressureThreshold), ccValueProperty("lowPressureThreshold", IrrigationCCValues.lowPressureThreshold), ccValueProperty("rainSensorPolarity", IrrigationCCValues.rainSensorPolarity), ccValueProperty("moistureSensorPolarity", IrrigationCCValues.moistureSensorPolarity)];
1364
+ let _classDescriptor;
1365
+ let _classExtraInitializers = [];
1366
+ let _classThis;
1367
+ let _classSuper = IrrigationCC;
1368
+ var IrrigationCCSystemConfigReport = class extends _classSuper {
1369
+ static { _classThis = this; }
1370
+ static {
1371
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1372
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1373
+ IrrigationCCSystemConfigReport = _classThis = _classDescriptor.value;
1374
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1375
+ __runInitializers(_classThis, _classExtraInitializers);
1376
+ }
1377
+ constructor(options) {
1378
+ super(options);
1379
+ // TODO: Check implementation:
1380
+ this.masterValveDelay = options.masterValveDelay;
1381
+ this.highPressureThreshold = options.highPressureThreshold;
1382
+ this.lowPressureThreshold = options.lowPressureThreshold;
1383
+ this.rainSensorPolarity = options.rainSensorPolarity;
1384
+ this.moistureSensorPolarity = options.moistureSensorPolarity;
1385
+ }
1386
+ static from(raw, ctx) {
1387
+ validatePayload(raw.payload.length >= 2);
1388
+ const masterValveDelay = raw.payload[0];
1389
+ let offset = 1;
1390
+ let highPressureThreshold;
1391
+ {
1392
+ const { value, scale, bytesRead } = parseFloatWithScale(raw.payload.subarray(offset));
1393
+ validatePayload(scale === 0 /* kPa */);
1394
+ highPressureThreshold = value;
1395
+ offset += bytesRead;
1396
+ }
1397
+ let lowPressureThreshold;
1398
+ {
1399
+ const { value, scale, bytesRead } = parseFloatWithScale(raw.payload.subarray(offset));
1400
+ validatePayload(scale === 0 /* kPa */);
1401
+ lowPressureThreshold = value;
1402
+ offset += bytesRead;
1403
+ }
1404
+ validatePayload(raw.payload.length >= offset + 1);
1405
+ const polarity = raw.payload[offset];
1406
+ let rainSensorPolarity;
1407
+ let moistureSensorPolarity;
1408
+ if (!!(polarity & 0b1000_0000)) {
1409
+ // The valid bit is set
1410
+ rainSensorPolarity = polarity & 0b1;
1411
+ moistureSensorPolarity = (polarity & 0b10) >>> 1;
1412
+ }
1413
+ return new this({
1414
+ nodeId: ctx.sourceNodeId,
1415
+ masterValveDelay,
1416
+ highPressureThreshold,
1417
+ lowPressureThreshold,
1418
+ rainSensorPolarity,
1419
+ moistureSensorPolarity,
1420
+ });
1421
+ }
1422
+ masterValveDelay;
1423
+ highPressureThreshold;
1424
+ lowPressureThreshold;
1425
+ rainSensorPolarity;
1426
+ moistureSensorPolarity;
1427
+ toLogEntry(ctx) {
1428
+ const message = {
1429
+ "master valve delay": `${this.masterValveDelay} s`,
1430
+ "high pressure threshold": `${this.highPressureThreshold} kPa`,
1431
+ "low pressure threshold": `${this.lowPressureThreshold} kPa`,
1432
+ };
1433
+ if (this.rainSensorPolarity != undefined) {
1434
+ message["rain sensor polarity"] = getEnumMemberName(IrrigationSensorPolarity, this.rainSensorPolarity);
1435
+ }
1436
+ if (this.moistureSensorPolarity != undefined) {
1437
+ message["moisture sensor polarity"] = getEnumMemberName(IrrigationSensorPolarity, this.moistureSensorPolarity);
1438
+ }
1439
+ return {
1440
+ ...super.toLogEntry(ctx),
1441
+ message,
1442
+ };
1443
+ }
1444
+ };
1445
+ return IrrigationCCSystemConfigReport = _classThis;
1446
+ })();
1393
1447
  export { IrrigationCCSystemConfigReport };
1394
- let IrrigationCCSystemConfigGet = class IrrigationCCSystemConfigGet extends IrrigationCC {
1395
- };
1396
- IrrigationCCSystemConfigGet = __decorate([
1397
- CCCommand(IrrigationCommand.SystemConfigGet),
1398
- expectedCCResponse(IrrigationCCSystemConfigReport)
1399
- ], IrrigationCCSystemConfigGet);
1448
+ let IrrigationCCSystemConfigGet = (() => {
1449
+ let _classDecorators = [CCCommand(IrrigationCommand.SystemConfigGet), expectedCCResponse(IrrigationCCSystemConfigReport)];
1450
+ let _classDescriptor;
1451
+ let _classExtraInitializers = [];
1452
+ let _classThis;
1453
+ let _classSuper = IrrigationCC;
1454
+ var IrrigationCCSystemConfigGet = class extends _classSuper {
1455
+ static { _classThis = this; }
1456
+ static {
1457
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1458
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1459
+ IrrigationCCSystemConfigGet = _classThis = _classDescriptor.value;
1460
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1461
+ __runInitializers(_classThis, _classExtraInitializers);
1462
+ }
1463
+ };
1464
+ return IrrigationCCSystemConfigGet = _classThis;
1465
+ })();
1400
1466
  export { IrrigationCCSystemConfigGet };
1401
- let IrrigationCCValveInfoReport = IrrigationCCValveInfoReport_1 = class IrrigationCCValveInfoReport extends IrrigationCC {
1402
- constructor(options) {
1403
- super(options);
1404
- // TODO: Check implementation:
1405
- this.valveId = options.valveId;
1406
- this.connected = options.connected;
1407
- this.nominalCurrent = options.nominalCurrent;
1408
- this.errorShortCircuit = options.errorShortCircuit;
1409
- this.errorHighCurrent = options.errorHighCurrent;
1410
- this.errorLowCurrent = options.errorLowCurrent;
1411
- this.errorMaximumFlow = options.errorMaximumFlow;
1412
- this.errorHighFlow = options.errorHighFlow;
1413
- this.errorLowFlow = options.errorLowFlow;
1414
- }
1415
- static from(raw, ctx) {
1416
- validatePayload(raw.payload.length >= 4);
1417
- let valveId;
1418
- if ((raw.payload[0] & 0b1) === ValveType.MasterValve) {
1419
- valveId = "master";
1420
- }
1421
- else {
1422
- valveId = raw.payload[1];
1423
- }
1424
- const connected = !!(raw.payload[0] & 0b10);
1425
- const nominalCurrent = 10 * raw.payload[2];
1426
- const errorShortCircuit = !!(raw.payload[3] & 0b1);
1427
- const errorHighCurrent = !!(raw.payload[3] & 0b10);
1428
- const errorLowCurrent = !!(raw.payload[3] & 0b100);
1429
- let errorMaximumFlow;
1430
- let errorHighFlow;
1431
- let errorLowFlow;
1432
- if (valveId === "master") {
1433
- errorMaximumFlow = !!(raw.payload[3] & 0b1000);
1434
- errorHighFlow = !!(raw.payload[3] & 0b1_0000);
1435
- errorLowFlow = !!(raw.payload[3] & 0b10_0000);
1436
- }
1437
- return new IrrigationCCValveInfoReport_1({
1438
- nodeId: ctx.sourceNodeId,
1439
- valveId,
1440
- connected,
1441
- nominalCurrent,
1442
- errorShortCircuit,
1443
- errorHighCurrent,
1444
- errorLowCurrent,
1445
- errorMaximumFlow,
1446
- errorHighFlow,
1447
- errorLowFlow,
1448
- });
1449
- }
1450
- valveId;
1451
- connected;
1452
- nominalCurrent;
1453
- errorShortCircuit;
1454
- errorHighCurrent;
1455
- errorLowCurrent;
1456
- errorMaximumFlow;
1457
- errorHighFlow;
1458
- errorLowFlow;
1459
- persistValues(ctx) {
1460
- if (!super.persistValues(ctx))
1461
- return false;
1462
- // connected
1463
- const valveConnectedValue = IrrigationCCValues.valveConnected(this.valveId);
1464
- this.ensureMetadata(ctx, valveConnectedValue);
1465
- this.setValue(ctx, valveConnectedValue, this.connected);
1466
- // nominalCurrent
1467
- const nominalCurrentValue = IrrigationCCValues.nominalCurrent(this.valveId);
1468
- this.ensureMetadata(ctx, nominalCurrentValue);
1469
- this.setValue(ctx, nominalCurrentValue, this.nominalCurrent);
1470
- // errorShortCircuit
1471
- const errorShortCircuitValue = IrrigationCCValues.errorShortCircuit(this.valveId);
1472
- this.ensureMetadata(ctx, errorShortCircuitValue);
1473
- this.setValue(ctx, errorShortCircuitValue, this.errorShortCircuit);
1474
- // errorHighCurrent
1475
- const errorHighCurrentValue = IrrigationCCValues.errorHighCurrent(this.valveId);
1476
- this.ensureMetadata(ctx, errorHighCurrentValue);
1477
- this.setValue(ctx, errorHighCurrentValue, this.errorHighCurrent);
1478
- // errorLowCurrent
1479
- const errorLowCurrentValue = IrrigationCCValues.errorLowCurrent(this.valveId);
1480
- this.ensureMetadata(ctx, errorLowCurrentValue);
1481
- this.setValue(ctx, errorLowCurrentValue, this.errorLowCurrent);
1482
- if (this.errorMaximumFlow != undefined) {
1483
- const errorMaximumFlowValue = IrrigationCCValues.errorMaximumFlow(this.valveId);
1484
- this.ensureMetadata(ctx, errorMaximumFlowValue);
1485
- this.setValue(ctx, errorMaximumFlowValue, this.errorMaximumFlow);
1486
- }
1487
- if (this.errorHighFlow != undefined) {
1488
- const errorHighFlowValue = IrrigationCCValues.errorHighFlow(this.valveId);
1489
- this.ensureMetadata(ctx, errorHighFlowValue);
1490
- this.setValue(ctx, errorHighFlowValue, this.errorHighFlow);
1491
- }
1492
- if (this.errorLowFlow != undefined) {
1493
- const errorLowFlowValue = IrrigationCCValues.errorLowFlow(this.valveId);
1494
- this.ensureMetadata(ctx, errorLowFlowValue);
1495
- this.setValue(ctx, errorLowFlowValue, this.errorLowFlow);
1496
- }
1497
- return true;
1498
- }
1499
- toLogEntry(ctx) {
1500
- const message = {
1501
- "valve ID": this.valveId,
1502
- connected: this.connected,
1503
- "nominal current": `${this.nominalCurrent} mA`,
1504
- };
1505
- const errors = [
1506
- this.errorShortCircuit ? "short circuit" : undefined,
1507
- this.errorHighCurrent ? "current above high threshold" : undefined,
1508
- this.errorLowCurrent ? "current below low threshold" : undefined,
1509
- this.errorMaximumFlow ? "maximum flow" : undefined,
1510
- this.errorHighFlow ? "flow above high threshold" : undefined,
1511
- this.errorLowFlow ? "flow below low threshold" : undefined,
1512
- ].filter(Boolean);
1513
- if (errors.length > 0) {
1514
- message.errors = errors.map((e) => `\n· ${e}`).join("");
1515
- }
1516
- return {
1517
- ...super.toLogEntry(ctx),
1518
- message,
1519
- };
1520
- }
1521
- };
1522
- IrrigationCCValveInfoReport = IrrigationCCValveInfoReport_1 = __decorate([
1523
- CCCommand(IrrigationCommand.ValveInfoReport)
1524
- ], IrrigationCCValveInfoReport);
1467
+ let IrrigationCCValveInfoReport = (() => {
1468
+ let _classDecorators = [CCCommand(IrrigationCommand.ValveInfoReport)];
1469
+ let _classDescriptor;
1470
+ let _classExtraInitializers = [];
1471
+ let _classThis;
1472
+ let _classSuper = IrrigationCC;
1473
+ var IrrigationCCValveInfoReport = class extends _classSuper {
1474
+ static { _classThis = this; }
1475
+ static {
1476
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1477
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1478
+ IrrigationCCValveInfoReport = _classThis = _classDescriptor.value;
1479
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1480
+ __runInitializers(_classThis, _classExtraInitializers);
1481
+ }
1482
+ constructor(options) {
1483
+ super(options);
1484
+ // TODO: Check implementation:
1485
+ this.valveId = options.valveId;
1486
+ this.connected = options.connected;
1487
+ this.nominalCurrent = options.nominalCurrent;
1488
+ this.errorShortCircuit = options.errorShortCircuit;
1489
+ this.errorHighCurrent = options.errorHighCurrent;
1490
+ this.errorLowCurrent = options.errorLowCurrent;
1491
+ this.errorMaximumFlow = options.errorMaximumFlow;
1492
+ this.errorHighFlow = options.errorHighFlow;
1493
+ this.errorLowFlow = options.errorLowFlow;
1494
+ }
1495
+ static from(raw, ctx) {
1496
+ validatePayload(raw.payload.length >= 4);
1497
+ let valveId;
1498
+ if ((raw.payload[0] & 0b1) === ValveType.MasterValve) {
1499
+ valveId = "master";
1500
+ }
1501
+ else {
1502
+ valveId = raw.payload[1];
1503
+ }
1504
+ const connected = !!(raw.payload[0] & 0b10);
1505
+ const nominalCurrent = 10 * raw.payload[2];
1506
+ const errorShortCircuit = !!(raw.payload[3] & 0b1);
1507
+ const errorHighCurrent = !!(raw.payload[3] & 0b10);
1508
+ const errorLowCurrent = !!(raw.payload[3] & 0b100);
1509
+ let errorMaximumFlow;
1510
+ let errorHighFlow;
1511
+ let errorLowFlow;
1512
+ if (valveId === "master") {
1513
+ errorMaximumFlow = !!(raw.payload[3] & 0b1000);
1514
+ errorHighFlow = !!(raw.payload[3] & 0b1_0000);
1515
+ errorLowFlow = !!(raw.payload[3] & 0b10_0000);
1516
+ }
1517
+ return new this({
1518
+ nodeId: ctx.sourceNodeId,
1519
+ valveId,
1520
+ connected,
1521
+ nominalCurrent,
1522
+ errorShortCircuit,
1523
+ errorHighCurrent,
1524
+ errorLowCurrent,
1525
+ errorMaximumFlow,
1526
+ errorHighFlow,
1527
+ errorLowFlow,
1528
+ });
1529
+ }
1530
+ valveId;
1531
+ connected;
1532
+ nominalCurrent;
1533
+ errorShortCircuit;
1534
+ errorHighCurrent;
1535
+ errorLowCurrent;
1536
+ errorMaximumFlow;
1537
+ errorHighFlow;
1538
+ errorLowFlow;
1539
+ persistValues(ctx) {
1540
+ if (!super.persistValues(ctx))
1541
+ return false;
1542
+ // connected
1543
+ const valveConnectedValue = IrrigationCCValues.valveConnected(this.valveId);
1544
+ this.ensureMetadata(ctx, valveConnectedValue);
1545
+ this.setValue(ctx, valveConnectedValue, this.connected);
1546
+ // nominalCurrent
1547
+ const nominalCurrentValue = IrrigationCCValues.nominalCurrent(this.valveId);
1548
+ this.ensureMetadata(ctx, nominalCurrentValue);
1549
+ this.setValue(ctx, nominalCurrentValue, this.nominalCurrent);
1550
+ // errorShortCircuit
1551
+ const errorShortCircuitValue = IrrigationCCValues.errorShortCircuit(this.valveId);
1552
+ this.ensureMetadata(ctx, errorShortCircuitValue);
1553
+ this.setValue(ctx, errorShortCircuitValue, this.errorShortCircuit);
1554
+ // errorHighCurrent
1555
+ const errorHighCurrentValue = IrrigationCCValues.errorHighCurrent(this.valveId);
1556
+ this.ensureMetadata(ctx, errorHighCurrentValue);
1557
+ this.setValue(ctx, errorHighCurrentValue, this.errorHighCurrent);
1558
+ // errorLowCurrent
1559
+ const errorLowCurrentValue = IrrigationCCValues.errorLowCurrent(this.valveId);
1560
+ this.ensureMetadata(ctx, errorLowCurrentValue);
1561
+ this.setValue(ctx, errorLowCurrentValue, this.errorLowCurrent);
1562
+ if (this.errorMaximumFlow != undefined) {
1563
+ const errorMaximumFlowValue = IrrigationCCValues.errorMaximumFlow(this.valveId);
1564
+ this.ensureMetadata(ctx, errorMaximumFlowValue);
1565
+ this.setValue(ctx, errorMaximumFlowValue, this.errorMaximumFlow);
1566
+ }
1567
+ if (this.errorHighFlow != undefined) {
1568
+ const errorHighFlowValue = IrrigationCCValues.errorHighFlow(this.valveId);
1569
+ this.ensureMetadata(ctx, errorHighFlowValue);
1570
+ this.setValue(ctx, errorHighFlowValue, this.errorHighFlow);
1571
+ }
1572
+ if (this.errorLowFlow != undefined) {
1573
+ const errorLowFlowValue = IrrigationCCValues.errorLowFlow(this.valveId);
1574
+ this.ensureMetadata(ctx, errorLowFlowValue);
1575
+ this.setValue(ctx, errorLowFlowValue, this.errorLowFlow);
1576
+ }
1577
+ return true;
1578
+ }
1579
+ toLogEntry(ctx) {
1580
+ const message = {
1581
+ "valve ID": this.valveId,
1582
+ connected: this.connected,
1583
+ "nominal current": `${this.nominalCurrent} mA`,
1584
+ };
1585
+ const errors = [
1586
+ this.errorShortCircuit ? "short circuit" : undefined,
1587
+ this.errorHighCurrent ? "current above high threshold" : undefined,
1588
+ this.errorLowCurrent ? "current below low threshold" : undefined,
1589
+ this.errorMaximumFlow ? "maximum flow" : undefined,
1590
+ this.errorHighFlow ? "flow above high threshold" : undefined,
1591
+ this.errorLowFlow ? "flow below low threshold" : undefined,
1592
+ ].filter(Boolean);
1593
+ if (errors.length > 0) {
1594
+ message.errors = errors.map((e) => `\n· ${e}`).join("");
1595
+ }
1596
+ return {
1597
+ ...super.toLogEntry(ctx),
1598
+ message,
1599
+ };
1600
+ }
1601
+ };
1602
+ return IrrigationCCValveInfoReport = _classThis;
1603
+ })();
1525
1604
  export { IrrigationCCValveInfoReport };
1526
1605
  function testResponseForIrrigationCommandWithValveId(sent, received) {
1527
1606
  return received.valveId === sent.valveId;
1528
1607
  }
1529
- let IrrigationCCValveInfoGet = class IrrigationCCValveInfoGet extends IrrigationCC {
1530
- constructor(options) {
1531
- super(options);
1532
- this.valveId = options.valveId;
1533
- }
1534
- static from(_raw, _ctx) {
1535
- // TODO: Deserialize payload
1536
- throw new ZWaveError(`${this.name}: deserialization not implemented`, ZWaveErrorCodes.Deserialization_NotImplemented);
1537
- // return new IrrigationCCValveInfoGet({
1538
- // nodeId: ctx.sourceNodeId,
1539
- // });
1540
- }
1541
- valveId;
1542
- serialize(ctx) {
1543
- this.payload = Bytes.from([
1544
- this.valveId === "master" ? 1 : 0,
1545
- this.valveId === "master" ? 1 : this.valveId || 1,
1546
- ]);
1547
- return super.serialize(ctx);
1548
- }
1549
- toLogEntry(ctx) {
1550
- return {
1551
- ...super.toLogEntry(ctx),
1552
- message: {
1553
- "valve ID": this.valveId,
1554
- },
1555
- };
1556
- }
1557
- };
1558
- IrrigationCCValveInfoGet = __decorate([
1559
- CCCommand(IrrigationCommand.ValveInfoGet),
1560
- expectedCCResponse(IrrigationCCValveInfoReport, testResponseForIrrigationCommandWithValveId)
1561
- ], IrrigationCCValveInfoGet);
1562
- export { IrrigationCCValveInfoGet };
1563
- let IrrigationCCValveConfigSet = class IrrigationCCValveConfigSet extends IrrigationCC {
1564
- constructor(options) {
1565
- super(options);
1566
- this.valveId = options.valveId;
1567
- this.nominalCurrentHighThreshold = options.nominalCurrentHighThreshold;
1568
- this.nominalCurrentLowThreshold = options.nominalCurrentLowThreshold;
1569
- this.maximumFlow = options.maximumFlow;
1570
- this.highFlowThreshold = options.highFlowThreshold;
1571
- this.lowFlowThreshold = options.lowFlowThreshold;
1572
- this.useRainSensor = options.useRainSensor;
1573
- this.useMoistureSensor = options.useMoistureSensor;
1574
- }
1575
- static from(_raw, _ctx) {
1576
- // TODO: Deserialize payload
1577
- throw new ZWaveError(`${this.name}: deserialization not implemented`, ZWaveErrorCodes.Deserialization_NotImplemented);
1578
- // return new IrrigationCCValveConfigSet({
1579
- // nodeId: ctx.sourceNodeId,
1580
- // });
1581
- }
1582
- valveId;
1583
- nominalCurrentHighThreshold;
1584
- nominalCurrentLowThreshold;
1585
- maximumFlow;
1586
- highFlowThreshold;
1587
- lowFlowThreshold;
1588
- useRainSensor;
1589
- useMoistureSensor;
1590
- serialize(ctx) {
1591
- this.payload = Bytes.concat([
1592
- Bytes.from([
1608
+ let IrrigationCCValveInfoGet = (() => {
1609
+ let _classDecorators = [CCCommand(IrrigationCommand.ValveInfoGet), expectedCCResponse(IrrigationCCValveInfoReport, testResponseForIrrigationCommandWithValveId)];
1610
+ let _classDescriptor;
1611
+ let _classExtraInitializers = [];
1612
+ let _classThis;
1613
+ let _classSuper = IrrigationCC;
1614
+ var IrrigationCCValveInfoGet = class extends _classSuper {
1615
+ static { _classThis = this; }
1616
+ static {
1617
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1618
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1619
+ IrrigationCCValveInfoGet = _classThis = _classDescriptor.value;
1620
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1621
+ __runInitializers(_classThis, _classExtraInitializers);
1622
+ }
1623
+ constructor(options) {
1624
+ super(options);
1625
+ this.valveId = options.valveId;
1626
+ }
1627
+ static from(_raw, _ctx) {
1628
+ // TODO: Deserialize payload
1629
+ throw new ZWaveError(`${this.name}: deserialization not implemented`, ZWaveErrorCodes.Deserialization_NotImplemented);
1630
+ // return new IrrigationCCValveInfoGet({
1631
+ // nodeId: ctx.sourceNodeId,
1632
+ // });
1633
+ }
1634
+ valveId;
1635
+ serialize(ctx) {
1636
+ this.payload = Bytes.from([
1593
1637
  this.valveId === "master" ? 1 : 0,
1594
1638
  this.valveId === "master" ? 1 : this.valveId || 1,
1595
- Math.floor(this.nominalCurrentHighThreshold / 10),
1596
- Math.floor(this.nominalCurrentLowThreshold / 10),
1597
- ]),
1598
- encodeFloatWithScale(this.maximumFlow, 0 /* l/h */),
1599
- encodeFloatWithScale(this.highFlowThreshold, 0 /* l/h */),
1600
- encodeFloatWithScale(this.lowFlowThreshold, 0 /* l/h */),
1601
- Bytes.from([
1602
- (this.useRainSensor ? 0b1 : 0)
1603
- | (this.useMoistureSensor ? 0b10 : 0),
1604
- ]),
1605
- ]);
1606
- return super.serialize(ctx);
1607
- }
1608
- toLogEntry(ctx) {
1609
- return {
1610
- ...super.toLogEntry(ctx),
1611
- message: {
1612
- "valve ID": this.valveId,
1613
- "nominal current high threshold": `${this.nominalCurrentHighThreshold} mA`,
1614
- "nominal current low threshold": `${this.nominalCurrentLowThreshold} mA`,
1615
- "maximum flow": `${this.maximumFlow} l/h`,
1616
- "high flow threshold": `${this.highFlowThreshold} l/h`,
1617
- "low flow threshold": `${this.lowFlowThreshold} l/h`,
1618
- "use rain sensor": this.useRainSensor,
1619
- "use moisture sensor": this.useMoistureSensor,
1620
- },
1621
- };
1622
- }
1623
- };
1624
- IrrigationCCValveConfigSet = __decorate([
1625
- CCCommand(IrrigationCommand.ValveConfigSet),
1626
- useSupervision()
1627
- ], IrrigationCCValveConfigSet);
1639
+ ]);
1640
+ return super.serialize(ctx);
1641
+ }
1642
+ toLogEntry(ctx) {
1643
+ return {
1644
+ ...super.toLogEntry(ctx),
1645
+ message: {
1646
+ "valve ID": this.valveId,
1647
+ },
1648
+ };
1649
+ }
1650
+ };
1651
+ return IrrigationCCValveInfoGet = _classThis;
1652
+ })();
1653
+ export { IrrigationCCValveInfoGet };
1654
+ let IrrigationCCValveConfigSet = (() => {
1655
+ let _classDecorators = [CCCommand(IrrigationCommand.ValveConfigSet), useSupervision()];
1656
+ let _classDescriptor;
1657
+ let _classExtraInitializers = [];
1658
+ let _classThis;
1659
+ let _classSuper = IrrigationCC;
1660
+ var IrrigationCCValveConfigSet = class extends _classSuper {
1661
+ static { _classThis = this; }
1662
+ static {
1663
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1664
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1665
+ IrrigationCCValveConfigSet = _classThis = _classDescriptor.value;
1666
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1667
+ __runInitializers(_classThis, _classExtraInitializers);
1668
+ }
1669
+ constructor(options) {
1670
+ super(options);
1671
+ this.valveId = options.valveId;
1672
+ this.nominalCurrentHighThreshold = options.nominalCurrentHighThreshold;
1673
+ this.nominalCurrentLowThreshold = options.nominalCurrentLowThreshold;
1674
+ this.maximumFlow = options.maximumFlow;
1675
+ this.highFlowThreshold = options.highFlowThreshold;
1676
+ this.lowFlowThreshold = options.lowFlowThreshold;
1677
+ this.useRainSensor = options.useRainSensor;
1678
+ this.useMoistureSensor = options.useMoistureSensor;
1679
+ }
1680
+ static from(_raw, _ctx) {
1681
+ // TODO: Deserialize payload
1682
+ throw new ZWaveError(`${this.name}: deserialization not implemented`, ZWaveErrorCodes.Deserialization_NotImplemented);
1683
+ // return new IrrigationCCValveConfigSet({
1684
+ // nodeId: ctx.sourceNodeId,
1685
+ // });
1686
+ }
1687
+ valveId;
1688
+ nominalCurrentHighThreshold;
1689
+ nominalCurrentLowThreshold;
1690
+ maximumFlow;
1691
+ highFlowThreshold;
1692
+ lowFlowThreshold;
1693
+ useRainSensor;
1694
+ useMoistureSensor;
1695
+ serialize(ctx) {
1696
+ this.payload = Bytes.concat([
1697
+ Bytes.from([
1698
+ this.valveId === "master" ? 1 : 0,
1699
+ this.valveId === "master" ? 1 : this.valveId || 1,
1700
+ Math.floor(this.nominalCurrentHighThreshold / 10),
1701
+ Math.floor(this.nominalCurrentLowThreshold / 10),
1702
+ ]),
1703
+ encodeFloatWithScale(this.maximumFlow, 0 /* l/h */),
1704
+ encodeFloatWithScale(this.highFlowThreshold, 0 /* l/h */),
1705
+ encodeFloatWithScale(this.lowFlowThreshold, 0 /* l/h */),
1706
+ Bytes.from([
1707
+ (this.useRainSensor ? 0b1 : 0)
1708
+ | (this.useMoistureSensor ? 0b10 : 0),
1709
+ ]),
1710
+ ]);
1711
+ return super.serialize(ctx);
1712
+ }
1713
+ toLogEntry(ctx) {
1714
+ return {
1715
+ ...super.toLogEntry(ctx),
1716
+ message: {
1717
+ "valve ID": this.valveId,
1718
+ "nominal current high threshold": `${this.nominalCurrentHighThreshold} mA`,
1719
+ "nominal current low threshold": `${this.nominalCurrentLowThreshold} mA`,
1720
+ "maximum flow": `${this.maximumFlow} l/h`,
1721
+ "high flow threshold": `${this.highFlowThreshold} l/h`,
1722
+ "low flow threshold": `${this.lowFlowThreshold} l/h`,
1723
+ "use rain sensor": this.useRainSensor,
1724
+ "use moisture sensor": this.useMoistureSensor,
1725
+ },
1726
+ };
1727
+ }
1728
+ };
1729
+ return IrrigationCCValveConfigSet = _classThis;
1730
+ })();
1628
1731
  export { IrrigationCCValveConfigSet };
1629
- let IrrigationCCValveConfigReport = IrrigationCCValveConfigReport_1 = class IrrigationCCValveConfigReport extends IrrigationCC {
1630
- constructor(options) {
1631
- super(options);
1632
- // TODO: Check implementation:
1633
- this.valveId = options.valveId;
1634
- this.nominalCurrentHighThreshold = options.nominalCurrentHighThreshold;
1635
- this.nominalCurrentLowThreshold = options.nominalCurrentLowThreshold;
1636
- this.maximumFlow = options.maximumFlow;
1637
- this.highFlowThreshold = options.highFlowThreshold;
1638
- this.lowFlowThreshold = options.lowFlowThreshold;
1639
- this.useRainSensor = options.useRainSensor;
1640
- this.useMoistureSensor = options.useMoistureSensor;
1641
- }
1642
- static from(raw, ctx) {
1643
- validatePayload(raw.payload.length >= 4);
1644
- let valveId;
1645
- if ((raw.payload[0] & 0b1) === ValveType.MasterValve) {
1646
- valveId = "master";
1647
- }
1648
- else {
1649
- valveId = raw.payload[1];
1650
- }
1651
- const nominalCurrentHighThreshold = 10 * raw.payload[2];
1652
- const nominalCurrentLowThreshold = 10 * raw.payload[3];
1653
- let offset = 4;
1654
- let maximumFlow;
1655
- {
1656
- const { value, scale, bytesRead } = parseFloatWithScale(raw.payload.subarray(offset));
1657
- validatePayload(scale === 0 /* l/h */);
1658
- maximumFlow = value;
1659
- offset += bytesRead;
1660
- }
1661
- let highFlowThreshold;
1662
- {
1663
- const { value, scale, bytesRead } = parseFloatWithScale(raw.payload.subarray(offset));
1664
- validatePayload(scale === 0 /* l/h */);
1665
- highFlowThreshold = value;
1666
- offset += bytesRead;
1667
- }
1668
- let lowFlowThreshold;
1669
- {
1670
- const { value, scale, bytesRead } = parseFloatWithScale(raw.payload.subarray(offset));
1671
- validatePayload(scale === 0 /* l/h */);
1672
- lowFlowThreshold = value;
1673
- offset += bytesRead;
1674
- }
1675
- validatePayload(raw.payload.length >= offset + 1);
1676
- const useRainSensor = !!(raw.payload[offset] & 0b1);
1677
- const useMoistureSensor = !!(raw.payload[offset] & 0b10);
1678
- return new IrrigationCCValveConfigReport_1({
1679
- nodeId: ctx.sourceNodeId,
1680
- valveId,
1681
- nominalCurrentHighThreshold,
1682
- nominalCurrentLowThreshold,
1683
- maximumFlow,
1684
- highFlowThreshold,
1685
- lowFlowThreshold,
1686
- useRainSensor,
1687
- useMoistureSensor,
1688
- });
1689
- }
1690
- persistValues(ctx) {
1691
- if (!super.persistValues(ctx))
1692
- return false;
1693
- // nominalCurrentHighThreshold
1694
- const nominalCurrentHighThresholdValue = IrrigationCCValues
1695
- .nominalCurrentHighThreshold(this.valveId);
1696
- this.ensureMetadata(ctx, nominalCurrentHighThresholdValue);
1697
- this.setValue(ctx, nominalCurrentHighThresholdValue, this.nominalCurrentHighThreshold);
1698
- // nominalCurrentLowThreshold
1699
- const nominalCurrentLowThresholdValue = IrrigationCCValues
1700
- .nominalCurrentLowThreshold(this.valveId);
1701
- this.ensureMetadata(ctx, nominalCurrentLowThresholdValue);
1702
- this.setValue(ctx, nominalCurrentLowThresholdValue, this.nominalCurrentLowThreshold);
1703
- // maximumFlow
1704
- const maximumFlowValue = IrrigationCCValues.maximumFlow(this.valveId);
1705
- this.ensureMetadata(ctx, maximumFlowValue);
1706
- this.setValue(ctx, maximumFlowValue, this.maximumFlow);
1707
- // highFlowThreshold
1708
- const highFlowThresholdValue = IrrigationCCValues.highFlowThreshold(this.valveId);
1709
- this.ensureMetadata(ctx, highFlowThresholdValue);
1710
- this.setValue(ctx, highFlowThresholdValue, this.highFlowThreshold);
1711
- // lowFlowThreshold
1712
- const lowFlowThresholdValue = IrrigationCCValues.lowFlowThreshold(this.valveId);
1713
- this.ensureMetadata(ctx, lowFlowThresholdValue);
1714
- this.setValue(ctx, lowFlowThresholdValue, this.lowFlowThreshold);
1715
- // useRainSensor
1716
- const useRainSensorValue = IrrigationCCValues.useRainSensor(this.valveId);
1717
- this.ensureMetadata(ctx, useRainSensorValue);
1718
- this.setValue(ctx, useRainSensorValue, this.useRainSensor);
1719
- // useMoistureSensor
1720
- const useMoistureSensorValue = IrrigationCCValues.useMoistureSensor(this.valveId);
1721
- this.ensureMetadata(ctx, useMoistureSensorValue);
1722
- this.setValue(ctx, useMoistureSensorValue, this.useMoistureSensor);
1723
- return true;
1724
- }
1725
- valveId;
1726
- nominalCurrentHighThreshold;
1727
- nominalCurrentLowThreshold;
1728
- maximumFlow;
1729
- highFlowThreshold;
1730
- lowFlowThreshold;
1731
- useRainSensor;
1732
- useMoistureSensor;
1733
- toLogEntry(ctx) {
1734
- return {
1735
- ...super.toLogEntry(ctx),
1736
- message: {
1737
- "valve ID": this.valveId,
1738
- "nominal current high threshold": `${this.nominalCurrentHighThreshold} mA`,
1739
- "nominal current low threshold": `${this.nominalCurrentLowThreshold} mA`,
1740
- "maximum flow": `${this.maximumFlow} l/h`,
1741
- "high flow threshold": `${this.highFlowThreshold} l/h`,
1742
- "low flow threshold": `${this.lowFlowThreshold} l/h`,
1743
- "use rain sensor": this.useRainSensor,
1744
- "use moisture sensor": this.useMoistureSensor,
1745
- },
1746
- };
1747
- }
1748
- };
1749
- IrrigationCCValveConfigReport = IrrigationCCValveConfigReport_1 = __decorate([
1750
- CCCommand(IrrigationCommand.ValveConfigReport)
1751
- ], IrrigationCCValveConfigReport);
1732
+ let IrrigationCCValveConfigReport = (() => {
1733
+ let _classDecorators = [CCCommand(IrrigationCommand.ValveConfigReport)];
1734
+ let _classDescriptor;
1735
+ let _classExtraInitializers = [];
1736
+ let _classThis;
1737
+ let _classSuper = IrrigationCC;
1738
+ var IrrigationCCValveConfigReport = class extends _classSuper {
1739
+ static { _classThis = this; }
1740
+ static {
1741
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1742
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1743
+ IrrigationCCValveConfigReport = _classThis = _classDescriptor.value;
1744
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1745
+ __runInitializers(_classThis, _classExtraInitializers);
1746
+ }
1747
+ constructor(options) {
1748
+ super(options);
1749
+ // TODO: Check implementation:
1750
+ this.valveId = options.valveId;
1751
+ this.nominalCurrentHighThreshold = options.nominalCurrentHighThreshold;
1752
+ this.nominalCurrentLowThreshold = options.nominalCurrentLowThreshold;
1753
+ this.maximumFlow = options.maximumFlow;
1754
+ this.highFlowThreshold = options.highFlowThreshold;
1755
+ this.lowFlowThreshold = options.lowFlowThreshold;
1756
+ this.useRainSensor = options.useRainSensor;
1757
+ this.useMoistureSensor = options.useMoistureSensor;
1758
+ }
1759
+ static from(raw, ctx) {
1760
+ validatePayload(raw.payload.length >= 4);
1761
+ let valveId;
1762
+ if ((raw.payload[0] & 0b1) === ValveType.MasterValve) {
1763
+ valveId = "master";
1764
+ }
1765
+ else {
1766
+ valveId = raw.payload[1];
1767
+ }
1768
+ const nominalCurrentHighThreshold = 10 * raw.payload[2];
1769
+ const nominalCurrentLowThreshold = 10 * raw.payload[3];
1770
+ let offset = 4;
1771
+ let maximumFlow;
1772
+ {
1773
+ const { value, scale, bytesRead } = parseFloatWithScale(raw.payload.subarray(offset));
1774
+ validatePayload(scale === 0 /* l/h */);
1775
+ maximumFlow = value;
1776
+ offset += bytesRead;
1777
+ }
1778
+ let highFlowThreshold;
1779
+ {
1780
+ const { value, scale, bytesRead } = parseFloatWithScale(raw.payload.subarray(offset));
1781
+ validatePayload(scale === 0 /* l/h */);
1782
+ highFlowThreshold = value;
1783
+ offset += bytesRead;
1784
+ }
1785
+ let lowFlowThreshold;
1786
+ {
1787
+ const { value, scale, bytesRead } = parseFloatWithScale(raw.payload.subarray(offset));
1788
+ validatePayload(scale === 0 /* l/h */);
1789
+ lowFlowThreshold = value;
1790
+ offset += bytesRead;
1791
+ }
1792
+ validatePayload(raw.payload.length >= offset + 1);
1793
+ const useRainSensor = !!(raw.payload[offset] & 0b1);
1794
+ const useMoistureSensor = !!(raw.payload[offset] & 0b10);
1795
+ return new this({
1796
+ nodeId: ctx.sourceNodeId,
1797
+ valveId,
1798
+ nominalCurrentHighThreshold,
1799
+ nominalCurrentLowThreshold,
1800
+ maximumFlow,
1801
+ highFlowThreshold,
1802
+ lowFlowThreshold,
1803
+ useRainSensor,
1804
+ useMoistureSensor,
1805
+ });
1806
+ }
1807
+ persistValues(ctx) {
1808
+ if (!super.persistValues(ctx))
1809
+ return false;
1810
+ // nominalCurrentHighThreshold
1811
+ const nominalCurrentHighThresholdValue = IrrigationCCValues
1812
+ .nominalCurrentHighThreshold(this.valveId);
1813
+ this.ensureMetadata(ctx, nominalCurrentHighThresholdValue);
1814
+ this.setValue(ctx, nominalCurrentHighThresholdValue, this.nominalCurrentHighThreshold);
1815
+ // nominalCurrentLowThreshold
1816
+ const nominalCurrentLowThresholdValue = IrrigationCCValues
1817
+ .nominalCurrentLowThreshold(this.valveId);
1818
+ this.ensureMetadata(ctx, nominalCurrentLowThresholdValue);
1819
+ this.setValue(ctx, nominalCurrentLowThresholdValue, this.nominalCurrentLowThreshold);
1820
+ // maximumFlow
1821
+ const maximumFlowValue = IrrigationCCValues.maximumFlow(this.valveId);
1822
+ this.ensureMetadata(ctx, maximumFlowValue);
1823
+ this.setValue(ctx, maximumFlowValue, this.maximumFlow);
1824
+ // highFlowThreshold
1825
+ const highFlowThresholdValue = IrrigationCCValues.highFlowThreshold(this.valveId);
1826
+ this.ensureMetadata(ctx, highFlowThresholdValue);
1827
+ this.setValue(ctx, highFlowThresholdValue, this.highFlowThreshold);
1828
+ // lowFlowThreshold
1829
+ const lowFlowThresholdValue = IrrigationCCValues.lowFlowThreshold(this.valveId);
1830
+ this.ensureMetadata(ctx, lowFlowThresholdValue);
1831
+ this.setValue(ctx, lowFlowThresholdValue, this.lowFlowThreshold);
1832
+ // useRainSensor
1833
+ const useRainSensorValue = IrrigationCCValues.useRainSensor(this.valveId);
1834
+ this.ensureMetadata(ctx, useRainSensorValue);
1835
+ this.setValue(ctx, useRainSensorValue, this.useRainSensor);
1836
+ // useMoistureSensor
1837
+ const useMoistureSensorValue = IrrigationCCValues.useMoistureSensor(this.valveId);
1838
+ this.ensureMetadata(ctx, useMoistureSensorValue);
1839
+ this.setValue(ctx, useMoistureSensorValue, this.useMoistureSensor);
1840
+ return true;
1841
+ }
1842
+ valveId;
1843
+ nominalCurrentHighThreshold;
1844
+ nominalCurrentLowThreshold;
1845
+ maximumFlow;
1846
+ highFlowThreshold;
1847
+ lowFlowThreshold;
1848
+ useRainSensor;
1849
+ useMoistureSensor;
1850
+ toLogEntry(ctx) {
1851
+ return {
1852
+ ...super.toLogEntry(ctx),
1853
+ message: {
1854
+ "valve ID": this.valveId,
1855
+ "nominal current high threshold": `${this.nominalCurrentHighThreshold} mA`,
1856
+ "nominal current low threshold": `${this.nominalCurrentLowThreshold} mA`,
1857
+ "maximum flow": `${this.maximumFlow} l/h`,
1858
+ "high flow threshold": `${this.highFlowThreshold} l/h`,
1859
+ "low flow threshold": `${this.lowFlowThreshold} l/h`,
1860
+ "use rain sensor": this.useRainSensor,
1861
+ "use moisture sensor": this.useMoistureSensor,
1862
+ },
1863
+ };
1864
+ }
1865
+ };
1866
+ return IrrigationCCValveConfigReport = _classThis;
1867
+ })();
1752
1868
  export { IrrigationCCValveConfigReport };
1753
- let IrrigationCCValveConfigGet = class IrrigationCCValveConfigGet extends IrrigationCC {
1754
- constructor(options) {
1755
- super(options);
1756
- this.valveId = options.valveId;
1757
- }
1758
- static from(_raw, _ctx) {
1759
- // TODO: Deserialize payload
1760
- throw new ZWaveError(`${this.name}: deserialization not implemented`, ZWaveErrorCodes.Deserialization_NotImplemented);
1761
- // return new IrrigationCCValveConfigGet({
1762
- // nodeId: ctx.sourceNodeId,
1763
- // });
1764
- }
1765
- valveId;
1766
- serialize(ctx) {
1767
- this.payload = Bytes.from([
1768
- this.valveId === "master" ? 1 : 0,
1769
- this.valveId === "master" ? 1 : this.valveId || 1,
1770
- ]);
1771
- return super.serialize(ctx);
1772
- }
1773
- toLogEntry(ctx) {
1774
- return {
1775
- ...super.toLogEntry(ctx),
1776
- message: {
1777
- "valve ID": this.valveId,
1778
- },
1779
- };
1780
- }
1781
- };
1782
- IrrigationCCValveConfigGet = __decorate([
1783
- CCCommand(IrrigationCommand.ValveConfigGet),
1784
- expectedCCResponse(IrrigationCCValveConfigReport, testResponseForIrrigationCommandWithValveId)
1785
- ], IrrigationCCValveConfigGet);
1869
+ let IrrigationCCValveConfigGet = (() => {
1870
+ let _classDecorators = [CCCommand(IrrigationCommand.ValveConfigGet), expectedCCResponse(IrrigationCCValveConfigReport, testResponseForIrrigationCommandWithValveId)];
1871
+ let _classDescriptor;
1872
+ let _classExtraInitializers = [];
1873
+ let _classThis;
1874
+ let _classSuper = IrrigationCC;
1875
+ var IrrigationCCValveConfigGet = class extends _classSuper {
1876
+ static { _classThis = this; }
1877
+ static {
1878
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1879
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1880
+ IrrigationCCValveConfigGet = _classThis = _classDescriptor.value;
1881
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1882
+ __runInitializers(_classThis, _classExtraInitializers);
1883
+ }
1884
+ constructor(options) {
1885
+ super(options);
1886
+ this.valveId = options.valveId;
1887
+ }
1888
+ static from(_raw, _ctx) {
1889
+ // TODO: Deserialize payload
1890
+ throw new ZWaveError(`${this.name}: deserialization not implemented`, ZWaveErrorCodes.Deserialization_NotImplemented);
1891
+ // return new IrrigationCCValveConfigGet({
1892
+ // nodeId: ctx.sourceNodeId,
1893
+ // });
1894
+ }
1895
+ valveId;
1896
+ serialize(ctx) {
1897
+ this.payload = Bytes.from([
1898
+ this.valveId === "master" ? 1 : 0,
1899
+ this.valveId === "master" ? 1 : this.valveId || 1,
1900
+ ]);
1901
+ return super.serialize(ctx);
1902
+ }
1903
+ toLogEntry(ctx) {
1904
+ return {
1905
+ ...super.toLogEntry(ctx),
1906
+ message: {
1907
+ "valve ID": this.valveId,
1908
+ },
1909
+ };
1910
+ }
1911
+ };
1912
+ return IrrigationCCValveConfigGet = _classThis;
1913
+ })();
1786
1914
  export { IrrigationCCValveConfigGet };
1787
- let IrrigationCCValveRun = class IrrigationCCValveRun extends IrrigationCC {
1788
- constructor(options) {
1789
- super(options);
1790
- this.valveId = options.valveId;
1791
- this.duration = options.duration;
1792
- }
1793
- static from(_raw, _ctx) {
1794
- // TODO: Deserialize payload
1795
- throw new ZWaveError(`${this.name}: deserialization not implemented`, ZWaveErrorCodes.Deserialization_NotImplemented);
1796
- // return new IrrigationCCValveRun({
1797
- // nodeId: ctx.sourceNodeId,
1798
- // });
1799
- }
1800
- valveId;
1801
- duration;
1802
- serialize(ctx) {
1803
- this.payload = Bytes.from([
1804
- this.valveId === "master" ? 1 : 0,
1805
- this.valveId === "master" ? 1 : this.valveId || 1,
1806
- 0,
1807
- 0,
1808
- ]);
1809
- this.payload.writeUInt16BE(this.duration, 2);
1810
- return super.serialize(ctx);
1811
- }
1812
- toLogEntry(ctx) {
1813
- const message = {
1814
- "valve ID": this.valveId,
1815
- };
1816
- if (this.duration) {
1817
- message.duration = `${this.duration} s`;
1818
- }
1819
- else {
1820
- message.action = "turn off";
1821
- }
1822
- return {
1823
- ...super.toLogEntry(ctx),
1824
- message,
1825
- };
1826
- }
1827
- };
1828
- IrrigationCCValveRun = __decorate([
1829
- CCCommand(IrrigationCommand.ValveRun),
1830
- useSupervision()
1831
- ], IrrigationCCValveRun);
1832
- export { IrrigationCCValveRun };
1833
- let IrrigationCCValveTableSet = class IrrigationCCValveTableSet extends IrrigationCC {
1834
- constructor(options) {
1835
- super(options);
1836
- this.tableId = options.tableId;
1837
- this.entries = options.entries;
1838
- }
1839
- static from(_raw, _ctx) {
1840
- // TODO: Deserialize payload
1841
- throw new ZWaveError(`${this.name}: deserialization not implemented`, ZWaveErrorCodes.Deserialization_NotImplemented);
1842
- // return new IrrigationCCValveTableSet({
1843
- // nodeId: ctx.sourceNodeId,
1844
- // });
1845
- }
1846
- tableId;
1847
- entries;
1848
- serialize(ctx) {
1849
- this.payload = new Bytes(1 + this.entries.length * 3);
1850
- this.payload[0] = this.tableId;
1851
- for (let i = 0; i < this.entries.length; i++) {
1852
- const entry = this.entries[i];
1853
- const offset = 1 + i * 3;
1854
- this.payload[offset] = entry.valveId;
1855
- this.payload.writeUInt16BE(entry.duration, offset + 1);
1856
- }
1857
- return super.serialize(ctx);
1858
- }
1859
- toLogEntry(ctx) {
1860
- const message = {
1861
- "table ID": this.tableId,
1862
- };
1863
- for (let i = 0; i < this.entries.length; i++) {
1864
- const entry = this.entries[i];
1865
- const valveLabel = padStart(entry.valveId.toString(), 3, "0");
1866
- if (entry.duration) {
1867
- message[`valve ${valveLabel} duration`] = `${entry.duration} s`;
1915
+ let IrrigationCCValveRun = (() => {
1916
+ let _classDecorators = [CCCommand(IrrigationCommand.ValveRun), useSupervision()];
1917
+ let _classDescriptor;
1918
+ let _classExtraInitializers = [];
1919
+ let _classThis;
1920
+ let _classSuper = IrrigationCC;
1921
+ var IrrigationCCValveRun = class extends _classSuper {
1922
+ static { _classThis = this; }
1923
+ static {
1924
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1925
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1926
+ IrrigationCCValveRun = _classThis = _classDescriptor.value;
1927
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1928
+ __runInitializers(_classThis, _classExtraInitializers);
1929
+ }
1930
+ constructor(options) {
1931
+ super(options);
1932
+ this.valveId = options.valveId;
1933
+ this.duration = options.duration;
1934
+ }
1935
+ static from(_raw, _ctx) {
1936
+ // TODO: Deserialize payload
1937
+ throw new ZWaveError(`${this.name}: deserialization not implemented`, ZWaveErrorCodes.Deserialization_NotImplemented);
1938
+ // return new IrrigationCCValveRun({
1939
+ // nodeId: ctx.sourceNodeId,
1940
+ // });
1941
+ }
1942
+ valveId;
1943
+ duration;
1944
+ serialize(ctx) {
1945
+ this.payload = Bytes.from([
1946
+ this.valveId === "master" ? 1 : 0,
1947
+ this.valveId === "master" ? 1 : this.valveId || 1,
1948
+ 0,
1949
+ 0,
1950
+ ]);
1951
+ this.payload.writeUInt16BE(this.duration, 2);
1952
+ return super.serialize(ctx);
1953
+ }
1954
+ toLogEntry(ctx) {
1955
+ const message = {
1956
+ "valve ID": this.valveId,
1957
+ };
1958
+ if (this.duration) {
1959
+ message.duration = `${this.duration} s`;
1868
1960
  }
1869
1961
  else {
1870
- message[`valve ${valveLabel} action`] = `turn off`;
1962
+ message.action = "turn off";
1963
+ }
1964
+ return {
1965
+ ...super.toLogEntry(ctx),
1966
+ message,
1967
+ };
1968
+ }
1969
+ };
1970
+ return IrrigationCCValveRun = _classThis;
1971
+ })();
1972
+ export { IrrigationCCValveRun };
1973
+ let IrrigationCCValveTableSet = (() => {
1974
+ let _classDecorators = [CCCommand(IrrigationCommand.ValveTableSet), useSupervision()];
1975
+ let _classDescriptor;
1976
+ let _classExtraInitializers = [];
1977
+ let _classThis;
1978
+ let _classSuper = IrrigationCC;
1979
+ var IrrigationCCValveTableSet = class extends _classSuper {
1980
+ static { _classThis = this; }
1981
+ static {
1982
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1983
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1984
+ IrrigationCCValveTableSet = _classThis = _classDescriptor.value;
1985
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1986
+ __runInitializers(_classThis, _classExtraInitializers);
1987
+ }
1988
+ constructor(options) {
1989
+ super(options);
1990
+ this.tableId = options.tableId;
1991
+ this.entries = options.entries;
1992
+ }
1993
+ static from(_raw, _ctx) {
1994
+ // TODO: Deserialize payload
1995
+ throw new ZWaveError(`${this.name}: deserialization not implemented`, ZWaveErrorCodes.Deserialization_NotImplemented);
1996
+ // return new IrrigationCCValveTableSet({
1997
+ // nodeId: ctx.sourceNodeId,
1998
+ // });
1999
+ }
2000
+ tableId;
2001
+ entries;
2002
+ serialize(ctx) {
2003
+ this.payload = new Bytes(1 + this.entries.length * 3);
2004
+ this.payload[0] = this.tableId;
2005
+ for (let i = 0; i < this.entries.length; i++) {
2006
+ const entry = this.entries[i];
2007
+ const offset = 1 + i * 3;
2008
+ this.payload[offset] = entry.valveId;
2009
+ this.payload.writeUInt16BE(entry.duration, offset + 1);
1871
2010
  }
2011
+ return super.serialize(ctx);
1872
2012
  }
1873
- return {
1874
- ...super.toLogEntry(ctx),
1875
- message,
1876
- };
1877
- }
1878
- };
1879
- IrrigationCCValveTableSet = __decorate([
1880
- CCCommand(IrrigationCommand.ValveTableSet),
1881
- useSupervision()
1882
- ], IrrigationCCValveTableSet);
2013
+ toLogEntry(ctx) {
2014
+ const message = {
2015
+ "table ID": this.tableId,
2016
+ };
2017
+ for (let i = 0; i < this.entries.length; i++) {
2018
+ const entry = this.entries[i];
2019
+ const valveLabel = padStart(entry.valveId.toString(), 3, "0");
2020
+ if (entry.duration) {
2021
+ message[`valve ${valveLabel} duration`] = `${entry.duration} s`;
2022
+ }
2023
+ else {
2024
+ message[`valve ${valveLabel} action`] = `turn off`;
2025
+ }
2026
+ }
2027
+ return {
2028
+ ...super.toLogEntry(ctx),
2029
+ message,
2030
+ };
2031
+ }
2032
+ };
2033
+ return IrrigationCCValveTableSet = _classThis;
2034
+ })();
1883
2035
  export { IrrigationCCValveTableSet };
1884
- let IrrigationCCValveTableReport = IrrigationCCValveTableReport_1 = class IrrigationCCValveTableReport extends IrrigationCC {
1885
- constructor(options) {
1886
- super(options);
1887
- // TODO: Check implementation:
1888
- this.tableId = options.tableId;
1889
- this.entries = options.entries;
1890
- }
1891
- static from(raw, ctx) {
1892
- validatePayload((raw.payload.length - 1) % 3 === 0);
1893
- const tableId = raw.payload[0];
1894
- const entries = [];
1895
- for (let offset = 1; offset < raw.payload.length; offset += 3) {
1896
- entries.push({
1897
- valveId: raw.payload[offset],
1898
- duration: raw.payload.readUInt16BE(offset + 1),
2036
+ let IrrigationCCValveTableReport = (() => {
2037
+ let _classDecorators = [CCCommand(IrrigationCommand.ValveTableReport)];
2038
+ let _classDescriptor;
2039
+ let _classExtraInitializers = [];
2040
+ let _classThis;
2041
+ let _classSuper = IrrigationCC;
2042
+ var IrrigationCCValveTableReport = class extends _classSuper {
2043
+ static { _classThis = this; }
2044
+ static {
2045
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
2046
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
2047
+ IrrigationCCValveTableReport = _classThis = _classDescriptor.value;
2048
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
2049
+ __runInitializers(_classThis, _classExtraInitializers);
2050
+ }
2051
+ constructor(options) {
2052
+ super(options);
2053
+ // TODO: Check implementation:
2054
+ this.tableId = options.tableId;
2055
+ this.entries = options.entries;
2056
+ }
2057
+ static from(raw, ctx) {
2058
+ validatePayload((raw.payload.length - 1) % 3 === 0);
2059
+ const tableId = raw.payload[0];
2060
+ const entries = [];
2061
+ for (let offset = 1; offset < raw.payload.length; offset += 3) {
2062
+ entries.push({
2063
+ valveId: raw.payload[offset],
2064
+ duration: raw.payload.readUInt16BE(offset + 1),
2065
+ });
2066
+ }
2067
+ return new this({
2068
+ nodeId: ctx.sourceNodeId,
2069
+ tableId,
2070
+ entries,
1899
2071
  });
1900
2072
  }
1901
- return new IrrigationCCValveTableReport_1({
1902
- nodeId: ctx.sourceNodeId,
1903
- tableId,
1904
- entries,
1905
- });
1906
- }
1907
- tableId;
1908
- entries;
1909
- toLogEntry(ctx) {
1910
- const message = {
1911
- "table ID": this.tableId,
1912
- };
1913
- for (let i = 0; i < this.entries.length; i++) {
1914
- const entry = this.entries[i];
1915
- const valveLabel = padStart(entry.valveId.toString(), 3, "0");
1916
- if (entry.duration) {
1917
- message[`valve ${valveLabel} duration`] = `${entry.duration} s`;
1918
- }
1919
- else {
1920
- message[`valve ${valveLabel} action`] = `turn off`;
2073
+ tableId;
2074
+ entries;
2075
+ toLogEntry(ctx) {
2076
+ const message = {
2077
+ "table ID": this.tableId,
2078
+ };
2079
+ for (let i = 0; i < this.entries.length; i++) {
2080
+ const entry = this.entries[i];
2081
+ const valveLabel = padStart(entry.valveId.toString(), 3, "0");
2082
+ if (entry.duration) {
2083
+ message[`valve ${valveLabel} duration`] = `${entry.duration} s`;
2084
+ }
2085
+ else {
2086
+ message[`valve ${valveLabel} action`] = `turn off`;
2087
+ }
1921
2088
  }
1922
- }
1923
- return {
1924
- ...super.toLogEntry(ctx),
1925
- message,
1926
- };
1927
- }
1928
- };
1929
- IrrigationCCValveTableReport = IrrigationCCValveTableReport_1 = __decorate([
1930
- CCCommand(IrrigationCommand.ValveTableReport)
1931
- ], IrrigationCCValveTableReport);
2089
+ return {
2090
+ ...super.toLogEntry(ctx),
2091
+ message,
2092
+ };
2093
+ }
2094
+ };
2095
+ return IrrigationCCValveTableReport = _classThis;
2096
+ })();
1932
2097
  export { IrrigationCCValveTableReport };
1933
2098
  function testResponseForIrrigationValveTableGet(sent, received) {
1934
2099
  return received.tableId === sent.tableId;
1935
2100
  }
1936
- let IrrigationCCValveTableGet = class IrrigationCCValveTableGet extends IrrigationCC {
1937
- constructor(options) {
1938
- super(options);
1939
- this.tableId = options.tableId;
1940
- }
1941
- static from(_raw, _ctx) {
1942
- // TODO: Deserialize payload
1943
- throw new ZWaveError(`${this.name}: deserialization not implemented`, ZWaveErrorCodes.Deserialization_NotImplemented);
1944
- // return new IrrigationCCValveTableGet({
1945
- // nodeId: ctx.sourceNodeId,
1946
- // });
1947
- }
1948
- tableId;
1949
- serialize(ctx) {
1950
- this.payload = Bytes.from([this.tableId]);
1951
- return super.serialize(ctx);
1952
- }
1953
- toLogEntry(ctx) {
1954
- return {
1955
- ...super.toLogEntry(ctx),
1956
- message: {
1957
- "table ID": this.tableId,
1958
- },
1959
- };
1960
- }
1961
- };
1962
- IrrigationCCValveTableGet = __decorate([
1963
- CCCommand(IrrigationCommand.ValveTableGet),
1964
- expectedCCResponse(IrrigationCCValveTableReport, testResponseForIrrigationValveTableGet)
1965
- ], IrrigationCCValveTableGet);
2101
+ let IrrigationCCValveTableGet = (() => {
2102
+ let _classDecorators = [CCCommand(IrrigationCommand.ValveTableGet), expectedCCResponse(IrrigationCCValveTableReport, testResponseForIrrigationValveTableGet)];
2103
+ let _classDescriptor;
2104
+ let _classExtraInitializers = [];
2105
+ let _classThis;
2106
+ let _classSuper = IrrigationCC;
2107
+ var IrrigationCCValveTableGet = class extends _classSuper {
2108
+ static { _classThis = this; }
2109
+ static {
2110
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
2111
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
2112
+ IrrigationCCValveTableGet = _classThis = _classDescriptor.value;
2113
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
2114
+ __runInitializers(_classThis, _classExtraInitializers);
2115
+ }
2116
+ constructor(options) {
2117
+ super(options);
2118
+ this.tableId = options.tableId;
2119
+ }
2120
+ static from(_raw, _ctx) {
2121
+ // TODO: Deserialize payload
2122
+ throw new ZWaveError(`${this.name}: deserialization not implemented`, ZWaveErrorCodes.Deserialization_NotImplemented);
2123
+ // return new IrrigationCCValveTableGet({
2124
+ // nodeId: ctx.sourceNodeId,
2125
+ // });
2126
+ }
2127
+ tableId;
2128
+ serialize(ctx) {
2129
+ this.payload = Bytes.from([this.tableId]);
2130
+ return super.serialize(ctx);
2131
+ }
2132
+ toLogEntry(ctx) {
2133
+ return {
2134
+ ...super.toLogEntry(ctx),
2135
+ message: {
2136
+ "table ID": this.tableId,
2137
+ },
2138
+ };
2139
+ }
2140
+ };
2141
+ return IrrigationCCValveTableGet = _classThis;
2142
+ })();
1966
2143
  export { IrrigationCCValveTableGet };
1967
- let IrrigationCCValveTableRun = class IrrigationCCValveTableRun extends IrrigationCC {
1968
- constructor(options) {
1969
- super(options);
1970
- this.tableIDs = options.tableIDs;
1971
- if (this.tableIDs.length < 1) {
1972
- throw new ZWaveError(`${this.constructor.name}: At least one table ID must be specified.`, ZWaveErrorCodes.Argument_Invalid);
2144
+ let IrrigationCCValveTableRun = (() => {
2145
+ let _classDecorators = [CCCommand(IrrigationCommand.ValveTableRun), useSupervision()];
2146
+ let _classDescriptor;
2147
+ let _classExtraInitializers = [];
2148
+ let _classThis;
2149
+ let _classSuper = IrrigationCC;
2150
+ var IrrigationCCValveTableRun = class extends _classSuper {
2151
+ static { _classThis = this; }
2152
+ static {
2153
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
2154
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
2155
+ IrrigationCCValveTableRun = _classThis = _classDescriptor.value;
2156
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
2157
+ __runInitializers(_classThis, _classExtraInitializers);
2158
+ }
2159
+ constructor(options) {
2160
+ super(options);
2161
+ this.tableIDs = options.tableIDs;
2162
+ if (this.tableIDs.length < 1) {
2163
+ throw new ZWaveError(`${this.constructor.name}: At least one table ID must be specified.`, ZWaveErrorCodes.Argument_Invalid);
2164
+ }
1973
2165
  }
1974
- }
1975
- static from(_raw, _ctx) {
1976
- // TODO: Deserialize payload
1977
- throw new ZWaveError(`${this.name}: deserialization not implemented`, ZWaveErrorCodes.Deserialization_NotImplemented);
1978
- // return new IrrigationCCValveTableRun({
1979
- // nodeId: ctx.sourceNodeId,
1980
- // });
1981
- }
1982
- tableIDs;
1983
- serialize(ctx) {
1984
- this.payload = Bytes.from(this.tableIDs);
1985
- return super.serialize(ctx);
1986
- }
1987
- toLogEntry(ctx) {
1988
- return {
1989
- ...super.toLogEntry(ctx),
1990
- message: {
1991
- "table IDs": this.tableIDs
1992
- .map((id) => padStart(id.toString(), 3, "0"))
1993
- .join(", "),
1994
- },
1995
- };
1996
- }
1997
- };
1998
- IrrigationCCValveTableRun = __decorate([
1999
- CCCommand(IrrigationCommand.ValveTableRun),
2000
- useSupervision()
2001
- ], IrrigationCCValveTableRun);
2166
+ static from(_raw, _ctx) {
2167
+ // TODO: Deserialize payload
2168
+ throw new ZWaveError(`${this.name}: deserialization not implemented`, ZWaveErrorCodes.Deserialization_NotImplemented);
2169
+ // return new IrrigationCCValveTableRun({
2170
+ // nodeId: ctx.sourceNodeId,
2171
+ // });
2172
+ }
2173
+ tableIDs;
2174
+ serialize(ctx) {
2175
+ this.payload = Bytes.from(this.tableIDs);
2176
+ return super.serialize(ctx);
2177
+ }
2178
+ toLogEntry(ctx) {
2179
+ return {
2180
+ ...super.toLogEntry(ctx),
2181
+ message: {
2182
+ "table IDs": this.tableIDs
2183
+ .map((id) => padStart(id.toString(), 3, "0"))
2184
+ .join(", "),
2185
+ },
2186
+ };
2187
+ }
2188
+ };
2189
+ return IrrigationCCValveTableRun = _classThis;
2190
+ })();
2002
2191
  export { IrrigationCCValveTableRun };
2003
- let IrrigationCCSystemShutoff = class IrrigationCCSystemShutoff extends IrrigationCC {
2004
- constructor(options) {
2005
- super(options);
2006
- this.duration = options.duration;
2007
- }
2008
- static from(_raw, _ctx) {
2009
- // TODO: Deserialize payload
2010
- throw new ZWaveError(`${this.name}: deserialization not implemented`, ZWaveErrorCodes.Deserialization_NotImplemented);
2011
- // return new IrrigationCCSystemShutoff({
2012
- // nodeId: ctx.sourceNodeId,
2013
- // });
2014
- }
2015
- duration;
2016
- serialize(ctx) {
2017
- this.payload = Bytes.from([this.duration ?? 255]);
2018
- return super.serialize(ctx);
2019
- }
2020
- toLogEntry(ctx) {
2021
- return {
2022
- ...super.toLogEntry(ctx),
2023
- message: {
2024
- duration: this.duration === 0
2025
- ? "temporarily"
2026
- : this.duration === 255 || this.duration === undefined
2027
- ? "permanently"
2028
- : `${this.duration} hours`,
2029
- },
2030
- };
2031
- }
2032
- };
2033
- IrrigationCCSystemShutoff = __decorate([
2034
- CCCommand(IrrigationCommand.SystemShutoff),
2035
- useSupervision()
2036
- ], IrrigationCCSystemShutoff);
2192
+ let IrrigationCCSystemShutoff = (() => {
2193
+ let _classDecorators = [CCCommand(IrrigationCommand.SystemShutoff), useSupervision()];
2194
+ let _classDescriptor;
2195
+ let _classExtraInitializers = [];
2196
+ let _classThis;
2197
+ let _classSuper = IrrigationCC;
2198
+ var IrrigationCCSystemShutoff = class extends _classSuper {
2199
+ static { _classThis = this; }
2200
+ static {
2201
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
2202
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
2203
+ IrrigationCCSystemShutoff = _classThis = _classDescriptor.value;
2204
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
2205
+ __runInitializers(_classThis, _classExtraInitializers);
2206
+ }
2207
+ constructor(options) {
2208
+ super(options);
2209
+ this.duration = options.duration;
2210
+ }
2211
+ static from(_raw, _ctx) {
2212
+ // TODO: Deserialize payload
2213
+ throw new ZWaveError(`${this.name}: deserialization not implemented`, ZWaveErrorCodes.Deserialization_NotImplemented);
2214
+ // return new IrrigationCCSystemShutoff({
2215
+ // nodeId: ctx.sourceNodeId,
2216
+ // });
2217
+ }
2218
+ duration;
2219
+ serialize(ctx) {
2220
+ this.payload = Bytes.from([this.duration ?? 255]);
2221
+ return super.serialize(ctx);
2222
+ }
2223
+ toLogEntry(ctx) {
2224
+ return {
2225
+ ...super.toLogEntry(ctx),
2226
+ message: {
2227
+ duration: this.duration === 0
2228
+ ? "temporarily"
2229
+ : this.duration === 255 || this.duration === undefined
2230
+ ? "permanently"
2231
+ : `${this.duration} hours`,
2232
+ },
2233
+ };
2234
+ }
2235
+ };
2236
+ return IrrigationCCSystemShutoff = _classThis;
2237
+ })();
2037
2238
  export { IrrigationCCSystemShutoff };
2038
2239
  //# sourceMappingURL=IrrigationCC.js.map