@zwave-js/cc 15.25.1 → 15.25.3

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 (314) hide show
  1. package/build/cjs/cc/AlarmSensorCC.js +15 -17
  2. package/build/cjs/cc/AlarmSensorCC.js.map +2 -2
  3. package/build/cjs/cc/AssociationCC.d.ts +1 -1
  4. package/build/cjs/cc/AssociationCC.js +5 -2
  5. package/build/cjs/cc/AssociationCC.js.map +2 -2
  6. package/build/cjs/cc/AssociationGroupInfoCC.js +23 -18
  7. package/build/cjs/cc/AssociationGroupInfoCC.js.map +2 -2
  8. package/build/cjs/cc/BarrierOperatorCC.js +9 -7
  9. package/build/cjs/cc/BarrierOperatorCC.js.map +2 -2
  10. package/build/cjs/cc/BasicCC.js +3 -2
  11. package/build/cjs/cc/BasicCC.js.map +2 -2
  12. package/build/cjs/cc/BatteryCC.js +3 -2
  13. package/build/cjs/cc/BatteryCC.js.map +2 -2
  14. package/build/cjs/cc/BinarySensorCC.js +8 -6
  15. package/build/cjs/cc/BinarySensorCC.js.map +2 -2
  16. package/build/cjs/cc/BinarySwitchCC.js +3 -2
  17. package/build/cjs/cc/BinarySwitchCC.js.map +2 -2
  18. package/build/cjs/cc/CentralSceneCC.js +9 -7
  19. package/build/cjs/cc/CentralSceneCC.js.map +2 -2
  20. package/build/cjs/cc/ClockCC.js +3 -2
  21. package/build/cjs/cc/ClockCC.js.map +2 -2
  22. package/build/cjs/cc/ColorSwitchCC.js +9 -6
  23. package/build/cjs/cc/ColorSwitchCC.js.map +2 -2
  24. package/build/cjs/cc/ConfigurationCC.js +27 -27
  25. package/build/cjs/cc/ConfigurationCC.js.map +2 -2
  26. package/build/cjs/cc/DoorLockCC.js +49 -63
  27. package/build/cjs/cc/DoorLockCC.js.map +2 -2
  28. package/build/cjs/cc/DoorLockLoggingCC.js +3 -2
  29. package/build/cjs/cc/DoorLockLoggingCC.js.map +2 -2
  30. package/build/cjs/cc/EnergyProductionCC.js +3 -2
  31. package/build/cjs/cc/EnergyProductionCC.js.map +2 -2
  32. package/build/cjs/cc/EntryControlCC.js +5 -3
  33. package/build/cjs/cc/EntryControlCC.js.map +2 -2
  34. package/build/cjs/cc/FirmwareUpdateMetaDataCC.js +2 -1
  35. package/build/cjs/cc/FirmwareUpdateMetaDataCC.js.map +2 -2
  36. package/build/cjs/cc/HumidityControlModeCC.js +9 -8
  37. package/build/cjs/cc/HumidityControlModeCC.js.map +2 -2
  38. package/build/cjs/cc/HumidityControlOperatingStateCC.js +3 -2
  39. package/build/cjs/cc/HumidityControlOperatingStateCC.js.map +2 -2
  40. package/build/cjs/cc/HumidityControlSetpointCC.js +19 -17
  41. package/build/cjs/cc/HumidityControlSetpointCC.js.map +2 -2
  42. package/build/cjs/cc/IndicatorCC.js +5 -2
  43. package/build/cjs/cc/IndicatorCC.js.map +2 -2
  44. package/build/cjs/cc/IrrigationCC.js +26 -27
  45. package/build/cjs/cc/IrrigationCC.js.map +2 -2
  46. package/build/cjs/cc/LanguageCC.js +3 -2
  47. package/build/cjs/cc/LanguageCC.js.map +2 -2
  48. package/build/cjs/cc/LockCC.js +3 -2
  49. package/build/cjs/cc/LockCC.js.map +2 -2
  50. package/build/cjs/cc/ManufacturerSpecificCC.js +4 -1
  51. package/build/cjs/cc/ManufacturerSpecificCC.js.map +2 -2
  52. package/build/cjs/cc/MeterCC.js +14 -13
  53. package/build/cjs/cc/MeterCC.js.map +2 -2
  54. package/build/cjs/cc/MultiChannelAssociationCC.js +5 -2
  55. package/build/cjs/cc/MultiChannelAssociationCC.js.map +2 -2
  56. package/build/cjs/cc/MultiChannelCC.d.ts +1 -1
  57. package/build/cjs/cc/MultiChannelCC.js +19 -22
  58. package/build/cjs/cc/MultiChannelCC.js.map +2 -2
  59. package/build/cjs/cc/MultilevelSensorCC.js +13 -8
  60. package/build/cjs/cc/MultilevelSensorCC.js.map +2 -2
  61. package/build/cjs/cc/MultilevelSwitchCC.js +5 -3
  62. package/build/cjs/cc/MultilevelSwitchCC.js.map +2 -2
  63. package/build/cjs/cc/NodeNamingCC.js +3 -2
  64. package/build/cjs/cc/NodeNamingCC.js.map +2 -2
  65. package/build/cjs/cc/NotificationCC.js +11 -11
  66. package/build/cjs/cc/NotificationCC.js.map +2 -2
  67. package/build/cjs/cc/ProtectionCC.js +16 -15
  68. package/build/cjs/cc/ProtectionCC.js.map +2 -2
  69. package/build/cjs/cc/SceneControllerConfigurationCC.js +2 -1
  70. package/build/cjs/cc/SceneControllerConfigurationCC.js.map +2 -2
  71. package/build/cjs/cc/ScheduleEntryLockCC.js +2 -1
  72. package/build/cjs/cc/ScheduleEntryLockCC.js.map +2 -2
  73. package/build/cjs/cc/Security2CC.js +15 -24
  74. package/build/cjs/cc/Security2CC.js.map +2 -2
  75. package/build/cjs/cc/SecurityCC.js +10 -17
  76. package/build/cjs/cc/SecurityCC.js.map +2 -2
  77. package/build/cjs/cc/SoundSwitchCC.js +2 -1
  78. package/build/cjs/cc/SoundSwitchCC.js.map +2 -2
  79. package/build/cjs/cc/ThermostatFanModeCC.js +9 -7
  80. package/build/cjs/cc/ThermostatFanModeCC.js.map +2 -2
  81. package/build/cjs/cc/ThermostatFanStateCC.js +3 -2
  82. package/build/cjs/cc/ThermostatFanStateCC.js.map +2 -2
  83. package/build/cjs/cc/ThermostatModeCC.js +9 -7
  84. package/build/cjs/cc/ThermostatModeCC.js.map +2 -2
  85. package/build/cjs/cc/ThermostatOperatingStateCC.js +4 -4
  86. package/build/cjs/cc/ThermostatOperatingStateCC.js.map +2 -2
  87. package/build/cjs/cc/ThermostatSetbackCC.js +3 -2
  88. package/build/cjs/cc/ThermostatSetbackCC.js.map +2 -2
  89. package/build/cjs/cc/ThermostatSetpointCC.js +9 -5
  90. package/build/cjs/cc/ThermostatSetpointCC.js.map +2 -2
  91. package/build/cjs/cc/TimeCC.js +2 -1
  92. package/build/cjs/cc/TimeCC.js.map +2 -2
  93. package/build/cjs/cc/TimeParametersCC.js +2 -1
  94. package/build/cjs/cc/TimeParametersCC.js.map +2 -2
  95. package/build/cjs/cc/UserCodeCC.js +6 -6
  96. package/build/cjs/cc/UserCodeCC.js.map +2 -2
  97. package/build/cjs/cc/UserCredentialCC.js +5 -2
  98. package/build/cjs/cc/UserCredentialCC.js.map +2 -2
  99. package/build/cjs/cc/VersionCC.js +2 -1
  100. package/build/cjs/cc/VersionCC.js.map +2 -2
  101. package/build/cjs/cc/WakeUpCC.js +2 -1
  102. package/build/cjs/cc/WakeUpCC.js.map +2 -2
  103. package/build/cjs/cc/WindowCoveringCC.js +10 -7
  104. package/build/cjs/cc/WindowCoveringCC.js.map +2 -2
  105. package/build/cjs/cc/ZWavePlusCC.js +2 -1
  106. package/build/cjs/cc/ZWavePlusCC.js.map +2 -2
  107. package/build/cjs/cc/_CCValues.generated.d.ts +4 -4
  108. package/build/cjs/cc/_CCValues.generated.js +2 -2
  109. package/build/cjs/cc/_CCValues.generated.js.map +1 -1
  110. package/build/cjs/cc/index.d.ts +3 -3
  111. package/build/cjs/cc/index.js.map +2 -2
  112. package/build/cjs/cc/manufacturerProprietary/Decorators.d.ts +1 -1
  113. package/build/cjs/cc/manufacturerProprietary/Decorators.js.map +2 -2
  114. package/build/cjs/cc/manufacturerProprietary/FibaroCC.js +3 -2
  115. package/build/cjs/cc/manufacturerProprietary/FibaroCC.js.map +2 -2
  116. package/build/cjs/lib/API.js.map +2 -2
  117. package/build/cjs/lib/CommandClass.d.ts +5 -1
  118. package/build/cjs/lib/CommandClass.js +25 -3
  119. package/build/cjs/lib/CommandClass.js.map +2 -2
  120. package/build/cjs/lib/CommandClassDecorators.d.ts +4 -4
  121. package/build/cjs/lib/CommandClassDecorators.js.map +2 -2
  122. package/build/cjs/lib/Security2/Extension.d.ts +6 -4
  123. package/build/cjs/lib/Security2/Extension.js +22 -20
  124. package/build/cjs/lib/Security2/Extension.js.map +2 -2
  125. package/build/cjs/lib/_Types.js.map +1 -1
  126. package/build/cjs/lib/utils.js +14 -8
  127. package/build/cjs/lib/utils.js.map +2 -2
  128. package/build/esm/cc/AlarmSensorCC.d.ts.map +1 -1
  129. package/build/esm/cc/AlarmSensorCC.js +14 -18
  130. package/build/esm/cc/AlarmSensorCC.js.map +1 -1
  131. package/build/esm/cc/AssociationCC.d.ts +1 -1
  132. package/build/esm/cc/AssociationCC.d.ts.map +1 -1
  133. package/build/esm/cc/AssociationCC.js +3 -0
  134. package/build/esm/cc/AssociationCC.js.map +1 -1
  135. package/build/esm/cc/AssociationGroupInfoCC.d.ts.map +1 -1
  136. package/build/esm/cc/AssociationGroupInfoCC.js +24 -22
  137. package/build/esm/cc/AssociationGroupInfoCC.js.map +1 -1
  138. package/build/esm/cc/BarrierOperatorCC.d.ts.map +1 -1
  139. package/build/esm/cc/BarrierOperatorCC.js +8 -8
  140. package/build/esm/cc/BarrierOperatorCC.js.map +1 -1
  141. package/build/esm/cc/BasicCC.d.ts.map +1 -1
  142. package/build/esm/cc/BasicCC.js +2 -1
  143. package/build/esm/cc/BasicCC.js.map +1 -1
  144. package/build/esm/cc/BatteryCC.d.ts.map +1 -1
  145. package/build/esm/cc/BatteryCC.js +2 -1
  146. package/build/esm/cc/BatteryCC.js.map +1 -1
  147. package/build/esm/cc/BinarySensorCC.d.ts.map +1 -1
  148. package/build/esm/cc/BinarySensorCC.js +7 -7
  149. package/build/esm/cc/BinarySensorCC.js.map +1 -1
  150. package/build/esm/cc/BinarySwitchCC.d.ts.map +1 -1
  151. package/build/esm/cc/BinarySwitchCC.js +2 -1
  152. package/build/esm/cc/BinarySwitchCC.js.map +1 -1
  153. package/build/esm/cc/CentralSceneCC.d.ts.map +1 -1
  154. package/build/esm/cc/CentralSceneCC.js +9 -8
  155. package/build/esm/cc/CentralSceneCC.js.map +1 -1
  156. package/build/esm/cc/ClockCC.d.ts.map +1 -1
  157. package/build/esm/cc/ClockCC.js +2 -1
  158. package/build/esm/cc/ClockCC.js.map +1 -1
  159. package/build/esm/cc/ColorSwitchCC.d.ts.map +1 -1
  160. package/build/esm/cc/ColorSwitchCC.js +8 -7
  161. package/build/esm/cc/ColorSwitchCC.js.map +1 -1
  162. package/build/esm/cc/ConfigurationCC.d.ts.map +1 -1
  163. package/build/esm/cc/ConfigurationCC.js +32 -29
  164. package/build/esm/cc/ConfigurationCC.js.map +1 -1
  165. package/build/esm/cc/DoorLockCC.d.ts.map +1 -1
  166. package/build/esm/cc/DoorLockCC.js +73 -74
  167. package/build/esm/cc/DoorLockCC.js.map +1 -1
  168. package/build/esm/cc/DoorLockLoggingCC.d.ts.map +1 -1
  169. package/build/esm/cc/DoorLockLoggingCC.js +2 -1
  170. package/build/esm/cc/DoorLockLoggingCC.js.map +1 -1
  171. package/build/esm/cc/EnergyProductionCC.d.ts.map +1 -1
  172. package/build/esm/cc/EnergyProductionCC.js +2 -1
  173. package/build/esm/cc/EnergyProductionCC.js.map +1 -1
  174. package/build/esm/cc/EntryControlCC.d.ts.map +1 -1
  175. package/build/esm/cc/EntryControlCC.js +3 -1
  176. package/build/esm/cc/EntryControlCC.js.map +1 -1
  177. package/build/esm/cc/FirmwareUpdateMetaDataCC.d.ts.map +1 -1
  178. package/build/esm/cc/FirmwareUpdateMetaDataCC.js +1 -0
  179. package/build/esm/cc/FirmwareUpdateMetaDataCC.js.map +1 -1
  180. package/build/esm/cc/HumidityControlModeCC.d.ts.map +1 -1
  181. package/build/esm/cc/HumidityControlModeCC.js +8 -9
  182. package/build/esm/cc/HumidityControlModeCC.js.map +1 -1
  183. package/build/esm/cc/HumidityControlOperatingStateCC.d.ts.map +1 -1
  184. package/build/esm/cc/HumidityControlOperatingStateCC.js +2 -1
  185. package/build/esm/cc/HumidityControlOperatingStateCC.js.map +1 -1
  186. package/build/esm/cc/HumidityControlSetpointCC.d.ts.map +1 -1
  187. package/build/esm/cc/HumidityControlSetpointCC.js +18 -23
  188. package/build/esm/cc/HumidityControlSetpointCC.js.map +1 -1
  189. package/build/esm/cc/IndicatorCC.d.ts.map +1 -1
  190. package/build/esm/cc/IndicatorCC.js +3 -0
  191. package/build/esm/cc/IndicatorCC.js.map +1 -1
  192. package/build/esm/cc/IrrigationCC.d.ts.map +1 -1
  193. package/build/esm/cc/IrrigationCC.js +29 -24
  194. package/build/esm/cc/IrrigationCC.js.map +1 -1
  195. package/build/esm/cc/LanguageCC.d.ts.map +1 -1
  196. package/build/esm/cc/LanguageCC.js +2 -1
  197. package/build/esm/cc/LanguageCC.js.map +1 -1
  198. package/build/esm/cc/LockCC.d.ts.map +1 -1
  199. package/build/esm/cc/LockCC.js +2 -1
  200. package/build/esm/cc/LockCC.js.map +1 -1
  201. package/build/esm/cc/ManufacturerSpecificCC.d.ts.map +1 -1
  202. package/build/esm/cc/ManufacturerSpecificCC.js +4 -1
  203. package/build/esm/cc/ManufacturerSpecificCC.js.map +1 -1
  204. package/build/esm/cc/MeterCC.d.ts.map +1 -1
  205. package/build/esm/cc/MeterCC.js +15 -19
  206. package/build/esm/cc/MeterCC.js.map +1 -1
  207. package/build/esm/cc/MultiChannelAssociationCC.d.ts.map +1 -1
  208. package/build/esm/cc/MultiChannelAssociationCC.js +3 -0
  209. package/build/esm/cc/MultiChannelAssociationCC.js.map +1 -1
  210. package/build/esm/cc/MultiChannelCC.d.ts +1 -1
  211. package/build/esm/cc/MultiChannelCC.d.ts.map +1 -1
  212. package/build/esm/cc/MultiChannelCC.js +19 -23
  213. package/build/esm/cc/MultiChannelCC.js.map +1 -1
  214. package/build/esm/cc/MultilevelSensorCC.d.ts.map +1 -1
  215. package/build/esm/cc/MultilevelSensorCC.js +14 -19
  216. package/build/esm/cc/MultilevelSensorCC.js.map +1 -1
  217. package/build/esm/cc/MultilevelSwitchCC.d.ts.map +1 -1
  218. package/build/esm/cc/MultilevelSwitchCC.js +3 -1
  219. package/build/esm/cc/MultilevelSwitchCC.js.map +1 -1
  220. package/build/esm/cc/NodeNamingCC.d.ts.map +1 -1
  221. package/build/esm/cc/NodeNamingCC.js +2 -1
  222. package/build/esm/cc/NodeNamingCC.js.map +1 -1
  223. package/build/esm/cc/NotificationCC.d.ts.map +1 -1
  224. package/build/esm/cc/NotificationCC.js +11 -14
  225. package/build/esm/cc/NotificationCC.js.map +1 -1
  226. package/build/esm/cc/ProtectionCC.d.ts.map +1 -1
  227. package/build/esm/cc/ProtectionCC.js +15 -22
  228. package/build/esm/cc/ProtectionCC.js.map +1 -1
  229. package/build/esm/cc/SceneControllerConfigurationCC.d.ts.map +1 -1
  230. package/build/esm/cc/SceneControllerConfigurationCC.js +1 -0
  231. package/build/esm/cc/SceneControllerConfigurationCC.js.map +1 -1
  232. package/build/esm/cc/ScheduleEntryLockCC.d.ts.map +1 -1
  233. package/build/esm/cc/ScheduleEntryLockCC.js +1 -0
  234. package/build/esm/cc/ScheduleEntryLockCC.js.map +1 -1
  235. package/build/esm/cc/Security2CC.d.ts.map +1 -1
  236. package/build/esm/cc/Security2CC.js +15 -32
  237. package/build/esm/cc/Security2CC.js.map +1 -1
  238. package/build/esm/cc/SecurityCC.d.ts.map +1 -1
  239. package/build/esm/cc/SecurityCC.js +10 -21
  240. package/build/esm/cc/SecurityCC.js.map +1 -1
  241. package/build/esm/cc/SoundSwitchCC.d.ts.map +1 -1
  242. package/build/esm/cc/SoundSwitchCC.js +1 -0
  243. package/build/esm/cc/SoundSwitchCC.js.map +1 -1
  244. package/build/esm/cc/ThermostatFanModeCC.d.ts.map +1 -1
  245. package/build/esm/cc/ThermostatFanModeCC.js +8 -8
  246. package/build/esm/cc/ThermostatFanModeCC.js.map +1 -1
  247. package/build/esm/cc/ThermostatFanStateCC.d.ts.map +1 -1
  248. package/build/esm/cc/ThermostatFanStateCC.js +2 -1
  249. package/build/esm/cc/ThermostatFanStateCC.js.map +1 -1
  250. package/build/esm/cc/ThermostatModeCC.d.ts.map +1 -1
  251. package/build/esm/cc/ThermostatModeCC.js +8 -8
  252. package/build/esm/cc/ThermostatModeCC.js.map +1 -1
  253. package/build/esm/cc/ThermostatOperatingStateCC.d.ts.map +1 -1
  254. package/build/esm/cc/ThermostatOperatingStateCC.js +4 -5
  255. package/build/esm/cc/ThermostatOperatingStateCC.js.map +1 -1
  256. package/build/esm/cc/ThermostatSetbackCC.d.ts.map +1 -1
  257. package/build/esm/cc/ThermostatSetbackCC.js +2 -1
  258. package/build/esm/cc/ThermostatSetbackCC.js.map +1 -1
  259. package/build/esm/cc/ThermostatSetpointCC.d.ts.map +1 -1
  260. package/build/esm/cc/ThermostatSetpointCC.js +8 -9
  261. package/build/esm/cc/ThermostatSetpointCC.js.map +1 -1
  262. package/build/esm/cc/TimeCC.d.ts.map +1 -1
  263. package/build/esm/cc/TimeCC.js +1 -0
  264. package/build/esm/cc/TimeCC.js.map +1 -1
  265. package/build/esm/cc/TimeParametersCC.d.ts.map +1 -1
  266. package/build/esm/cc/TimeParametersCC.js +1 -0
  267. package/build/esm/cc/TimeParametersCC.js.map +1 -1
  268. package/build/esm/cc/UserCodeCC.d.ts.map +1 -1
  269. package/build/esm/cc/UserCodeCC.js +5 -7
  270. package/build/esm/cc/UserCodeCC.js.map +1 -1
  271. package/build/esm/cc/UserCredentialCC.d.ts.map +1 -1
  272. package/build/esm/cc/UserCredentialCC.js +4 -1
  273. package/build/esm/cc/UserCredentialCC.js.map +1 -1
  274. package/build/esm/cc/VersionCC.d.ts.map +1 -1
  275. package/build/esm/cc/VersionCC.js +1 -0
  276. package/build/esm/cc/VersionCC.js.map +1 -1
  277. package/build/esm/cc/WakeUpCC.d.ts.map +1 -1
  278. package/build/esm/cc/WakeUpCC.js +1 -0
  279. package/build/esm/cc/WakeUpCC.js.map +1 -1
  280. package/build/esm/cc/WindowCoveringCC.d.ts.map +1 -1
  281. package/build/esm/cc/WindowCoveringCC.js +9 -9
  282. package/build/esm/cc/WindowCoveringCC.js.map +1 -1
  283. package/build/esm/cc/ZWavePlusCC.d.ts.map +1 -1
  284. package/build/esm/cc/ZWavePlusCC.js +1 -0
  285. package/build/esm/cc/ZWavePlusCC.js.map +1 -1
  286. package/build/esm/cc/_CCValues.generated.d.ts +4 -4
  287. package/build/esm/cc/_CCValues.generated.js +2 -2
  288. package/build/esm/cc/_CCValues.generated.js.map +1 -1
  289. package/build/esm/cc/index.d.ts +3 -3
  290. package/build/esm/cc/index.d.ts.map +1 -1
  291. package/build/esm/cc/index.js.map +1 -1
  292. package/build/esm/cc/manufacturerProprietary/Decorators.d.ts +1 -1
  293. package/build/esm/cc/manufacturerProprietary/Decorators.d.ts.map +1 -1
  294. package/build/esm/cc/manufacturerProprietary/Decorators.js.map +1 -1
  295. package/build/esm/cc/manufacturerProprietary/FibaroCC.d.ts.map +1 -1
  296. package/build/esm/cc/manufacturerProprietary/FibaroCC.js +2 -1
  297. package/build/esm/cc/manufacturerProprietary/FibaroCC.js.map +1 -1
  298. package/build/esm/lib/API.js.map +1 -1
  299. package/build/esm/lib/CommandClass.d.ts +5 -1
  300. package/build/esm/lib/CommandClass.d.ts.map +1 -1
  301. package/build/esm/lib/CommandClass.js +30 -4
  302. package/build/esm/lib/CommandClass.js.map +1 -1
  303. package/build/esm/lib/CommandClassDecorators.d.ts +4 -4
  304. package/build/esm/lib/CommandClassDecorators.d.ts.map +1 -1
  305. package/build/esm/lib/CommandClassDecorators.js.map +1 -1
  306. package/build/esm/lib/Security2/Extension.d.ts +6 -4
  307. package/build/esm/lib/Security2/Extension.d.ts.map +1 -1
  308. package/build/esm/lib/Security2/Extension.js +23 -21
  309. package/build/esm/lib/Security2/Extension.js.map +1 -1
  310. package/build/esm/lib/_Types.js +1 -1
  311. package/build/esm/lib/utils.d.ts.map +1 -1
  312. package/build/esm/lib/utils.js +15 -9
  313. package/build/esm/lib/utils.js.map +1 -1
  314. package/package.json +7 -7
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src_gen/cc/manufacturerProprietary/FibaroCC.ts"],
4
- "sourcesContent": ["import * as __validateArgs from \"./FibaroCC._validateArgs.js\";\nconst { validateArgs_FibaroCCAPI_fibaroVenetianBlindsSetPosition, validateArgs_FibaroCCAPI_fibaroVenetianBlindsSetTilt } = __validateArgs;\nimport type { GetDeviceConfig } from \"@zwave-js/config\";\nimport { CommandClasses, type GetValueDB, type MaybeUnknown, type MessageOrCCLogEntry, type MessageRecord, type ValueID, ValueMetadata, type WithAddress, ZWaveError, ZWaveErrorCodes, parseMaybeNumber, validatePayload, } from \"@zwave-js/core\";\nimport { Bytes, pick } from \"@zwave-js/shared\";\nimport { isArray } from \"alcalzone-shared/typeguards\";\nimport { POLL_VALUE, type PollValueImplementation, SET_VALUE, type SetValueImplementation, throwMissingPropertyKey, throwUnsupportedProperty, throwUnsupportedPropertyKey, throwWrongValueType, } from \"../../lib/API.js\";\nimport type { CCRaw, CommandClassOptions, InterviewContext, PersistValuesContext, RefreshValuesContext, RefreshValuesOptions, } from \"../../lib/CommandClass.js\";\nimport { expectedCCResponse } from \"../../lib/CommandClassDecorators.js\";\nimport type { CCEncodingContext, CCParsingContext } from \"../../lib/traits.js\";\nimport { ManufacturerProprietaryCC, ManufacturerProprietaryCCAPI, } from \"../ManufacturerProprietaryCC.js\";\nimport { fibaroCC, fibaroCCCommand, getFibaroCCCommand, getFibaroCCCommandConstructor, getFibaroCCConstructor, getFibaroCCId, manufacturerId, manufacturerProprietaryAPI, } from \"./Decorators.js\";\nexport const MANUFACTURERID_FIBARO = 0x10f;\n/** Returns the ValueID used to store the current venetian blind position */\nexport function getFibaroVenetianBlindPositionValueId(endpoint: number): ValueID {\n return {\n commandClass: CommandClasses[\"Manufacturer Proprietary\"],\n endpoint,\n property: \"fibaro\",\n propertyKey: \"venetianBlindsPosition\",\n };\n}\n/** Returns the value metadata for venetian blind position */\nexport function getFibaroVenetianBlindPositionMetadata(): ValueMetadata {\n return {\n ...ValueMetadata.Level,\n label: \"Venetian blinds position\",\n };\n}\n/** Returns the ValueID used to store the current venetian blind tilt */\nexport function getFibaroVenetianBlindTiltValueId(endpoint: number): ValueID {\n return {\n commandClass: CommandClasses[\"Manufacturer Proprietary\"],\n endpoint,\n property: \"fibaro\",\n propertyKey: \"venetianBlindsTilt\",\n };\n}\n/** Returns the value metadata for venetian blind tilt */\nexport function getFibaroVenetianBlindTiltMetadata(): ValueMetadata {\n return {\n ...ValueMetadata.Level,\n label: \"Venetian blinds tilt\",\n };\n}\nfunction getSupportedFibaroCCIDs(ctx: GetDeviceConfig, nodeId: number): FibaroCCIDs[] {\n const proprietaryConfig = ctx.getDeviceConfig?.(nodeId)?.proprietary;\n if (proprietaryConfig && isArray(proprietaryConfig.fibaroCCs)) {\n return proprietaryConfig.fibaroCCs as FibaroCCIDs[];\n }\n return [];\n}\nexport enum FibaroCCIDs {\n VenetianBlind = 0x26\n}\n@manufacturerProprietaryAPI(MANUFACTURERID_FIBARO)\nexport class FibaroCCAPI extends ManufacturerProprietaryCCAPI {\n // oxlint-disable-next-line typescript/explicit-module-boundary-types\n public async fibaroVenetianBlindsGet() {\n const cc = new FibaroVenetianBlindCCGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<FibaroVenetianBlindCCReport>(cc, this.commandOptions);\n if (response) {\n return pick(response, [\"position\", \"tilt\"]);\n }\n }\n @validateArgs_FibaroCCAPI_fibaroVenetianBlindsSetPosition()\n public async fibaroVenetianBlindsSetPosition(value: number): Promise<void> {\n const cc = new FibaroVenetianBlindCCSet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n position: value,\n });\n await this.host.sendCommand(cc, this.commandOptions);\n }\n @validateArgs_FibaroCCAPI_fibaroVenetianBlindsSetTilt()\n public async fibaroVenetianBlindsSetTilt(value: number): Promise<void> {\n const cc = new FibaroVenetianBlindCCSet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n tilt: value,\n });\n await this.host.sendCommand(cc, this.commandOptions);\n }\n protected override get [SET_VALUE](): SetValueImplementation {\n return async function (this: FibaroCCAPI, { property, propertyKey }, value) {\n if (property !== \"fibaro\") {\n throwUnsupportedProperty(this.ccId, property);\n }\n if (propertyKey === \"venetianBlindsPosition\") {\n if (typeof value !== \"number\") {\n throwWrongValueType(this.ccId, property, \"number\", typeof value);\n }\n await this.fibaroVenetianBlindsSetPosition(value);\n }\n else if (propertyKey === \"venetianBlindsTilt\") {\n if (typeof value !== \"number\") {\n throwWrongValueType(this.ccId, property, \"number\", typeof value);\n }\n await this.fibaroVenetianBlindsSetTilt(value);\n }\n else {\n // unsupported property key, ignore...\n return;\n }\n // Verify the current value after a delay\n this.schedulePoll({ property, propertyKey }, value);\n return undefined;\n };\n }\n protected get [POLL_VALUE](): PollValueImplementation {\n return async function (this: FibaroCCAPI, { property, propertyKey }) {\n if (property !== \"fibaro\") {\n throwUnsupportedProperty(this.ccId, property);\n }\n else if (propertyKey == undefined) {\n throwMissingPropertyKey(this.ccId, property);\n }\n switch (propertyKey) {\n case \"venetianBlindsPosition\":\n return (await this.fibaroVenetianBlindsGet())?.position;\n case \"venetianBlindsTilt\":\n return (await this.fibaroVenetianBlindsGet())?.tilt;\n default:\n throwUnsupportedPropertyKey(this.ccId, property, propertyKey);\n }\n };\n }\n}\n@manufacturerId(MANUFACTURERID_FIBARO)\nexport class FibaroCC extends ManufacturerProprietaryCC {\n public constructor(options: CommandClassOptions) {\n super(options);\n this.fibaroCCId = getFibaroCCId(this);\n this.fibaroCCCommand = getFibaroCCCommand(this);\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): FibaroCC {\n validatePayload(raw.payload.length >= 2);\n const fibaroCCId = raw.payload[0];\n const fibaroCCCommand = raw.payload[1];\n const FibaroConstructor = getFibaroCCCommandConstructor(fibaroCCId, fibaroCCCommand);\n if (FibaroConstructor) {\n return FibaroConstructor.from(raw.withPayload(raw.payload.subarray(2)), ctx);\n }\n return new FibaroCC({\n nodeId: ctx.sourceNodeId,\n });\n }\n public fibaroCCId?: number;\n public fibaroCCCommand?: number;\n public async interview(ctx: InterviewContext): Promise<void> {\n const node = this.getNode(ctx)!;\n // Iterate through all supported Fibaro CCs and interview them\n const supportedFibaroCCIDs = getSupportedFibaroCCIDs(ctx, node.id);\n for (const ccId of supportedFibaroCCIDs) {\n const SubConstructor = getFibaroCCConstructor(ccId);\n if (SubConstructor) {\n const instance = new SubConstructor({ nodeId: node.id });\n await instance.interview(ctx);\n }\n }\n }\n public async refreshValues(ctx: RefreshValuesContext, options?: RefreshValuesOptions): Promise<void> {\n const node = this.getNode(ctx)!;\n // Iterate through all supported Fibaro CCs and let them refresh their values\n const supportedFibaroCCIDs = getSupportedFibaroCCIDs(ctx, node.id);\n for (const ccId of supportedFibaroCCIDs) {\n const SubConstructor = getFibaroCCConstructor(ccId);\n if (SubConstructor) {\n const instance = new SubConstructor({ nodeId: node.id });\n await instance.refreshValues(ctx, options);\n }\n }\n }\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n if (this.fibaroCCId == undefined) {\n throw new ZWaveError(\"Cannot serialize a Fibaro CC without a Fibaro CC ID\", ZWaveErrorCodes.CC_Invalid);\n }\n else if (this.fibaroCCCommand == undefined) {\n throw new ZWaveError(\"Cannot serialize a Fibaro CC without a Fibaro CC Command\", ZWaveErrorCodes.CC_Invalid);\n }\n this.payload = Bytes.concat([\n [this.fibaroCCId, this.fibaroCCCommand],\n this.payload,\n ]);\n return super.serialize(ctx);\n }\n}\nexport enum FibaroVenetianBlindCCCommand {\n Set = 0x01,\n Get = 0x02,\n Report = 0x03\n}\n@fibaroCC(FibaroCCIDs.VenetianBlind)\nexport class FibaroVenetianBlindCC extends FibaroCC {\n declare fibaroCCId: FibaroCCIDs.VenetianBlind;\n declare fibaroCCCommand: FibaroVenetianBlindCCCommand;\n public constructor(options: CommandClassOptions) {\n super(options);\n this.fibaroCCId = FibaroCCIDs.VenetianBlind;\n }\n public async interview(ctx: InterviewContext): Promise<void> {\n const node = this.getNode(ctx)!;\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `Interviewing Fibaro Venetian Blind CC...`,\n direction: \"none\",\n });\n // Nothing special, just get the values\n await this.refreshValues(ctx);\n }\n public async refreshValues(ctx: RefreshValuesContext, options?: RefreshValuesOptions): Promise<void> {\n const node = this.getNode(ctx)!;\n ctx.logNode(node.id, {\n message: \"Requesting venetian blind position and tilt...\",\n direction: \"outbound\",\n });\n const resp = await ctx.sendCommand<FibaroVenetianBlindCCReport>(new FibaroVenetianBlindCCGet({\n nodeId: this.nodeId,\n endpointIndex: this.endpointIndex,\n }), {\n priority: options?.priority,\n });\n if (resp) {\n const logMessage = `received venetian blind state:\nposition: ${resp.position}\ntilt: ${resp.tilt}`;\n ctx.logNode(node.id, {\n message: logMessage,\n direction: \"inbound\",\n });\n }\n }\n}\n// @publicAPI\nexport type FibaroVenetianBlindCCSetOptions = {\n position: number;\n} | {\n tilt: number;\n} | {\n position: number;\n tilt: number;\n};\n@fibaroCCCommand(FibaroVenetianBlindCCCommand.Set)\nexport class FibaroVenetianBlindCCSet extends FibaroVenetianBlindCC {\n public constructor(options: WithAddress<FibaroVenetianBlindCCSetOptions>) {\n super(options);\n this.fibaroCCCommand = FibaroVenetianBlindCCCommand.Set;\n if (\"position\" in options)\n this.position = options.position;\n if (\"tilt\" in options)\n this.tilt = options.tilt;\n }\n public static from(_raw: CCRaw, _ctx: CCParsingContext): FibaroVenetianBlindCCSet {\n // TODO: Deserialize payload\n throw new ZWaveError(`${this.name}: deserialization not implemented`, ZWaveErrorCodes.Deserialization_NotImplemented);\n }\n public position: number | undefined;\n public tilt: number | undefined;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n const controlByte = (this.position != undefined ? 0b10 : 0)\n | (this.tilt != undefined ? 0b01 : 0);\n this.payload = Bytes.from([\n controlByte,\n this.position ?? 0,\n this.tilt ?? 0,\n ]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const message: MessageRecord = {};\n if (this.position != undefined) {\n message.position = this.position;\n }\n if (this.tilt != undefined) {\n message.tilt = this.tilt;\n }\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n}\n// @publicAPI\nexport interface FibaroVenetianBlindCCReportOptions {\n position?: MaybeUnknown<number>;\n tilt?: MaybeUnknown<number>;\n}\n@fibaroCCCommand(FibaroVenetianBlindCCCommand.Report)\nexport class FibaroVenetianBlindCCReport extends FibaroVenetianBlindCC {\n public constructor(options: WithAddress<FibaroVenetianBlindCCReportOptions>) {\n super(options);\n this.fibaroCCCommand = FibaroVenetianBlindCCCommand.Report;\n // TODO: Check implementation:\n this.position = options.position;\n this.tilt = options.tilt;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): FibaroVenetianBlindCCReport {\n validatePayload(raw.payload.length >= 3);\n // When the node sends a report, payload[0] === 0b11. This is probably a\n // bit mask for position and tilt\n let position: MaybeUnknown<number> | undefined;\n if (!!(raw.payload[0] & 0b10)) {\n position = parseMaybeNumber(raw.payload[1]);\n }\n let tilt: MaybeUnknown<number> | undefined;\n if (!!(raw.payload[0] & 0b01)) {\n tilt = parseMaybeNumber(raw.payload[2]);\n }\n return new this({\n nodeId: ctx.sourceNodeId,\n position,\n tilt,\n });\n }\n public persistValues(ctx: PersistValuesContext): boolean {\n if (!super.persistValues(ctx))\n return false;\n const valueDB = this.getValueDB(ctx);\n if (this.position != undefined) {\n const positionValueId = getFibaroVenetianBlindPositionValueId(this.endpointIndex);\n valueDB.setMetadata(positionValueId, {\n ...ValueMetadata.Level,\n label: \"Venetian blinds position\",\n });\n valueDB.setValue(positionValueId, this.position);\n }\n if (this.tilt != undefined) {\n const tiltValueId = getFibaroVenetianBlindTiltValueId(this.endpointIndex);\n valueDB.setMetadata(tiltValueId, {\n ...ValueMetadata.Level,\n label: \"Venetian blinds tilt\",\n });\n valueDB.setValue(tiltValueId, this.tilt);\n }\n return true;\n }\n public position: MaybeUnknown<number> | undefined;\n public tilt: MaybeUnknown<number> | undefined;\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const message: MessageRecord = {};\n if (this.position != undefined) {\n message.position = this.position;\n }\n if (this.tilt != undefined) {\n message.tilt = this.tilt;\n }\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n}\n@fibaroCCCommand(FibaroVenetianBlindCCCommand.Get)\n@expectedCCResponse(FibaroVenetianBlindCCReport)\nexport class FibaroVenetianBlindCCGet extends FibaroVenetianBlindCC {\n // @noLogEntry: This CC has no properties to log\n public constructor(options: CommandClassOptions) {\n super(options);\n this.fibaroCCCommand = FibaroVenetianBlindCCCommand.Get;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): FibaroVenetianBlindCCGet {\n return new this({\n nodeId: ctx.sourceNodeId,\n });\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qBAAgC;AAGhC,kBAAiO;AACjO,oBAA4B;AAC5B,wBAAwB;AACxB,iBAAuM;AAEvM,oCAAmC;AAEnC,uCAAyE;AACzE,wBAAiL;AAVjL,MAAM,EAAE,0DAA0D,qDAAoD,IAAK;AAWpH,MAAM,wBAAwB;AAE/B,SAAU,sCAAsC,UAAgB;AAClE,SAAO;IACH,cAAc,2BAAe,0BAA0B;IACvD;IACA,UAAU;IACV,aAAa;;AAErB;AAPgB;AASV,SAAU,yCAAsC;AAClD,SAAO;IACH,GAAG,0BAAc;IACjB,OAAO;;AAEf;AALgB;AAOV,SAAU,kCAAkC,UAAgB;AAC9D,SAAO;IACH,cAAc,2BAAe,0BAA0B;IACvD;IACA,UAAU;IACV,aAAa;;AAErB;AAPgB;AASV,SAAU,qCAAkC;AAC9C,SAAO;IACH,GAAG,0BAAc;IACjB,OAAO;;AAEf;AALgB;AAMhB,SAAS,wBAAwB,KAAsB,QAAc;AACjE,QAAM,oBAAoB,IAAI,kBAAkB,MAAM,GAAG;AACzD,MAAI,yBAAqB,2BAAQ,kBAAkB,SAAS,GAAG;AAC3D,WAAO,kBAAkB;EAC7B;AACA,SAAO,CAAA;AACX;AANS;AAOT,IAAY;CAAZ,SAAYA,cAAW;AACnB,EAAAA,aAAAA,aAAA,eAAA,IAAA,EAAA,IAAA;A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;AACA,UAAI,KAAK,QAAQ,QAAW;AACxB,gBAAQ,OAAO,KAAK;MACxB;AACA,aAAO;QACH,GAAG,MAAM,WAAW,GAAG;QACvB;;IAER;;;;IAIS,4BAAwB,MAAA;8BAFpC,mCAAgB,6BAA6B,GAAG,OAChD,kDAAmB,2BAA2B,CAAC;;;;oBACF;gDAAA,YAAqB;WAAA;;;;;;;;AAAnE,qCAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,0CAAA,YAAA,uBAAA;;;IAET,YAAmB,SAA4B;AAC3C,YAAM,OAAO;AACb,WAAK,kBAAkB,6BAA6B;IACxD;IACO,OAAO,KAAK,KAAY,KAAqB;AAChD,aAAO,IAAI,KAAK;QACZ,QAAQ,IAAI;OACf;IACL;;;;",
4
+ "sourcesContent": ["import * as __validateArgs from \"./FibaroCC._validateArgs.js\";\nconst { validateArgs_FibaroCCAPI_fibaroVenetianBlindsSetPosition, validateArgs_FibaroCCAPI_fibaroVenetianBlindsSetTilt } = __validateArgs;\nimport type { GetDeviceConfig } from \"@zwave-js/config\";\nimport { CommandClasses, type GetValueDB, type MaybeUnknown, type MessageOrCCLogEntry, type MessageRecord, type ValueID, ValueMetadata, type WithAddress, ZWaveError, ZWaveErrorCodes, parseMaybeNumber, validatePayload, } from \"@zwave-js/core\";\nimport { Bytes, pick } from \"@zwave-js/shared\";\nimport { isArray } from \"alcalzone-shared/typeguards\";\nimport { POLL_VALUE, type PollValueImplementation, SET_VALUE, type SetValueImplementation, throwMissingPropertyKey, throwUnsupportedProperty, throwUnsupportedPropertyKey, throwWrongValueType, } from \"../../lib/API.js\";\nimport type { CCRaw, CommandClassOptions, InterviewContext, PersistValuesContext, RefreshValuesContext, RefreshValuesOptions, } from \"../../lib/CommandClass.js\";\nimport { expectedCCResponse } from \"../../lib/CommandClassDecorators.js\";\nimport type { CCEncodingContext, CCParsingContext } from \"../../lib/traits.js\";\nimport { ManufacturerProprietaryCC, ManufacturerProprietaryCCAPI, } from \"../ManufacturerProprietaryCC.js\";\nimport { fibaroCC, fibaroCCCommand, getFibaroCCCommand, getFibaroCCCommandConstructor, getFibaroCCConstructor, getFibaroCCId, manufacturerId, manufacturerProprietaryAPI, } from \"./Decorators.js\";\nexport const MANUFACTURERID_FIBARO = 0x10f;\n/** Returns the ValueID used to store the current venetian blind position */\nexport function getFibaroVenetianBlindPositionValueId(endpoint: number): ValueID {\n return {\n commandClass: CommandClasses[\"Manufacturer Proprietary\"],\n endpoint,\n property: \"fibaro\",\n propertyKey: \"venetianBlindsPosition\",\n };\n}\n/** Returns the value metadata for venetian blind position */\nexport function getFibaroVenetianBlindPositionMetadata(): ValueMetadata {\n return {\n ...ValueMetadata.Level,\n label: \"Venetian blinds position\",\n };\n}\n/** Returns the ValueID used to store the current venetian blind tilt */\nexport function getFibaroVenetianBlindTiltValueId(endpoint: number): ValueID {\n return {\n commandClass: CommandClasses[\"Manufacturer Proprietary\"],\n endpoint,\n property: \"fibaro\",\n propertyKey: \"venetianBlindsTilt\",\n };\n}\n/** Returns the value metadata for venetian blind tilt */\nexport function getFibaroVenetianBlindTiltMetadata(): ValueMetadata {\n return {\n ...ValueMetadata.Level,\n label: \"Venetian blinds tilt\",\n };\n}\nfunction getSupportedFibaroCCIDs(ctx: GetDeviceConfig, nodeId: number): FibaroCCIDs[] {\n const proprietaryConfig = ctx.getDeviceConfig?.(nodeId)?.proprietary;\n if (proprietaryConfig && isArray(proprietaryConfig.fibaroCCs)) {\n return proprietaryConfig.fibaroCCs as FibaroCCIDs[];\n }\n return [];\n}\nexport enum FibaroCCIDs {\n VenetianBlind = 0x26\n}\n@manufacturerProprietaryAPI(MANUFACTURERID_FIBARO)\nexport class FibaroCCAPI extends ManufacturerProprietaryCCAPI {\n // oxlint-disable-next-line typescript/explicit-module-boundary-types\n public async fibaroVenetianBlindsGet() {\n const cc = new FibaroVenetianBlindCCGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<FibaroVenetianBlindCCReport>(cc, this.commandOptions);\n if (response) {\n return pick(response, [\"position\", \"tilt\"]);\n }\n }\n @validateArgs_FibaroCCAPI_fibaroVenetianBlindsSetPosition()\n public async fibaroVenetianBlindsSetPosition(value: number): Promise<void> {\n const cc = new FibaroVenetianBlindCCSet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n position: value,\n });\n await this.host.sendCommand(cc, this.commandOptions);\n }\n @validateArgs_FibaroCCAPI_fibaroVenetianBlindsSetTilt()\n public async fibaroVenetianBlindsSetTilt(value: number): Promise<void> {\n const cc = new FibaroVenetianBlindCCSet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n tilt: value,\n });\n await this.host.sendCommand(cc, this.commandOptions);\n }\n protected override get [SET_VALUE](): SetValueImplementation {\n return async function (this: FibaroCCAPI, { property, propertyKey }, value) {\n if (property !== \"fibaro\") {\n throwUnsupportedProperty(this.ccId, property);\n }\n if (propertyKey === \"venetianBlindsPosition\") {\n if (typeof value !== \"number\") {\n throwWrongValueType(this.ccId, property, \"number\", typeof value);\n }\n await this.fibaroVenetianBlindsSetPosition(value);\n }\n else if (propertyKey === \"venetianBlindsTilt\") {\n if (typeof value !== \"number\") {\n throwWrongValueType(this.ccId, property, \"number\", typeof value);\n }\n await this.fibaroVenetianBlindsSetTilt(value);\n }\n else {\n // unsupported property key, ignore...\n return;\n }\n // Verify the current value after a delay\n this.schedulePoll({ property, propertyKey }, value);\n return undefined;\n };\n }\n protected get [POLL_VALUE](): PollValueImplementation {\n return async function (this: FibaroCCAPI, { property, propertyKey }) {\n if (property !== \"fibaro\") {\n throwUnsupportedProperty(this.ccId, property);\n }\n else if (propertyKey == undefined) {\n throwMissingPropertyKey(this.ccId, property);\n }\n switch (propertyKey) {\n case \"venetianBlindsPosition\":\n return (await this.fibaroVenetianBlindsGet())?.position;\n case \"venetianBlindsTilt\":\n return (await this.fibaroVenetianBlindsGet())?.tilt;\n default:\n throwUnsupportedPropertyKey(this.ccId, property, propertyKey);\n }\n };\n }\n}\n@manufacturerId(MANUFACTURERID_FIBARO)\nexport class FibaroCC extends ManufacturerProprietaryCC {\n public constructor(options: CommandClassOptions) {\n super(options);\n this.fibaroCCId = getFibaroCCId(this);\n this.fibaroCCCommand = getFibaroCCCommand(this);\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): FibaroCC {\n validatePayload(raw.payload.length >= 2);\n const fibaroCCId = raw.payload[0];\n const fibaroCCCommand = raw.payload[1];\n const FibaroConstructor = getFibaroCCCommandConstructor(fibaroCCId, fibaroCCCommand);\n if (FibaroConstructor) {\n return FibaroConstructor.from(raw.withPayload(raw.payload.subarray(2)), ctx);\n }\n return new FibaroCC({\n nodeId: ctx.sourceNodeId,\n });\n }\n public fibaroCCId?: number;\n public fibaroCCCommand?: number;\n public async interview(ctx: InterviewContext): Promise<void> {\n const node = this.getNode(ctx)!;\n // Iterate through all supported Fibaro CCs and interview them\n const supportedFibaroCCIDs = getSupportedFibaroCCIDs(ctx, node.id);\n for (const ccId of supportedFibaroCCIDs) {\n const SubConstructor = getFibaroCCConstructor(ccId);\n if (SubConstructor) {\n const instance = new SubConstructor({ nodeId: node.id });\n await instance.interview(ctx);\n }\n }\n }\n public async refreshValues(ctx: RefreshValuesContext, options?: RefreshValuesOptions): Promise<void> {\n const node = this.getNode(ctx)!;\n // Iterate through all supported Fibaro CCs and let them refresh their values\n const supportedFibaroCCIDs = getSupportedFibaroCCIDs(ctx, node.id);\n for (const ccId of supportedFibaroCCIDs) {\n const SubConstructor = getFibaroCCConstructor(ccId);\n if (SubConstructor) {\n const instance = new SubConstructor({ nodeId: node.id });\n await instance.refreshValues(ctx, options);\n }\n }\n }\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n if (this.fibaroCCId == undefined) {\n throw new ZWaveError(\"Cannot serialize a Fibaro CC without a Fibaro CC ID\", ZWaveErrorCodes.CC_Invalid);\n }\n else if (this.fibaroCCCommand == undefined) {\n throw new ZWaveError(\"Cannot serialize a Fibaro CC without a Fibaro CC Command\", ZWaveErrorCodes.CC_Invalid);\n }\n this.payload = Bytes.concat([\n [this.fibaroCCId, this.fibaroCCCommand],\n this.payload,\n ]);\n return super.serialize(ctx);\n }\n}\nexport enum FibaroVenetianBlindCCCommand {\n Set = 0x01,\n Get = 0x02,\n Report = 0x03\n}\n@fibaroCC(FibaroCCIDs.VenetianBlind)\nexport class FibaroVenetianBlindCC extends FibaroCC {\n declare fibaroCCId: FibaroCCIDs.VenetianBlind;\n declare fibaroCCCommand: FibaroVenetianBlindCCCommand;\n public constructor(options: CommandClassOptions) {\n super(options);\n this.fibaroCCId = FibaroCCIDs.VenetianBlind;\n }\n public async interview(ctx: InterviewContext): Promise<void> {\n const node = this.getNode(ctx)!;\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `Interviewing Fibaro Venetian Blind CC...`,\n direction: \"none\",\n });\n // Nothing special, just get the values\n await this.refreshValues(ctx, { tag: \"interview\" });\n }\n public async refreshValues(ctx: RefreshValuesContext, options?: RefreshValuesOptions): Promise<void> {\n const node = this.getNode(ctx)!;\n ctx.logNode(node.id, {\n message: \"Requesting venetian blind position and tilt...\",\n direction: \"outbound\",\n });\n const resp = await ctx.sendCommand<FibaroVenetianBlindCCReport>(new FibaroVenetianBlindCCGet({\n nodeId: this.nodeId,\n endpointIndex: this.endpointIndex,\n }), {\n priority: options?.priority,\n tag: options?.tag,\n });\n if (resp) {\n const logMessage = `received venetian blind state:\nposition: ${resp.position}\ntilt: ${resp.tilt}`;\n ctx.logNode(node.id, {\n message: logMessage,\n direction: \"inbound\",\n });\n }\n }\n}\n// @publicAPI\nexport type FibaroVenetianBlindCCSetOptions = {\n position: number;\n} | {\n tilt: number;\n} | {\n position: number;\n tilt: number;\n};\n@fibaroCCCommand(FibaroVenetianBlindCCCommand.Set)\nexport class FibaroVenetianBlindCCSet extends FibaroVenetianBlindCC {\n public constructor(options: WithAddress<FibaroVenetianBlindCCSetOptions>) {\n super(options);\n this.fibaroCCCommand = FibaroVenetianBlindCCCommand.Set;\n if (\"position\" in options)\n this.position = options.position;\n if (\"tilt\" in options)\n this.tilt = options.tilt;\n }\n public static from(_raw: CCRaw, _ctx: CCParsingContext): FibaroVenetianBlindCCSet {\n // TODO: Deserialize payload\n throw new ZWaveError(`${this.name}: deserialization not implemented`, ZWaveErrorCodes.Deserialization_NotImplemented);\n }\n public position: number | undefined;\n public tilt: number | undefined;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n const controlByte = (this.position != undefined ? 0b10 : 0)\n | (this.tilt != undefined ? 0b01 : 0);\n this.payload = Bytes.from([\n controlByte,\n this.position ?? 0,\n this.tilt ?? 0,\n ]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const message: MessageRecord = {};\n if (this.position != undefined) {\n message.position = this.position;\n }\n if (this.tilt != undefined) {\n message.tilt = this.tilt;\n }\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n}\n// @publicAPI\nexport interface FibaroVenetianBlindCCReportOptions {\n position?: MaybeUnknown<number>;\n tilt?: MaybeUnknown<number>;\n}\n@fibaroCCCommand(FibaroVenetianBlindCCCommand.Report)\nexport class FibaroVenetianBlindCCReport extends FibaroVenetianBlindCC {\n public constructor(options: WithAddress<FibaroVenetianBlindCCReportOptions>) {\n super(options);\n this.fibaroCCCommand = FibaroVenetianBlindCCCommand.Report;\n // TODO: Check implementation:\n this.position = options.position;\n this.tilt = options.tilt;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): FibaroVenetianBlindCCReport {\n validatePayload(raw.payload.length >= 3);\n // When the node sends a report, payload[0] === 0b11. This is probably a\n // bit mask for position and tilt\n let position: MaybeUnknown<number> | undefined;\n if (!!(raw.payload[0] & 0b10)) {\n position = parseMaybeNumber(raw.payload[1]);\n }\n let tilt: MaybeUnknown<number> | undefined;\n if (!!(raw.payload[0] & 0b01)) {\n tilt = parseMaybeNumber(raw.payload[2]);\n }\n return new this({\n nodeId: ctx.sourceNodeId,\n position,\n tilt,\n });\n }\n public persistValues(ctx: PersistValuesContext): boolean {\n if (!super.persistValues(ctx))\n return false;\n const valueDB = this.getValueDB(ctx);\n if (this.position != undefined) {\n const positionValueId = getFibaroVenetianBlindPositionValueId(this.endpointIndex);\n valueDB.setMetadata(positionValueId, {\n ...ValueMetadata.Level,\n label: \"Venetian blinds position\",\n });\n valueDB.setValue(positionValueId, this.position);\n }\n if (this.tilt != undefined) {\n const tiltValueId = getFibaroVenetianBlindTiltValueId(this.endpointIndex);\n valueDB.setMetadata(tiltValueId, {\n ...ValueMetadata.Level,\n label: \"Venetian blinds tilt\",\n });\n valueDB.setValue(tiltValueId, this.tilt);\n }\n return true;\n }\n public position: MaybeUnknown<number> | undefined;\n public tilt: MaybeUnknown<number> | undefined;\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const message: MessageRecord = {};\n if (this.position != undefined) {\n message.position = this.position;\n }\n if (this.tilt != undefined) {\n message.tilt = this.tilt;\n }\n return {\n ...super.toLogEntry(ctx),\n message,\n };\n }\n}\n@fibaroCCCommand(FibaroVenetianBlindCCCommand.Get)\n@expectedCCResponse(FibaroVenetianBlindCCReport)\nexport class FibaroVenetianBlindCCGet extends FibaroVenetianBlindCC {\n // @noLogEntry: This CC has no properties to log\n public constructor(options: CommandClassOptions) {\n super(options);\n this.fibaroCCCommand = FibaroVenetianBlindCCCommand.Get;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): FibaroVenetianBlindCCGet {\n return new this({\n nodeId: ctx.sourceNodeId,\n });\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qBAAgC;AAGhC,kBAAiO;AACjO,oBAA4B;AAC5B,wBAAwB;AACxB,iBAAuM;AAEvM,oCAAmC;AAEnC,uCAAyE;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,OAAO,KAAK,KAAY,KAAqB;AAChD,aAAO,IAAI,KAAK;QACZ,QAAQ,IAAI;OACf;IACL;;;;",
6
6
  "names": ["FibaroCCIDs", "fibaroCCCommand", "FibaroCC", "FibaroVenetianBlindCCCommand"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src_gen/lib/API.ts"],
4
- "sourcesContent": ["import type { CompatOverrideQueries, GetDeviceConfig } from \"@zwave-js/config\";\nimport {\n\tCommandClasses,\n\ttype ControlsCC,\n\ttype Duration,\n\ttype EndpointId,\n\ttype GetEndpoint,\n\ttype GetNode,\n\ttype GetSafeCCVersion,\n\ttype GetSupportedCCVersion,\n\ttype GetValueDB,\n\ttype HostIDs,\n\ttype ListenBehavior,\n\ttype LogNode,\n\ttype MaybeNotKnown,\n\tNODE_ID_BROADCAST,\n\tNODE_ID_BROADCAST_LR,\n\tNOT_KNOWN,\n\ttype NodeId,\n\ttype PhysicalNodes,\n\ttype QueryNodeInterviewStage,\n\ttype QueryNodeStatus,\n\ttype SecurityManagers,\n\ttype SendCommandOptions,\n\ttype SupervisionResult,\n\ttype SupportsCC,\n\ttype TXReport,\n\ttype ValueChangeOptions,\n\ttype ValueDB,\n\ttype ValueID,\n\ttype VirtualEndpointId,\n\tZWaveError,\n\tZWaveErrorCodes,\n\tgetCCName,\n\tstripUndefined,\n} from \"@zwave-js/core\";\nimport {\n\ttype AllOrNone,\n\ttype OnlyMethods,\n\tgetEnumMemberName,\n\tgetErrorMessage,\n\tnum2hex,\n} from \"@zwave-js/shared\";\nimport { isArray } from \"alcalzone-shared/typeguards\";\nimport {\n\tgetAPI,\n\tgetCCValues,\n\tgetCommandClass,\n\tgetImplementedVersion,\n} from \"./CommandClassDecorators.js\";\nimport type { CCValue, StaticCCValue } from \"./Values.js\";\nimport type { SendCommand } from \"./traits.js\";\nimport type {\n\tGetRefreshValueTimeouts,\n\tGetUserPreferences,\n\tSchedulePoll,\n} from \"./traits.js\";\n\n// Import and re-export generated types\nimport type { CCAPIs, CCNameMap } from \"./_CCAPI.generated.js\";\nexport type { CCAPIs, CCNameMap };\n\nexport type ValueIDProperties = Pick<ValueID, \"property\" | \"propertyKey\">;\n\n/** Used to identify the method on the CC API class that handles setting values on nodes directly */\nexport const SET_VALUE: unique symbol = Symbol.for(\"CCAPI_SET_VALUE\");\n\nexport type SetValueImplementation = (\n\tproperty: ValueIDProperties,\n\tvalue: unknown,\n\toptions?: SetValueAPIOptions,\n) => Promise<SupervisionResult | undefined>;\n\nexport const SET_VALUE_HOOKS: unique symbol = Symbol.for(\n\t\"CCAPI_SET_VALUE_HOOKS\",\n);\n\nexport type SetValueImplementationHooks =\n\t& AllOrNone<{\n\t\t// Opt-in to and handle delayed supervision updates\n\t\tsupervisionDelayedUpdates: boolean;\n\t\tsupervisionOnSuccess: () => void | Promise<void>;\n\t\tsupervisionOnFailure: () => void | Promise<void>;\n\t}>\n\t& {\n\t\t// Whether the value is a target value for a CC using split\n\t\t// target/current values. If so, the value will be updated optimistically,\n\t\t// even if the device class does not support optimistic updates.\n\t\tisSplitStateTargetValue?: boolean;\n\t\t// Optimistically update related cached values (if allowed)\n\t\toptimisticallyUpdateRelatedValues?: (\n\t\t\tsupervisedAndSuccessful: boolean,\n\t\t) => void;\n\t\t// Check if a verification of the set value is required, even if the API response suggests otherwise\n\t\tforceVerifyChanges?: () => boolean;\n\t\t// Verify the changes\n\t\tverifyChanges?: (result?: SupervisionResult) => void | Promise<void>;\n\t};\n\nexport type SetValueImplementationHooksFactory = (\n\tproperty: ValueIDProperties,\n\tvalue: unknown,\n\toptions?: SetValueAPIOptions,\n) => SetValueImplementationHooks | undefined;\n\n/**\n * A generic options bag for the `setValue` API.\n * Each implementation will choose the options that are relevant for it, so you can use the same options everywhere.\n * @publicAPI\n */\nexport type SetValueAPIOptions =\n\t& Partial<ValueChangeOptions>\n\t& Pick<SendCommandOptions, \"onProgress\">;\n\n/** Used to identify the method on the CC API class that handles polling values from nodes */\nexport const POLL_VALUE: unique symbol = Symbol.for(\"CCAPI_POLL_VALUE\");\nexport type PollValueImplementation<T = unknown> = (\n\tproperty: ValueIDProperties,\n) => Promise<T | undefined>;\n\n// Since the setValue API is called from a point with very generic parameters,\n// we must do narrowing inside the API calls. These three methods are for convenience\nexport function throwUnsupportedProperty(\n\tcc: CommandClasses,\n\tproperty: string | number,\n): never {\n\tthrow new ZWaveError(\n\t\t`${CommandClasses[cc]}: \"${property}\" is not a supported property`,\n\t\tZWaveErrorCodes.Argument_Invalid,\n\t);\n}\n\nexport function throwUnsupportedPropertyKey(\n\tcc: CommandClasses,\n\tproperty: string | number,\n\tpropertyKey: string | number,\n): never {\n\tthrow new ZWaveError(\n\t\t`${\n\t\t\tCommandClasses[cc]\n\t\t}: \"${propertyKey}\" is not a supported property key for property \"${property}\"`,\n\t\tZWaveErrorCodes.Argument_Invalid,\n\t);\n}\n\nexport function throwMissingPropertyKey(\n\tcc: CommandClasses,\n\tproperty: string | number,\n): never {\n\tthrow new ZWaveError(\n\t\t`${\n\t\t\tCommandClasses[cc]\n\t\t}: property \"${property}\" requires a property key, but none was given`,\n\t\tZWaveErrorCodes.Argument_Invalid,\n\t);\n}\n\nexport function throwWrongValueType(\n\tcc: CommandClasses,\n\tproperty: string | number,\n\texpectedType: string,\n\treceivedType: string,\n): never {\n\tthrow new ZWaveError(\n\t\t`${\n\t\t\tCommandClasses[cc]\n\t\t}: \"${property}\" must be of type \"${expectedType}\", received \"${receivedType}\"`,\n\t\tZWaveErrorCodes.Argument_Invalid,\n\t);\n}\n\nexport interface CCAPISchedulePollOptions {\n\tduration?: Duration;\n\ttransition?: \"fast\" | \"slow\";\n}\n\n// Defines the necessary traits the host passed to a CC API must have\nexport type CCAPIHost<TNode extends CCAPINode = CCAPINode> =\n\t& HostIDs\n\t& GetNode<TNode>\n\t& GetValueDB\n\t& GetSupportedCCVersion\n\t& GetSafeCCVersion\n\t& SecurityManagers\n\t& GetDeviceConfig\n\t& SendCommand\n\t& GetRefreshValueTimeouts\n\t& GetUserPreferences\n\t& SchedulePoll\n\t& LogNode;\n\n// Defines the necessary traits a node passed to a CC API must have\nexport type CCAPINode =\n\t& NodeId\n\t& ListenBehavior\n\t& QueryNodeStatus\n\t& QueryNodeInterviewStage;\n\n// Defines the necessary traits an endpoint passed to a CC API must have\nexport type CCAPIEndpoint =\n\t& (\n\t\t| (\n\t\t\t// Physical endpoints must let us query their controlled CCs\n\t\t\tEndpointId & ControlsCC\n\t\t)\n\t\t| (\n\t\t\t// Virtual endpoints must let us query their physical nodes,\n\t\t\t// the CCs those nodes implement, and access the endpoints of those\n\t\t\t// physical nodes\n\t\t\tVirtualEndpointId & {\n\t\t\t\tnode: PhysicalNodes<\n\t\t\t\t\t& NodeId\n\t\t\t\t\t& SupportsCC\n\t\t\t\t\t& ControlsCC\n\t\t\t\t\t& GetEndpoint<EndpointId & SupportsCC & ControlsCC>\n\t\t\t\t>;\n\t\t\t}\n\t\t)\n\t)\n\t& SupportsCC;\n\nexport type PhysicalCCAPIEndpoint = CCAPIEndpoint & EndpointId;\nexport type VirtualCCAPIEndpoint = CCAPIEndpoint & VirtualEndpointId;\n\n/**\n * The base class for all CC APIs exposed via `Node.commandClasses.<CCName>`\n * @publicAPI\n */\nexport class CCAPI {\n\tpublic constructor(\n\t\tprotected readonly host: CCAPIHost,\n\t\tprotected readonly endpoint: CCAPIEndpoint,\n\t) {\n\t\tthis.ccId = getCommandClass(this);\n\t}\n\n\tpublic static create<T extends CommandClasses>(\n\t\tccId: T,\n\t\thost: CCAPIHost,\n\t\tendpoint: CCAPIEndpoint,\n\t\trequireSupport?: boolean,\n\t): CommandClasses extends T ? CCAPI : CCToAPI<T> {\n\t\tconst APIConstructor = getAPI(ccId);\n\t\tconst ccName = CommandClasses[ccId];\n\t\tif (APIConstructor == undefined) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t`Command Class ${ccName} (${\n\t\t\t\t\tnum2hex(\n\t\t\t\t\t\tccId,\n\t\t\t\t\t)\n\t\t\t\t}) has no associated API!`,\n\t\t\t\tZWaveErrorCodes.CC_NoAPI,\n\t\t\t);\n\t\t}\n\t\tconst apiInstance = new APIConstructor(host, endpoint);\n\n\t\t// Only require support for physical endpoints by default\n\t\trequireSupport ??= !endpoint.virtual;\n\n\t\tif (requireSupport) {\n\t\t\t// @ts-expect-error TS doesn't like assigning to conditional types\n\t\t\treturn new Proxy(apiInstance, {\n\t\t\t\tget: (target, property) => {\n\t\t\t\t\t// Forbid access to the API if it is not supported by the node\n\t\t\t\t\tif (\n\t\t\t\t\t\tproperty !== \"ccId\"\n\t\t\t\t\t\t&& property !== \"endpoint\"\n\t\t\t\t\t\t&& property !== \"isSupported\"\n\t\t\t\t\t\t&& property !== \"withOptions\"\n\t\t\t\t\t\t&& property !== \"commandOptions\"\n\t\t\t\t\t\t&& !target.isSupported()\n\t\t\t\t\t) {\n\t\t\t\t\t\tlet messageStart: string;\n\t\t\t\t\t\tif (endpoint.virtual) {\n\t\t\t\t\t\t\tconst hasNodeId =\n\t\t\t\t\t\t\t\ttypeof endpoint.nodeId === \"number\"\n\t\t\t\t\t\t\t\t&& endpoint.nodeId !== NODE_ID_BROADCAST\n\t\t\t\t\t\t\t\t&& endpoint.nodeId !== NODE_ID_BROADCAST_LR;\n\t\t\t\t\t\t\tmessageStart = `${\n\t\t\t\t\t\t\t\thasNodeId ? \"The\" : \"This\"\n\t\t\t\t\t\t\t} virtual node${\n\t\t\t\t\t\t\t\thasNodeId ? ` ${endpoint.nodeId}` : \"\"\n\t\t\t\t\t\t\t}`;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tmessageStart = `Node ${endpoint.nodeId}`;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthrow new ZWaveError(\n\t\t\t\t\t\t\t`${messageStart}${\n\t\t\t\t\t\t\t\tendpoint.index === 0\n\t\t\t\t\t\t\t\t\t? \"\"\n\t\t\t\t\t\t\t\t\t: ` (endpoint ${endpoint.index})`\n\t\t\t\t\t\t\t} does not support the Command Class ${ccName}!`,\n\t\t\t\t\t\t\tZWaveErrorCodes.CC_NotSupported,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\t// If a device config defines overrides for an API call, return a wrapper method that applies them first before calling the actual method\n\t\t\t\t\tconst fallback = target[property as keyof CCAPI];\n\t\t\t\t\tif (\n\t\t\t\t\t\ttypeof property === \"string\"\n\t\t\t\t\t\t&& !endpoint.virtual\n\t\t\t\t\t\t&& typeof fallback === \"function\"\n\t\t\t\t\t) {\n\t\t\t\t\t\tconst overrides = host.getDeviceConfig?.(\n\t\t\t\t\t\t\tendpoint.nodeId,\n\t\t\t\t\t\t)?.compat?.overrideQueries;\n\t\t\t\t\t\tif (overrides?.hasOverride(ccId)) {\n\t\t\t\t\t\t\treturn overrideQueriesWrapper(\n\t\t\t\t\t\t\t\thost,\n\t\t\t\t\t\t\t\tendpoint,\n\t\t\t\t\t\t\t\tccId,\n\t\t\t\t\t\t\t\tproperty,\n\t\t\t\t\t\t\t\toverrides,\n\t\t\t\t\t\t\t\tfallback,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Else just access the property\n\t\t\t\t\treturn fallback;\n\t\t\t\t},\n\t\t\t});\n\t\t} else {\n\t\t\t// @ts-expect-error TS doesn't like assigning to conditional types\n\t\t\treturn apiInstance;\n\t\t}\n\t}\n\n\t/**\n\t * The identifier of the Command Class this API is for\n\t */\n\tpublic readonly ccId: CommandClasses;\n\n\tprotected get [SET_VALUE](): SetValueImplementation | undefined {\n\t\treturn undefined;\n\t}\n\n\t/**\n\t * Can be used on supported CC APIs to set a CC value by property name (and optionally the property key).\n\t * **WARNING:** This function is NOT bound to an API instance. It must be called with the correct `this` context!\n\t */\n\tpublic get setValue(): SetValueImplementation | undefined {\n\t\treturn this[SET_VALUE];\n\t}\n\n\tprotected [SET_VALUE_HOOKS]: SetValueImplementationHooksFactory | undefined;\n\t/**\n\t * Can be implemented by CC APIs to influence the behavior of the setValue API in regards to Supervision and verifying values.\n\t */\n\tpublic get setValueHooks(): SetValueImplementationHooksFactory | undefined {\n\t\treturn this[SET_VALUE_HOOKS];\n\t}\n\n\t/** Whether a successful setValue call should imply that the value was successfully updated */\n\t// oxlint-disable-next-line no-unused-vars\n\tpublic isSetValueOptimistic(valueId: ValueID): boolean {\n\t\treturn true;\n\t}\n\n\tprotected get [POLL_VALUE](): PollValueImplementation | undefined {\n\t\treturn undefined;\n\t}\n\t/**\n\t * Can be used on supported CC APIs to poll a CC value by property name (and optionally the property key)\n\t * **WARNING:** This function is NOT bound to an API instance. It must be called with the correct `this` context!\n\t */\n\tpublic get pollValue(): PollValueImplementation | undefined {\n\t\treturn this[POLL_VALUE];\n\t}\n\n\t/**\n\t * Schedules a value to be polled after a given time. Schedules are deduplicated on a per-property basis.\n\t * @returns `true` if the poll was scheduled, `false` otherwise\n\t */\n\tprotected schedulePoll(\n\t\t{ property, propertyKey }: ValueIDProperties,\n\t\texpectedValue: unknown,\n\t\t{ duration, transition = \"slow\" }: CCAPISchedulePollOptions = {},\n\t): boolean {\n\t\t// Figure out the delay. If a non-zero duration was given or this is a \"fast\" transition,\n\t\t// use/add the short delay. Otherwise, default to the long delay.\n\t\tconst durationMs = duration?.toMilliseconds() ?? 0;\n\t\tconst timeouts = this.host.getRefreshValueTimeouts();\n\t\tconst additionalDelay = !!durationMs || transition === \"fast\"\n\t\t\t? timeouts.refreshValueAfterTransition\n\t\t\t: timeouts.refreshValue;\n\t\tconst timeoutMs = durationMs + additionalDelay;\n\n\t\tif (this.isSinglecast()) {\n\t\t\tconst node = this.host.getNode(this.endpoint.nodeId);\n\t\t\tif (!node) return false;\n\n\t\t\treturn this.host.schedulePoll(\n\t\t\t\tnode.id,\n\t\t\t\t{\n\t\t\t\t\tcommandClass: this.ccId,\n\t\t\t\t\tendpoint: this.endpoint.index,\n\t\t\t\t\tproperty,\n\t\t\t\t\tpropertyKey,\n\t\t\t\t},\n\t\t\t\t{ timeoutMs, expectedValue },\n\t\t\t);\n\t\t} else if (this.isMulticast()) {\n\t\t\t// Only poll supporting nodes in multicast\n\t\t\tconst supportingNodes = this.endpoint.node.physicalNodes.filter(\n\t\t\t\t(node) =>\n\t\t\t\t\tnode\n\t\t\t\t\t\t.getEndpoint(this.endpoint.index)\n\t\t\t\t\t\t?.supportsCC(this.ccId),\n\t\t\t);\n\t\t\tlet ret = false;\n\t\t\tfor (const node of supportingNodes) {\n\t\t\t\tret ||= this.host.schedulePoll(\n\t\t\t\t\tnode.id,\n\t\t\t\t\t{\n\t\t\t\t\t\tcommandClass: this.ccId,\n\t\t\t\t\t\tendpoint: this.endpoint.index,\n\t\t\t\t\t\tproperty,\n\t\t\t\t\t\tpropertyKey,\n\t\t\t\t\t},\n\t\t\t\t\t{ timeoutMs, expectedValue },\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn ret;\n\t\t} else {\n\t\t\t// Don't poll the broadcast node\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t/**\n\t * Retrieves the version of the given CommandClass this endpoint implements\n\t */\n\tpublic get version(): number {\n\t\tif (this.isSinglecast()) {\n\t\t\treturn this.host.getSafeCCVersion(\n\t\t\t\tthis.ccId,\n\t\t\t\tthis.endpoint.nodeId,\n\t\t\t\tthis.endpoint.index,\n\t\t\t) ?? 0;\n\t\t} else {\n\t\t\treturn getImplementedVersion(this.ccId);\n\t\t}\n\t}\n\n\t/** Determines if this simplified API instance may be used. */\n\tpublic isSupported(): boolean {\n\t\treturn (\n\t\t\t// NoOperation is always supported\n\t\t\tthis.ccId === CommandClasses[\"No Operation\"]\n\t\t\t// Basic should always be supported. Since we are trying to hide it from library consumers\n\t\t\t// we cannot trust supportsCC to test it\n\t\t\t|| this.ccId === CommandClasses.Basic\n\t\t\t|| this.endpoint.supportsCC(this.ccId)\n\t\t);\n\t}\n\n\t/**\n\t * Determine whether the linked node supports a specific command of this command class.\n\t * {@link NOT_KNOWN} (`undefined`) means that the information has not been received yet\n\t */\n\t// oxlint-disable-next-line no-unused-vars\n\tpublic supportsCommand(command: number): MaybeNotKnown<boolean> {\n\t\t// This needs to be overwritten per command class. In the default implementation, we don't know anything!\n\t\treturn NOT_KNOWN;\n\t}\n\n\tprotected assertSupportsCommand(\n\t\tcommandEnum: unknown,\n\t\tcommand: number,\n\t): void {\n\t\tif (this.supportsCommand(command) !== true) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t`${\n\t\t\t\t\tthis.isSinglecast()\n\t\t\t\t\t\t? `Node #${this.endpoint.nodeId}`\n\t\t\t\t\t\t: \"This virtual node\"\n\t\t\t\t}${\n\t\t\t\t\tthis.endpoint.index > 0\n\t\t\t\t\t\t? ` (Endpoint ${this.endpoint.index})`\n\t\t\t\t\t\t: \"\"\n\t\t\t\t} does not support the command ${\n\t\t\t\t\tgetEnumMemberName(\n\t\t\t\t\t\tcommandEnum,\n\t\t\t\t\t\tcommand,\n\t\t\t\t\t)\n\t\t\t\t}!`,\n\t\t\t\tZWaveErrorCodes.CC_NotSupported,\n\t\t\t);\n\t\t}\n\t}\n\n\tprotected assertPhysicalEndpoint(\n\t\tendpoint: EndpointId | VirtualEndpointId,\n\t): asserts endpoint is EndpointId {\n\t\tif (endpoint.virtual) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t`This method is not supported for virtual nodes!`,\n\t\t\t\tZWaveErrorCodes.CC_NotSupported,\n\t\t\t);\n\t\t}\n\t}\n\n\t/** Returns the command options to use for sendCommand calls */\n\tprotected get commandOptions(): SendCommandOptions {\n\t\t// No default options\n\t\treturn {};\n\t}\n\n\t/** Creates an instance of this API, scoped to use the given options */\n\tpublic withOptions(options: SendCommandOptions): this {\n\t\tconst mergedOptions = {\n\t\t\t...this.commandOptions,\n\t\t\t...options,\n\t\t};\n\t\treturn new Proxy(this, {\n\t\t\tget: (target, property) => {\n\t\t\t\tif (property === \"commandOptions\") {\n\t\t\t\t\treturn mergedOptions;\n\t\t\t\t} else {\n\t\t\t\t\treturn (target as any)[property];\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\t}\n\n\t/** Creates an instance of this API which (if supported) will return TX reports along with the result. */\n\tpublic withTXReport<T extends this>(): WithTXReport<T> {\n\t\tif (this.constructor === CCAPI) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t\"The withTXReport method may only be called on specific CC API implementations.\",\n\t\t\t\tZWaveErrorCodes.Driver_NotSupported,\n\t\t\t);\n\t\t}\n\n\t\t// Remember which properties need to be proxied\n\t\tconst proxiedProps = new Set([\n\t\t\t// These are the CC-specific methods\n\t\t\t...Object.getOwnPropertyNames(this.constructor.prototype),\n\t\t\t// as well as setValue and pollValue\n\t\t\t\"setValue\",\n\t\t\t\"pollValue\",\n\t\t]);\n\t\tproxiedProps.delete(\"constructor\");\n\n\t\tfunction wrapResult<T>(result: T, txReport: TXReport): any {\n\t\t\t// Both the result and the TX report may be undefined (no response, no support)\n\t\t\treturn stripUndefined({\n\t\t\t\tresult,\n\t\t\t\ttxReport,\n\t\t\t});\n\t\t}\n\n\t\treturn new Proxy(this, {\n\t\t\tget: (target, prop) => {\n\t\t\t\tif (prop === \"withTXReport\") return undefined;\n\n\t\t\t\tlet original: any = (target as any)[prop];\n\t\t\t\tif (\n\t\t\t\t\tproxiedProps.has(prop as string)\n\t\t\t\t\t&& typeof original === \"function\"\n\t\t\t\t) {\n\t\t\t\t\t// This is a method that only exists in the specific implementation\n\n\t\t\t\t\t// Wrap each call with its own API proxy, so we don't mix up TX reports\n\t\t\t\t\tlet txReport: TXReport;\n\t\t\t\t\tconst api = target.withOptions({\n\t\t\t\t\t\tonTXReport: (report) => {\n\t\t\t\t\t\t\t// Remember the last status report\n\t\t\t\t\t\t\ttxReport = report;\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t\toriginal = (api as any)[prop].bind(api);\n\n\t\t\t\t\t// Return a wrapper function that will add the status report after the call is complete\n\t\t\t\t\treturn (...args: any) => {\n\t\t\t\t\t\tlet result = original(...args);\n\t\t\t\t\t\tif (result instanceof Promise) {\n\t\t\t\t\t\t\tresult = result.then((res) =>\n\t\t\t\t\t\t\t\twrapResult(res, txReport)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tresult = wrapResult(result, txReport);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn result;\n\t\t\t\t\t};\n\t\t\t\t} else {\n\t\t\t\t\treturn original;\n\t\t\t\t}\n\t\t\t},\n\t\t}) as any;\n\t}\n\n\tprotected isSinglecast(): this is this & {\n\t\tendpoint: PhysicalCCAPIEndpoint;\n\t} {\n\t\treturn (\n\t\t\t!this.endpoint.virtual\n\t\t\t&& typeof this.endpoint.nodeId === \"number\"\n\t\t\t&& this.endpoint.nodeId !== NODE_ID_BROADCAST\n\t\t\t&& this.endpoint.nodeId !== NODE_ID_BROADCAST_LR\n\t\t);\n\t}\n\n\tprotected isMulticast(): this is this & {\n\t\tendpoint: VirtualCCAPIEndpoint & {\n\t\t\tnodeId: number[];\n\t\t};\n\t} {\n\t\treturn this.endpoint.virtual && isArray(this.endpoint.nodeId);\n\t}\n\n\tprotected isBroadcast(): this is this & {\n\t\tendpoint: VirtualCCAPIEndpoint & {\n\t\t\tnodeId: typeof NODE_ID_BROADCAST | typeof NODE_ID_BROADCAST_LR;\n\t\t};\n\t} {\n\t\treturn (\n\t\t\tthis.endpoint.virtual\n\t\t\t&& (this.endpoint.nodeId === NODE_ID_BROADCAST\n\t\t\t\t|| this.endpoint.nodeId === NODE_ID_BROADCAST_LR)\n\t\t);\n\t}\n\n\t/** Returns the value DB for this CC API's node (if it can be safely accessed) */\n\tprotected tryGetValueDB(): ValueDB | undefined {\n\t\tif (!this.isSinglecast()) return;\n\t\ttry {\n\t\t\treturn this.host.getValueDB(this.endpoint.nodeId);\n\t\t} catch {\n\t\t\treturn;\n\t\t}\n\t}\n\n\t/** Returns the value DB for this CC's node (or throws if it cannot be accessed) */\n\tprotected getValueDB(): ValueDB {\n\t\tif (this.isSinglecast()) {\n\t\t\ttry {\n\t\t\t\treturn this.host.getValueDB(this.endpoint.nodeId);\n\t\t\t} catch {\n\t\t\t\tthrow new ZWaveError(\n\t\t\t\t\t\"The node for this CC does not exist or the driver is not ready yet\",\n\t\t\t\t\tZWaveErrorCodes.Driver_NotReady,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\tthrow new ZWaveError(\n\t\t\t\"Cannot retrieve the value DB for non-singlecast CCs\",\n\t\t\tZWaveErrorCodes.CC_NoNodeID,\n\t\t);\n\t}\n}\n\nfunction overrideQueriesWrapper(\n\tctx: GetValueDB & LogNode,\n\tendpoint: PhysicalCCAPIEndpoint,\n\tccId: CommandClasses,\n\tmethod: string,\n\toverrides: CompatOverrideQueries,\n\tfallback: (...args: any[]) => any,\n): (...args: any[]) => any {\n\t// We must not capture the `this` context here, because the API methods are bound on use\n\treturn function(this: any, ...args: any[]) {\n\t\tconst match = overrides.matchOverride(\n\t\t\tccId,\n\t\t\tendpoint.index,\n\t\t\tmethod,\n\t\t\targs,\n\t\t);\n\t\tif (!match) return fallback.call(this, ...args);\n\n\t\tctx.logNode(endpoint.nodeId, {\n\t\t\tmessage: `API call ${method} for ${\n\t\t\t\tgetCCName(\n\t\t\t\t\tccId,\n\t\t\t\t)\n\t\t\t} CC overridden by a compat flag.`,\n\t\t\tlevel: \"debug\",\n\t\t\tdirection: \"none\",\n\t\t});\n\n\t\tconst ccValues = getCCValues(ccId);\n\t\tif (ccValues) {\n\t\t\tconst valueDB = ctx.getValueDB(endpoint.nodeId);\n\n\t\t\tconst prop2value = (prop: string): CCValue | undefined => {\n\t\t\t\t// We use a simplistic parser to support dynamic value IDs:\n\t\t\t\t// If end with round brackets with something inside, they are considered dynamic\n\t\t\t\t// Otherwise static\n\t\t\t\tconst argsMatch = prop.match(/^(.*)\\((.*)\\)$/);\n\t\t\t\tif (argsMatch) {\n\t\t\t\t\tconst methodName = argsMatch[1];\n\t\t\t\t\tconst methodArgs = JSON.parse(`[${argsMatch[2]}]`);\n\n\t\t\t\t\tconst dynValue = ccValues[methodName];\n\t\t\t\t\tif (typeof dynValue === \"function\") {\n\t\t\t\t\t\treturn dynValue(...methodArgs);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tconst staticValue = ccValues[prop] as\n\t\t\t\t\t\t| StaticCCValue\n\t\t\t\t\t\t| undefined;\n\t\t\t\t\tif (typeof staticValue?.endpoint === \"function\") {\n\t\t\t\t\t\treturn staticValue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\n\t\t\t// Persist values if necessary\n\t\t\tif (match.persistValues) {\n\t\t\t\tfor (\n\t\t\t\t\tconst [prop, value] of Object.entries(\n\t\t\t\t\t\tmatch.persistValues,\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst ccValue = prop2value(prop);\n\t\t\t\t\t\tif (ccValue) {\n\t\t\t\t\t\t\tvalueDB.setValue(\n\t\t\t\t\t\t\t\tccValue.endpoint(endpoint.index),\n\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tctx.logNode(endpoint.nodeId, {\n\t\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t\t`Failed to persist value ${prop} during overridden API call: value does not exist`,\n\t\t\t\t\t\t\t\tlevel: \"error\",\n\t\t\t\t\t\t\t\tdirection: \"none\",\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tctx.logNode(endpoint.nodeId, {\n\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t`Failed to persist value ${prop} during overridden API call: ${\n\t\t\t\t\t\t\t\t\tgetErrorMessage(\n\t\t\t\t\t\t\t\t\t\te,\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}`,\n\t\t\t\t\t\t\tlevel: \"error\",\n\t\t\t\t\t\t\tdirection: \"none\",\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// As well as metadata\n\t\t\tif (match.extendMetadata) {\n\t\t\t\tfor (\n\t\t\t\t\tconst [prop, meta] of Object.entries(\n\t\t\t\t\t\tmatch.extendMetadata,\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst ccValue = prop2value(prop);\n\t\t\t\t\t\tif (ccValue) {\n\t\t\t\t\t\t\tvalueDB.setMetadata(\n\t\t\t\t\t\t\t\tccValue.endpoint(endpoint.index),\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t...ccValue.meta,\n\t\t\t\t\t\t\t\t\t...meta,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tctx.logNode(endpoint.nodeId, {\n\t\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t\t`Failed to extend value metadata ${prop} during overridden API call: value does not exist`,\n\t\t\t\t\t\t\t\tlevel: \"error\",\n\t\t\t\t\t\t\t\tdirection: \"none\",\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tctx.logNode(endpoint.nodeId, {\n\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t`Failed to extend value metadata ${prop} during overridden API call: ${\n\t\t\t\t\t\t\t\t\tgetErrorMessage(\n\t\t\t\t\t\t\t\t\t\te,\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}`,\n\t\t\t\t\t\t\tlevel: \"error\",\n\t\t\t\t\t\t\tdirection: \"none\",\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// API methods are always async\n\t\treturn Promise.resolve(match.result);\n\t};\n}\n\n/** A CC API that is only available for physical endpoints */\nexport class PhysicalCCAPI extends CCAPI {\n\tpublic constructor(\n\t\thost: CCAPIHost,\n\t\tendpoint: CCAPIEndpoint,\n\t) {\n\t\tsuper(host, endpoint);\n\t\tthis.assertPhysicalEndpoint(endpoint);\n\t}\n\n\tdeclare protected readonly endpoint: PhysicalCCAPIEndpoint;\n}\n\nexport type APIConstructor<T extends CCAPI = CCAPI> = new (\n\thost: CCAPIHost,\n\tendpoint: CCAPIEndpoint,\n) => T;\n\nexport type CCToName<CC extends CommandClasses> = {\n\t[K in keyof CCNameMap]: CCNameMap[K] extends CC ? K : never;\n}[keyof CCNameMap];\n\nexport type CCNameOrId = CommandClasses | Extract<keyof CCAPIs, string>;\n\nexport type CCToAPI<CC extends CCNameOrId> = CC extends CommandClasses\n\t? CCToName<CC> extends keyof CCAPIs ? CCAPIs[CCToName<CC>]\n\t: never\n\t: CC extends keyof CCAPIs ? CCAPIs[CC]\n\t: never;\n\nexport type APIMethodsOf<CC extends CCNameOrId> = Omit<\n\tOnlyMethods<CCToAPI<CC>>,\n\t| \"ccId\"\n\t| \"getNode\"\n\t| \"tryGetNode\"\n\t| \"isSetValueOptimistic\"\n\t| \"isSupported\"\n\t| \"pollValue\"\n\t| \"setValue\"\n\t| \"version\"\n\t| \"supportsCommand\"\n\t| \"withOptions\"\n\t| \"withTXReport\"\n>;\n\nexport type OwnMethodsOf<API extends CCAPI> = Omit<\n\tOnlyMethods<API>,\n\tkeyof OnlyMethods<CCAPI>\n>;\n\n// Wraps the given type in an object that contains a TX report\nexport type WrapWithTXReport<T> = [T] extends [Promise<infer U>]\n\t? Promise<WrapWithTXReport<U>>\n\t: [T] extends [void] ? { txReport: TXReport | undefined }\n\t: { result: T; txReport: TXReport | undefined };\n\nexport type ReturnWithTXReport<T> = T extends (...args: any[]) => any\n\t? (...args: Parameters<T>) => WrapWithTXReport<ReturnType<T>>\n\t: undefined;\n\n// Converts the type of the given API implementation so the API methods return an object including the TX report\nexport type WithTXReport<API extends CCAPI> =\n\t& Omit<\n\t\tAPI,\n\t\tkeyof OwnMethodsOf<API> | \"withOptions\" | \"withTXReport\" | \"setValue\"\n\t>\n\t& {\n\t\t[\n\t\t\tK in\n\t\t\t\t| keyof OwnMethodsOf<API>\n\t\t\t\t| \"setValue\"\n\t\t\t\t| \"pollValue\"\n\t\t]: ReturnWithTXReport<API[K]>;\n\t};\n\nexport function normalizeCCNameOrId(\n\tccNameOrId: number | string,\n): CommandClasses | undefined {\n\tif (!(ccNameOrId in CommandClasses)) return undefined;\n\n\tlet ret: CommandClasses | undefined;\n\tif (typeof ccNameOrId === \"string\") {\n\t\tif (/^\\d+$/.test(ccNameOrId)) {\n\t\t\t// This can happen on property access\n\t\t\tret = +ccNameOrId;\n\t\t} else if (typeof (CommandClasses as any)[ccNameOrId] === \"number\") {\n\t\t\tret = (CommandClasses as any)[ccNameOrId];\n\t\t}\n\t} else {\n\t\tret = ccNameOrId;\n\t}\n\n\treturn ret;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AACA;;;;;;;;;;;;;;AAAA,kBAkCO;AACP,oBAMO;AACP,wBAAwB;AACxB,oCAKO;AAgBA,MAAM,YAA2B,OAAO,IAAI,iBAAiB;AAQ7D,MAAM,kBAAiC,OAAO,IACpD,uBAAuB;AAyCjB,MAAM,aAA4B,OAAO,IAAI,kBAAkB;AAOhE,SAAU,yBACf,IACA,UAAyB;AAEzB,QAAM,IAAI,uBACT,GAAG,2BAAe,EAAE,CAAC,MAAM,QAAQ,iCACnC,4BAAgB,gBAAgB;AAElC;AARgB;AAUV,SAAU,4BACf,IACA,UACA,aAA4B;AAE5B,QAAM,IAAI,uBACT,GACC,2BAAe,EAAE,CAClB,MAAM,WAAW,mDAAmD,QAAQ,KAC5E,4BAAgB,gBAAgB;AAElC;AAXgB;AAaV,SAAU,wBACf,IACA,UAAyB;AAEzB,QAAM,IAAI,uBACT,GACC,2BAAe,EAAE,CAClB,eAAe,QAAQ,iDACvB,4BAAgB,gBAAgB;AAElC;AAVgB;AAYV,SAAU,oBACf,IACA,UACA,cACA,cAAoB;A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EA,SAAO;AACR;AAlBgB;",
4
+ "sourcesContent": ["import type { CompatOverrideQueries, GetDeviceConfig } from \"@zwave-js/config\";\nimport {\n\tCommandClasses,\n\ttype ControlsCC,\n\ttype Duration,\n\ttype EndpointId,\n\ttype GetEndpoint,\n\ttype GetNode,\n\ttype GetSafeCCVersion,\n\ttype GetSupportedCCVersion,\n\ttype GetValueDB,\n\ttype HostIDs,\n\ttype ListenBehavior,\n\ttype LogNode,\n\ttype MaybeNotKnown,\n\tNODE_ID_BROADCAST,\n\tNODE_ID_BROADCAST_LR,\n\tNOT_KNOWN,\n\ttype NodeId,\n\ttype PhysicalNodes,\n\ttype QueryNodeInterviewStage,\n\ttype QueryNodeStatus,\n\ttype SecurityManagers,\n\ttype SendCommandOptions,\n\ttype SupervisionResult,\n\ttype SupportsCC,\n\ttype TXReport,\n\ttype ValueChangeOptions,\n\ttype ValueDB,\n\ttype ValueID,\n\ttype VirtualEndpointId,\n\tZWaveError,\n\tZWaveErrorCodes,\n\tgetCCName,\n\tstripUndefined,\n} from \"@zwave-js/core\";\nimport {\n\ttype AllOrNone,\n\ttype OnlyMethods,\n\tgetEnumMemberName,\n\tgetErrorMessage,\n\tnum2hex,\n} from \"@zwave-js/shared\";\nimport { isArray } from \"alcalzone-shared/typeguards\";\nimport {\n\tgetAPI,\n\tgetCCValues,\n\tgetCommandClass,\n\tgetImplementedVersion,\n} from \"./CommandClassDecorators.js\";\nimport type { CCValue, StaticCCValue } from \"./Values.js\";\nimport type { SendCommand } from \"./traits.js\";\nimport type {\n\tGetRefreshValueTimeouts,\n\tGetUserPreferences,\n\tSchedulePoll,\n} from \"./traits.js\";\n\n// Import and re-export generated types\nimport type { CCAPIs, CCNameMap } from \"./_CCAPI.generated.js\";\nexport type { CCAPIs, CCNameMap };\n\nexport type ValueIDProperties = Pick<ValueID, \"property\" | \"propertyKey\">;\n\n/** Used to identify the method on the CC API class that handles setting values on nodes directly */\nexport const SET_VALUE: unique symbol = Symbol.for(\"CCAPI_SET_VALUE\");\n\nexport type SetValueImplementation = (\n\tproperty: ValueIDProperties,\n\tvalue: unknown,\n\toptions?: SetValueAPIOptions,\n) => Promise<SupervisionResult | undefined>;\n\nexport const SET_VALUE_HOOKS: unique symbol = Symbol.for(\n\t\"CCAPI_SET_VALUE_HOOKS\",\n);\n\nexport type SetValueImplementationHooks =\n\t& AllOrNone<{\n\t\t// Opt-in to and handle delayed supervision updates\n\t\tsupervisionDelayedUpdates: boolean;\n\t\tsupervisionOnSuccess: () => void | Promise<void>;\n\t\tsupervisionOnFailure: () => void | Promise<void>;\n\t}>\n\t& {\n\t\t// Whether the value is a target value for a CC using split\n\t\t// target/current values. If so, the value will be updated optimistically,\n\t\t// even if the device class does not support optimistic updates.\n\t\tisSplitStateTargetValue?: boolean;\n\t\t// Optimistically update related cached values (if allowed)\n\t\toptimisticallyUpdateRelatedValues?: (\n\t\t\tsupervisedAndSuccessful: boolean,\n\t\t) => void;\n\t\t// Check if a verification of the set value is required, even if the API response suggests otherwise\n\t\tforceVerifyChanges?: () => boolean;\n\t\t// Verify the changes\n\t\tverifyChanges?: (result?: SupervisionResult) => void | Promise<void>;\n\t};\n\nexport type SetValueImplementationHooksFactory = (\n\tproperty: ValueIDProperties,\n\tvalue: unknown,\n\toptions?: SetValueAPIOptions,\n) => SetValueImplementationHooks | undefined;\n\n/**\n * A generic options bag for the `setValue` API.\n * Each implementation will choose the options that are relevant for it, so you can use the same options everywhere.\n * @publicAPI\n */\nexport type SetValueAPIOptions =\n\t& Partial<ValueChangeOptions>\n\t& Pick<SendCommandOptions, \"onProgress\">;\n\n/** Used to identify the method on the CC API class that handles polling values from nodes */\nexport const POLL_VALUE: unique symbol = Symbol.for(\"CCAPI_POLL_VALUE\");\nexport type PollValueImplementation<T = unknown> = (\n\tproperty: ValueIDProperties,\n) => Promise<T | undefined>;\n\n// Since the setValue API is called from a point with very generic parameters,\n// we must do narrowing inside the API calls. These three methods are for convenience\nexport function throwUnsupportedProperty(\n\tcc: CommandClasses,\n\tproperty: string | number,\n): never {\n\tthrow new ZWaveError(\n\t\t`${CommandClasses[cc]}: \"${property}\" is not a supported property`,\n\t\tZWaveErrorCodes.Argument_Invalid,\n\t);\n}\n\nexport function throwUnsupportedPropertyKey(\n\tcc: CommandClasses,\n\tproperty: string | number,\n\tpropertyKey: string | number,\n): never {\n\tthrow new ZWaveError(\n\t\t`${\n\t\t\tCommandClasses[cc]\n\t\t}: \"${propertyKey}\" is not a supported property key for property \"${property}\"`,\n\t\tZWaveErrorCodes.Argument_Invalid,\n\t);\n}\n\nexport function throwMissingPropertyKey(\n\tcc: CommandClasses,\n\tproperty: string | number,\n): never {\n\tthrow new ZWaveError(\n\t\t`${\n\t\t\tCommandClasses[cc]\n\t\t}: property \"${property}\" requires a property key, but none was given`,\n\t\tZWaveErrorCodes.Argument_Invalid,\n\t);\n}\n\nexport function throwWrongValueType(\n\tcc: CommandClasses,\n\tproperty: string | number,\n\texpectedType: string,\n\treceivedType: string,\n): never {\n\tthrow new ZWaveError(\n\t\t`${\n\t\t\tCommandClasses[cc]\n\t\t}: \"${property}\" must be of type \"${expectedType}\", received \"${receivedType}\"`,\n\t\tZWaveErrorCodes.Argument_Invalid,\n\t);\n}\n\nexport interface CCAPISchedulePollOptions {\n\tduration?: Duration;\n\ttransition?: \"fast\" | \"slow\";\n}\n\n// Defines the necessary traits the host passed to a CC API must have\nexport type CCAPIHost<TNode extends CCAPINode = CCAPINode> =\n\t& HostIDs\n\t& GetNode<TNode>\n\t& GetValueDB\n\t& GetSupportedCCVersion\n\t& GetSafeCCVersion\n\t& SecurityManagers\n\t& GetDeviceConfig\n\t& SendCommand\n\t& GetRefreshValueTimeouts\n\t& GetUserPreferences\n\t& SchedulePoll\n\t& LogNode;\n\n// Defines the necessary traits a node passed to a CC API must have\nexport type CCAPINode =\n\t& NodeId\n\t& ListenBehavior\n\t& QueryNodeStatus\n\t& QueryNodeInterviewStage;\n\n// Defines the necessary traits an endpoint passed to a CC API must have\nexport type CCAPIEndpoint =\n\t& (\n\t\t| (\n\t\t\t// Physical endpoints must let us query their controlled CCs\n\t\t\tEndpointId & ControlsCC\n\t\t)\n\t\t| (\n\t\t\t// Virtual endpoints must let us query their physical nodes,\n\t\t\t// the CCs those nodes implement, and access the endpoints of those\n\t\t\t// physical nodes\n\t\t\tVirtualEndpointId & {\n\t\t\t\tnode: PhysicalNodes<\n\t\t\t\t\t& NodeId\n\t\t\t\t\t& SupportsCC\n\t\t\t\t\t& ControlsCC\n\t\t\t\t\t& GetEndpoint<EndpointId & SupportsCC & ControlsCC>\n\t\t\t\t>;\n\t\t\t}\n\t\t)\n\t)\n\t& SupportsCC;\n\nexport type PhysicalCCAPIEndpoint = CCAPIEndpoint & EndpointId;\nexport type VirtualCCAPIEndpoint = CCAPIEndpoint & VirtualEndpointId;\n\n/**\n * The base class for all CC APIs exposed via `Node.commandClasses.<CCName>`\n * @publicAPI\n */\nexport class CCAPI {\n\tpublic constructor(\n\t\tprotected readonly host: CCAPIHost,\n\t\tprotected readonly endpoint: CCAPIEndpoint,\n\t) {\n\t\tthis.ccId = getCommandClass(this);\n\t}\n\n\tpublic static create<T extends CommandClasses>(\n\t\tccId: T,\n\t\thost: CCAPIHost,\n\t\tendpoint: CCAPIEndpoint,\n\t\trequireSupport?: boolean,\n\t): CommandClasses extends T ? CCAPI : CCToAPI<T> {\n\t\tconst APIConstructor = getAPI(ccId);\n\t\tconst ccName = CommandClasses[ccId];\n\t\tif (APIConstructor == undefined) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t`Command Class ${ccName} (${\n\t\t\t\t\tnum2hex(\n\t\t\t\t\t\tccId,\n\t\t\t\t\t)\n\t\t\t\t}) has no associated API!`,\n\t\t\t\tZWaveErrorCodes.CC_NoAPI,\n\t\t\t);\n\t\t}\n\t\tconst apiInstance = new APIConstructor(host, endpoint);\n\n\t\t// Only require support for physical endpoints by default\n\t\trequireSupport ??= !endpoint.virtual;\n\n\t\tif (requireSupport) {\n\t\t\t// @ts-expect-error TS doesn't like assigning to conditional types\n\t\t\treturn new Proxy(apiInstance, {\n\t\t\t\tget: (target, property) => {\n\t\t\t\t\t// Forbid access to the API if it is not supported by the node\n\t\t\t\t\tif (\n\t\t\t\t\t\tproperty !== \"ccId\"\n\t\t\t\t\t\t&& property !== \"endpoint\"\n\t\t\t\t\t\t&& property !== \"isSupported\"\n\t\t\t\t\t\t&& property !== \"withOptions\"\n\t\t\t\t\t\t&& property !== \"commandOptions\"\n\t\t\t\t\t\t&& !target.isSupported()\n\t\t\t\t\t) {\n\t\t\t\t\t\tlet messageStart: string;\n\t\t\t\t\t\tif (endpoint.virtual) {\n\t\t\t\t\t\t\tconst hasNodeId =\n\t\t\t\t\t\t\t\ttypeof endpoint.nodeId === \"number\"\n\t\t\t\t\t\t\t\t&& endpoint.nodeId !== NODE_ID_BROADCAST\n\t\t\t\t\t\t\t\t&& endpoint.nodeId !== NODE_ID_BROADCAST_LR;\n\t\t\t\t\t\t\tmessageStart = `${\n\t\t\t\t\t\t\t\thasNodeId ? \"The\" : \"This\"\n\t\t\t\t\t\t\t} virtual node${\n\t\t\t\t\t\t\t\thasNodeId ? ` ${endpoint.nodeId}` : \"\"\n\t\t\t\t\t\t\t}`;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tmessageStart = `Node ${endpoint.nodeId}`;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthrow new ZWaveError(\n\t\t\t\t\t\t\t`${messageStart}${\n\t\t\t\t\t\t\t\tendpoint.index === 0\n\t\t\t\t\t\t\t\t\t? \"\"\n\t\t\t\t\t\t\t\t\t: ` (endpoint ${endpoint.index})`\n\t\t\t\t\t\t\t} does not support the Command Class ${ccName}!`,\n\t\t\t\t\t\t\tZWaveErrorCodes.CC_NotSupported,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\t// If a device config defines overrides for an API call, return a wrapper method that applies them first before calling the actual method\n\t\t\t\t\tconst fallback = target[property as keyof CCAPI];\n\t\t\t\t\tif (\n\t\t\t\t\t\ttypeof property === \"string\"\n\t\t\t\t\t\t&& !endpoint.virtual\n\t\t\t\t\t\t&& typeof fallback === \"function\"\n\t\t\t\t\t) {\n\t\t\t\t\t\tconst overrides = host.getDeviceConfig?.(\n\t\t\t\t\t\t\tendpoint.nodeId,\n\t\t\t\t\t\t)?.compat?.overrideQueries;\n\t\t\t\t\t\tif (overrides?.hasOverride(ccId)) {\n\t\t\t\t\t\t\treturn overrideQueriesWrapper(\n\t\t\t\t\t\t\t\thost,\n\t\t\t\t\t\t\t\tendpoint,\n\t\t\t\t\t\t\t\tccId,\n\t\t\t\t\t\t\t\tproperty,\n\t\t\t\t\t\t\t\toverrides,\n\t\t\t\t\t\t\t\tfallback,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Else just access the property\n\t\t\t\t\treturn fallback;\n\t\t\t\t},\n\t\t\t});\n\t\t} else {\n\t\t\t// @ts-expect-error TS doesn't like assigning to conditional types\n\t\t\treturn apiInstance;\n\t\t}\n\t}\n\n\t/**\n\t * The identifier of the Command Class this API is for\n\t */\n\tpublic readonly ccId: CommandClasses;\n\n\tprotected get [SET_VALUE](): SetValueImplementation | undefined {\n\t\treturn undefined;\n\t}\n\n\t/**\n\t * Can be used on supported CC APIs to set a CC value by property name (and optionally the property key).\n\t * **WARNING:** This function is NOT bound to an API instance. It must be called with the correct `this` context!\n\t */\n\tpublic get setValue(): SetValueImplementation | undefined {\n\t\treturn this[SET_VALUE];\n\t}\n\n\tprotected [SET_VALUE_HOOKS]: SetValueImplementationHooksFactory | undefined;\n\t/**\n\t * Can be implemented by CC APIs to influence the behavior of the setValue API in regards to Supervision and verifying values.\n\t */\n\tpublic get setValueHooks(): SetValueImplementationHooksFactory | undefined {\n\t\treturn this[SET_VALUE_HOOKS];\n\t}\n\n\t/** Whether a successful setValue call should imply that the value was successfully updated */\n\t// oxlint-disable-next-line no-unused-vars\n\tpublic isSetValueOptimistic(valueId: ValueID): boolean {\n\t\treturn true;\n\t}\n\n\tprotected get [POLL_VALUE](): PollValueImplementation | undefined {\n\t\treturn undefined;\n\t}\n\t/**\n\t * Can be used on supported CC APIs to poll a CC value by property name (and optionally the property key)\n\t * **WARNING:** This function is NOT bound to an API instance. It must be called with the correct `this` context!\n\t */\n\tpublic get pollValue(): PollValueImplementation | undefined {\n\t\treturn this[POLL_VALUE];\n\t}\n\n\t/**\n\t * Schedules a value to be polled after a given time. Schedules are deduplicated on a per-property basis.\n\t * @returns `true` if the poll was scheduled, `false` otherwise\n\t */\n\tprotected schedulePoll(\n\t\t{ property, propertyKey }: ValueIDProperties,\n\t\texpectedValue: unknown,\n\t\t{ duration, transition = \"slow\" }: CCAPISchedulePollOptions = {},\n\t): boolean {\n\t\t// Figure out the delay. If a non-zero duration was given or this is a \"fast\" transition,\n\t\t// use/add the short delay. Otherwise, default to the long delay.\n\t\tconst durationMs = duration?.toMilliseconds() ?? 0;\n\t\tconst timeouts = this.host.getRefreshValueTimeouts();\n\t\tconst additionalDelay = !!durationMs || transition === \"fast\"\n\t\t\t? timeouts.refreshValueAfterTransition\n\t\t\t: timeouts.refreshValue;\n\t\tconst timeoutMs = durationMs + additionalDelay;\n\n\t\tif (this.isSinglecast()) {\n\t\t\tconst node = this.host.getNode(this.endpoint.nodeId);\n\t\t\tif (!node) return false;\n\n\t\t\treturn this.host.schedulePoll(\n\t\t\t\tnode.id,\n\t\t\t\t{\n\t\t\t\t\tcommandClass: this.ccId,\n\t\t\t\t\tendpoint: this.endpoint.index,\n\t\t\t\t\tproperty,\n\t\t\t\t\tpropertyKey,\n\t\t\t\t},\n\t\t\t\t{ timeoutMs, expectedValue },\n\t\t\t);\n\t\t} else if (this.isMulticast()) {\n\t\t\t// Only poll supporting nodes in multicast\n\t\t\tconst supportingNodes = this.endpoint.node.physicalNodes.filter(\n\t\t\t\t(node) =>\n\t\t\t\t\tnode\n\t\t\t\t\t\t.getEndpoint(this.endpoint.index)\n\t\t\t\t\t\t?.supportsCC(this.ccId),\n\t\t\t);\n\t\t\tlet ret = false;\n\t\t\tfor (const node of supportingNodes) {\n\t\t\t\tret ||= this.host.schedulePoll(\n\t\t\t\t\tnode.id,\n\t\t\t\t\t{\n\t\t\t\t\t\tcommandClass: this.ccId,\n\t\t\t\t\t\tendpoint: this.endpoint.index,\n\t\t\t\t\t\tproperty,\n\t\t\t\t\t\tpropertyKey,\n\t\t\t\t\t},\n\t\t\t\t\t{ timeoutMs, expectedValue },\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn ret;\n\t\t} else {\n\t\t\t// Don't poll the broadcast node\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t/**\n\t * Retrieves the version of the given CommandClass this endpoint implements\n\t */\n\tpublic get version(): number {\n\t\tif (this.isSinglecast()) {\n\t\t\treturn this.host.getSafeCCVersion(\n\t\t\t\tthis.ccId,\n\t\t\t\tthis.endpoint.nodeId,\n\t\t\t\tthis.endpoint.index,\n\t\t\t) ?? 0;\n\t\t} else {\n\t\t\treturn getImplementedVersion(this.ccId);\n\t\t}\n\t}\n\n\t/** Determines if this simplified API instance may be used. */\n\tpublic isSupported(): boolean {\n\t\treturn (\n\t\t\t// NoOperation is always supported\n\t\t\tthis.ccId === CommandClasses[\"No Operation\"]\n\t\t\t// Basic should always be supported. Since we are trying to hide it from library consumers\n\t\t\t// we cannot trust supportsCC to test it\n\t\t\t|| this.ccId === CommandClasses.Basic\n\t\t\t|| this.endpoint.supportsCC(this.ccId)\n\t\t);\n\t}\n\n\t/**\n\t * Determine whether the linked node supports a specific command of this command class.\n\t * {@link NOT_KNOWN} (`undefined`) means that the information has not been received yet\n\t */\n\t// oxlint-disable-next-line no-unused-vars\n\tpublic supportsCommand(command: number): MaybeNotKnown<boolean> {\n\t\t// This needs to be overwritten per command class. In the default implementation, we don't know anything!\n\t\treturn NOT_KNOWN;\n\t}\n\n\tprotected assertSupportsCommand(\n\t\tcommandEnum: unknown,\n\t\tcommand: number,\n\t): void {\n\t\tif (this.supportsCommand(command) !== true) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t`${\n\t\t\t\t\tthis.isSinglecast()\n\t\t\t\t\t\t? `Node #${this.endpoint.nodeId}`\n\t\t\t\t\t\t: \"This virtual node\"\n\t\t\t\t}${\n\t\t\t\t\tthis.endpoint.index > 0\n\t\t\t\t\t\t? ` (Endpoint ${this.endpoint.index})`\n\t\t\t\t\t\t: \"\"\n\t\t\t\t} does not support the command ${\n\t\t\t\t\tgetEnumMemberName(\n\t\t\t\t\t\tcommandEnum,\n\t\t\t\t\t\tcommand,\n\t\t\t\t\t)\n\t\t\t\t}!`,\n\t\t\t\tZWaveErrorCodes.CC_NotSupported,\n\t\t\t);\n\t\t}\n\t}\n\n\tprotected assertPhysicalEndpoint(\n\t\tendpoint: EndpointId | VirtualEndpointId,\n\t): asserts endpoint is EndpointId {\n\t\tif (endpoint.virtual) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t`This method is not supported for virtual nodes!`,\n\t\t\t\tZWaveErrorCodes.CC_NotSupported,\n\t\t\t);\n\t\t}\n\t}\n\n\t/** Returns the command options to use for sendCommand calls */\n\tprotected get commandOptions(): SendCommandOptions {\n\t\t// No default options\n\t\treturn {};\n\t}\n\n\t/** Creates an instance of this API, scoped to use the given options */\n\tpublic withOptions(options: SendCommandOptions): this {\n\t\tconst mergedOptions = {\n\t\t\t...this.commandOptions,\n\t\t\t...options,\n\t\t};\n\t\treturn new Proxy(this, {\n\t\t\tget: (target, property) => {\n\t\t\t\tif (property === \"commandOptions\") {\n\t\t\t\t\treturn mergedOptions;\n\t\t\t\t} else {\n\t\t\t\t\treturn (target as any)[property];\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\t}\n\n\t/** Creates an instance of this API which (if supported) will return TX reports along with the result. */\n\tpublic withTXReport<T extends this>(): WithTXReport<T> {\n\t\tif (this.constructor === CCAPI) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t\"The withTXReport method may only be called on specific CC API implementations.\",\n\t\t\t\tZWaveErrorCodes.Driver_NotSupported,\n\t\t\t);\n\t\t}\n\n\t\t// Remember which properties need to be proxied\n\t\tconst proxiedProps = new Set([\n\t\t\t// These are the CC-specific methods\n\t\t\t...Object.getOwnPropertyNames(this.constructor.prototype),\n\t\t\t// as well as setValue and pollValue\n\t\t\t\"setValue\",\n\t\t\t\"pollValue\",\n\t\t]);\n\t\tproxiedProps.delete(\"constructor\");\n\n\t\tfunction wrapResult(result: unknown, txReport: TXReport): any {\n\t\t\t// Both the result and the TX report may be undefined (no response, no support)\n\t\t\treturn stripUndefined({\n\t\t\t\tresult,\n\t\t\t\ttxReport,\n\t\t\t});\n\t\t}\n\n\t\treturn new Proxy(this, {\n\t\t\tget: (target, prop) => {\n\t\t\t\tif (prop === \"withTXReport\") return undefined;\n\n\t\t\t\tlet original: any = (target as any)[prop];\n\t\t\t\tif (\n\t\t\t\t\tproxiedProps.has(prop as string)\n\t\t\t\t\t&& typeof original === \"function\"\n\t\t\t\t) {\n\t\t\t\t\t// This is a method that only exists in the specific implementation\n\n\t\t\t\t\t// Wrap each call with its own API proxy, so we don't mix up TX reports\n\t\t\t\t\tlet txReport: TXReport;\n\t\t\t\t\tconst api = target.withOptions({\n\t\t\t\t\t\tonTXReport: (report) => {\n\t\t\t\t\t\t\t// Remember the last status report\n\t\t\t\t\t\t\ttxReport = report;\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t\toriginal = (api as any)[prop].bind(api);\n\n\t\t\t\t\t// Return a wrapper function that will add the status report after the call is complete\n\t\t\t\t\treturn (...args: any) => {\n\t\t\t\t\t\tlet result = original(...args);\n\t\t\t\t\t\tif (result instanceof Promise) {\n\t\t\t\t\t\t\tresult = result.then((res) =>\n\t\t\t\t\t\t\t\twrapResult(res, txReport)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tresult = wrapResult(result, txReport);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn result;\n\t\t\t\t\t};\n\t\t\t\t} else {\n\t\t\t\t\treturn original;\n\t\t\t\t}\n\t\t\t},\n\t\t}) as any;\n\t}\n\n\tprotected isSinglecast(): this is this & {\n\t\tendpoint: PhysicalCCAPIEndpoint;\n\t} {\n\t\treturn (\n\t\t\t!this.endpoint.virtual\n\t\t\t&& typeof this.endpoint.nodeId === \"number\"\n\t\t\t&& this.endpoint.nodeId !== NODE_ID_BROADCAST\n\t\t\t&& this.endpoint.nodeId !== NODE_ID_BROADCAST_LR\n\t\t);\n\t}\n\n\tprotected isMulticast(): this is this & {\n\t\tendpoint: VirtualCCAPIEndpoint & {\n\t\t\tnodeId: number[];\n\t\t};\n\t} {\n\t\treturn this.endpoint.virtual && isArray(this.endpoint.nodeId);\n\t}\n\n\tprotected isBroadcast(): this is this & {\n\t\tendpoint: VirtualCCAPIEndpoint & {\n\t\t\tnodeId: typeof NODE_ID_BROADCAST | typeof NODE_ID_BROADCAST_LR;\n\t\t};\n\t} {\n\t\treturn (\n\t\t\tthis.endpoint.virtual\n\t\t\t&& (this.endpoint.nodeId === NODE_ID_BROADCAST\n\t\t\t\t|| this.endpoint.nodeId === NODE_ID_BROADCAST_LR)\n\t\t);\n\t}\n\n\t/** Returns the value DB for this CC API's node (if it can be safely accessed) */\n\tprotected tryGetValueDB(): ValueDB | undefined {\n\t\tif (!this.isSinglecast()) return;\n\t\ttry {\n\t\t\treturn this.host.getValueDB(this.endpoint.nodeId);\n\t\t} catch {\n\t\t\treturn;\n\t\t}\n\t}\n\n\t/** Returns the value DB for this CC's node (or throws if it cannot be accessed) */\n\tprotected getValueDB(): ValueDB {\n\t\tif (this.isSinglecast()) {\n\t\t\ttry {\n\t\t\t\treturn this.host.getValueDB(this.endpoint.nodeId);\n\t\t\t} catch {\n\t\t\t\tthrow new ZWaveError(\n\t\t\t\t\t\"The node for this CC does not exist or the driver is not ready yet\",\n\t\t\t\t\tZWaveErrorCodes.Driver_NotReady,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\tthrow new ZWaveError(\n\t\t\t\"Cannot retrieve the value DB for non-singlecast CCs\",\n\t\t\tZWaveErrorCodes.CC_NoNodeID,\n\t\t);\n\t}\n}\n\nfunction overrideQueriesWrapper(\n\tctx: GetValueDB & LogNode,\n\tendpoint: PhysicalCCAPIEndpoint,\n\tccId: CommandClasses,\n\tmethod: string,\n\toverrides: CompatOverrideQueries,\n\tfallback: (...args: any[]) => any,\n): (...args: any[]) => any {\n\t// We must not capture the `this` context here, because the API methods are bound on use\n\treturn function(this: any, ...args: any[]) {\n\t\tconst match = overrides.matchOverride(\n\t\t\tccId,\n\t\t\tendpoint.index,\n\t\t\tmethod,\n\t\t\targs,\n\t\t);\n\t\tif (!match) return fallback.call(this, ...args);\n\n\t\tctx.logNode(endpoint.nodeId, {\n\t\t\tmessage: `API call ${method} for ${\n\t\t\t\tgetCCName(\n\t\t\t\t\tccId,\n\t\t\t\t)\n\t\t\t} CC overridden by a compat flag.`,\n\t\t\tlevel: \"debug\",\n\t\t\tdirection: \"none\",\n\t\t});\n\n\t\tconst ccValues = getCCValues(ccId);\n\t\tif (ccValues) {\n\t\t\tconst valueDB = ctx.getValueDB(endpoint.nodeId);\n\n\t\t\tconst prop2value = (prop: string): CCValue | undefined => {\n\t\t\t\t// We use a simplistic parser to support dynamic value IDs:\n\t\t\t\t// If end with round brackets with something inside, they are considered dynamic\n\t\t\t\t// Otherwise static\n\t\t\t\tconst argsMatch = prop.match(/^(.*)\\((.*)\\)$/);\n\t\t\t\tif (argsMatch) {\n\t\t\t\t\tconst methodName = argsMatch[1];\n\t\t\t\t\tconst methodArgs = JSON.parse(`[${argsMatch[2]}]`);\n\n\t\t\t\t\tconst dynValue = ccValues[methodName];\n\t\t\t\t\tif (typeof dynValue === \"function\") {\n\t\t\t\t\t\treturn dynValue(...methodArgs);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tconst staticValue = ccValues[prop] as\n\t\t\t\t\t\t| StaticCCValue\n\t\t\t\t\t\t| undefined;\n\t\t\t\t\tif (typeof staticValue?.endpoint === \"function\") {\n\t\t\t\t\t\treturn staticValue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\n\t\t\t// Persist values if necessary\n\t\t\tif (match.persistValues) {\n\t\t\t\tfor (\n\t\t\t\t\tconst [prop, value] of Object.entries(\n\t\t\t\t\t\tmatch.persistValues,\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst ccValue = prop2value(prop);\n\t\t\t\t\t\tif (ccValue) {\n\t\t\t\t\t\t\tvalueDB.setValue(\n\t\t\t\t\t\t\t\tccValue.endpoint(endpoint.index),\n\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tctx.logNode(endpoint.nodeId, {\n\t\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t\t`Failed to persist value ${prop} during overridden API call: value does not exist`,\n\t\t\t\t\t\t\t\tlevel: \"error\",\n\t\t\t\t\t\t\t\tdirection: \"none\",\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tctx.logNode(endpoint.nodeId, {\n\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t`Failed to persist value ${prop} during overridden API call: ${\n\t\t\t\t\t\t\t\t\tgetErrorMessage(\n\t\t\t\t\t\t\t\t\t\te,\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}`,\n\t\t\t\t\t\t\tlevel: \"error\",\n\t\t\t\t\t\t\tdirection: \"none\",\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// As well as metadata\n\t\t\tif (match.extendMetadata) {\n\t\t\t\tfor (\n\t\t\t\t\tconst [prop, meta] of Object.entries(\n\t\t\t\t\t\tmatch.extendMetadata,\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst ccValue = prop2value(prop);\n\t\t\t\t\t\tif (ccValue) {\n\t\t\t\t\t\t\tvalueDB.setMetadata(\n\t\t\t\t\t\t\t\tccValue.endpoint(endpoint.index),\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t...ccValue.meta,\n\t\t\t\t\t\t\t\t\t...meta,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tctx.logNode(endpoint.nodeId, {\n\t\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t\t`Failed to extend value metadata ${prop} during overridden API call: value does not exist`,\n\t\t\t\t\t\t\t\tlevel: \"error\",\n\t\t\t\t\t\t\t\tdirection: \"none\",\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tctx.logNode(endpoint.nodeId, {\n\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t`Failed to extend value metadata ${prop} during overridden API call: ${\n\t\t\t\t\t\t\t\t\tgetErrorMessage(\n\t\t\t\t\t\t\t\t\t\te,\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}`,\n\t\t\t\t\t\t\tlevel: \"error\",\n\t\t\t\t\t\t\tdirection: \"none\",\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// API methods are always async\n\t\treturn Promise.resolve(match.result);\n\t};\n}\n\n/** A CC API that is only available for physical endpoints */\nexport class PhysicalCCAPI extends CCAPI {\n\tpublic constructor(\n\t\thost: CCAPIHost,\n\t\tendpoint: CCAPIEndpoint,\n\t) {\n\t\tsuper(host, endpoint);\n\t\tthis.assertPhysicalEndpoint(endpoint);\n\t}\n\n\tdeclare protected readonly endpoint: PhysicalCCAPIEndpoint;\n}\n\nexport type APIConstructor<T extends CCAPI = CCAPI> = new (\n\thost: CCAPIHost,\n\tendpoint: CCAPIEndpoint,\n) => T;\n\nexport type CCToName<CC extends CommandClasses> = {\n\t[K in keyof CCNameMap]: CCNameMap[K] extends CC ? K : never;\n}[keyof CCNameMap];\n\nexport type CCNameOrId = CommandClasses | Extract<keyof CCAPIs, string>;\n\nexport type CCToAPI<CC extends CCNameOrId> = CC extends CommandClasses\n\t? CCToName<CC> extends keyof CCAPIs ? CCAPIs[CCToName<CC>]\n\t: never\n\t: CC extends keyof CCAPIs ? CCAPIs[CC]\n\t: never;\n\nexport type APIMethodsOf<CC extends CCNameOrId> = Omit<\n\tOnlyMethods<CCToAPI<CC>>,\n\t| \"ccId\"\n\t| \"getNode\"\n\t| \"tryGetNode\"\n\t| \"isSetValueOptimistic\"\n\t| \"isSupported\"\n\t| \"pollValue\"\n\t| \"setValue\"\n\t| \"version\"\n\t| \"supportsCommand\"\n\t| \"withOptions\"\n\t| \"withTXReport\"\n>;\n\nexport type OwnMethodsOf<API extends CCAPI> = Omit<\n\tOnlyMethods<API>,\n\tkeyof OnlyMethods<CCAPI>\n>;\n\n// Wraps the given type in an object that contains a TX report\nexport type WrapWithTXReport<T> = [T] extends [Promise<infer U>]\n\t? Promise<WrapWithTXReport<U>>\n\t: [T] extends [void] ? { txReport: TXReport | undefined }\n\t: { result: T; txReport: TXReport | undefined };\n\nexport type ReturnWithTXReport<T> = T extends (...args: any[]) => any\n\t? (...args: Parameters<T>) => WrapWithTXReport<ReturnType<T>>\n\t: undefined;\n\n// Converts the type of the given API implementation so the API methods return an object including the TX report\nexport type WithTXReport<API extends CCAPI> =\n\t& Omit<\n\t\tAPI,\n\t\tkeyof OwnMethodsOf<API> | \"withOptions\" | \"withTXReport\" | \"setValue\"\n\t>\n\t& {\n\t\t[\n\t\t\tK in\n\t\t\t\t| keyof OwnMethodsOf<API>\n\t\t\t\t| \"setValue\"\n\t\t\t\t| \"pollValue\"\n\t\t]: ReturnWithTXReport<API[K]>;\n\t};\n\nexport function normalizeCCNameOrId(\n\tccNameOrId: number | string,\n): CommandClasses | undefined {\n\tif (!(ccNameOrId in CommandClasses)) return undefined;\n\n\tlet ret: CommandClasses | undefined;\n\tif (typeof ccNameOrId === \"string\") {\n\t\tif (/^\\d+$/.test(ccNameOrId)) {\n\t\t\t// This can happen on property access\n\t\t\tret = +ccNameOrId;\n\t\t} else if (typeof (CommandClasses as any)[ccNameOrId] === \"number\") {\n\t\t\tret = (CommandClasses as any)[ccNameOrId];\n\t\t}\n\t} else {\n\t\tret = ccNameOrId;\n\t}\n\n\treturn ret;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AACA;;;;;;;;;;;;;;AAAA,kBAkCO;AACP,oBAMO;AACP,wBAAwB;AACxB,oCAKO;AAgBA,MAAM,YAA2B,OAAO,IAAI,iBAAiB;AAQ7D,MAAM,kBAAiC,OAAO,IACpD,uBAAuB;AAyCjB,MAAM,aAA4B,OAAO,IAAI,kBAAkB;AAOhE,SAAU,yBACf,IACA,UAAyB;AAEzB,QAAM,IAAI,uBACT,GAAG,2BAAe,EAAE,CAAC,MAAM,QAAQ,iCACnC,4BAAgB,gBAAgB;AAElC;AARgB;AAUV,SAAU,4BACf,IACA,UACA,aAA4B;AAE5B,QAAM,IAAI,uBACT,GACC,2BAAe,EAAE,CAClB,MAAM,WAAW,mDAAmD,QAAQ,KAC5E,4BAAgB,gBAAgB;AAElC;AAXgB;AAaV,SAAU,wBACf,IACA,UAAyB;AAEzB,QAAM,IAAI,uBACT,GACC,2BAAe,EAAE,CAClB,eAAe,QAAQ,iDACvB,4BAAgB,gBAAgB;AAElC;AAVgB;AAYV,SAAU,oBACf,IACA,UACA,cACA,cAAoB;AAEpB,QAAM,IAAI,uBACT,GACC,2BAAe,EAAE,CAClB,MAAM,QAAQ,sBAAsB,YAAY,gBAAgB,YAAY,KAC5E,4BAAgB,gBAAgB;AAElC;AAZgB;AAuEV,MAAO,MAAK;EAnOlB,OAmOkB;;;EAEG;EACA;EAFpB,YACoB,MACA,UAAuB;gBADvB;oBACA;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+BACC,CAAC,CAEH;cACD,OAAO;cACP,WAAW;aACX;UACF;QACD;MACD;AAGA,UAAI,MAAM,gBAAgB;AACzB,mBACO,CAAC,MAAM,IAAI,KAAK,OAAO,QAC5B,MAAM,cAAc,GAEpB;AACD,cAAI;AACH,kBAAM,UAAU,WAAW,IAAI;AAC/B,gBAAI,SAAS;AACZ,sBAAQ,YACP,QAAQ,SAAS,SAAS,KAAK,GAC/B;gBACC,GAAG,QAAQ;gBACX,GAAG;eACH;YAEH,OAAO;AACN,kBAAI,QAAQ,SAAS,QAAQ;gBAC5B,SACC,mCAAmC,IAAI;gBACxC,OAAO;gBACP,WAAW;eACX;YACF;UACD,SAAS,GAAG;AACX,gBAAI,QAAQ,SAAS,QAAQ;cAC5B,SACC,mCAAmC,IAAI,oCACtC,+BACC,CAAC,CAEH;cACD,OAAO;cACP,WAAW;aACX;UACF;QACD;MACD;IACD;AAGA,WAAO,QAAQ,QAAQ,MAAM,MAAM;EACpC;AACD;AAxIS;AA2IH,MAAO,sBAAsB,MAAK;EAvxBxC,OAuxBwC;;;EACvC,YACC,MACA,UAAuB;AAEvB,UAAM,MAAM,QAAQ;AACpB,SAAK,uBAAuB,QAAQ;EACrC;;AAmEK,SAAU,oBACf,YAA2B;AAE3B,MAAI,EAAE,cAAc;AAAiB,WAAO;AAE5C,MAAI;AACJ,MAAI,OAAO,eAAe,UAAU;AACnC,QAAI,QAAQ,KAAK,UAAU,GAAG;AAE7B,YAAM,CAAC;IACR,WAAW,OAAQ,2BAAuB,UAAU,MAAM,UAAU;AACnE,YAAO,2BAAuB,UAAU;IACzC;EACD,OAAO;AACN,UAAM;EACP;AAEA,SAAO;AACR;AAlBgB;",
6
6
  "names": []
7
7
  }
@@ -1,5 +1,5 @@
1
1
  import type { GetDeviceConfig, LookupManufacturer } from "@zwave-js/config";
2
- import { type BroadcastCC, type CCAddress, type CCId, CommandClasses, type ControlsCC, EncapsulationFlags, type EndpointId, type FrameType, type GetAllEndpoints, type GetCCs, type GetEndpoint, type GetNode, type GetSupportedCCVersion, type GetValueDB, type HostIDs, type ListenBehavior, type LogNode, type MessageOrCCLogEntry, type MessagePriority, type ModifyCCs, type MulticastCC, type MulticastDestination, type NodeId, type QueryNodeStatus, type QuerySecurityClasses, type SetSecurityClass, type SinglecastCC, type SupportsCC, type ValueDB, type ValueID, type ValueMetadata, ZWaveErrorCodes } from "@zwave-js/core";
2
+ import { type BroadcastCC, type CCAddress, type CCId, CommandClasses, type ControlsCC, EncapsulationFlags, type EndpointId, type FrameType, type GetAllEndpoints, type GetCCs, type GetEndpoint, type GetNode, type GetSupportedCCVersion, type GetValueDB, type HostIDs, type ListenBehavior, type LogNode, type LogPayloadText, type MessageOrCCLogEntry, type MessagePriority, type ModifyCCs, type MulticastCC, type MulticastDestination, type NodeId, type QueryNodeStatus, type QuerySecurityClasses, type SetSecurityClass, type SinglecastCC, type SupportsCC, type ValueDB, type ValueID, type ValueMetadata, ZWaveErrorCodes } from "@zwave-js/core";
3
3
  import { Bytes, type BytesView, type JSONObject } from "@zwave-js/shared";
4
4
  import type { CCAPIHost, CCAPINode, ValueIDProperties } from "./API.js";
5
5
  import { type EncapsulatingCommandClass } from "./EncapsulatingCommandClass.js";
@@ -18,6 +18,8 @@ export type RefreshValuesContext = CCAPIHost<CCAPINode & GetEndpoint<EndpointId
18
18
  export interface RefreshValuesOptions {
19
19
  /** The priority to use for the refresh value queries */
20
20
  priority?: MessagePriority;
21
+ /** An optional tag to identify the transactions created by the refresh value queries */
22
+ tag?: any;
21
23
  /**
22
24
  * An optional callback to report fine-grained progress while refreshing values.
23
25
  */
@@ -231,6 +233,8 @@ export declare class InvalidCC extends CommandClass {
231
233
  readonly reason?: string | ZWaveErrorCodes;
232
234
  toLogEntry(_ctx?: GetValueDB): MessageOrCCLogEntry;
233
235
  }
236
+ /** Renders a CC and its encapsulated CC(s) into a tree-shaped log payload */
237
+ export declare function ccToLogPayload(cc: CommandClass, ctx?: GetValueDB): LogPayloadText;
234
238
  export type CCConstructor<T extends CommandClass> = typeof CommandClass & {
235
239
  new (options: any): T;
236
240
  };
@@ -22,6 +22,7 @@ __export(CommandClass_exports, {
22
22
  CCRaw: () => CCRaw,
23
23
  CommandClass: () => CommandClass,
24
24
  InvalidCC: () => InvalidCC,
25
+ ccToLogPayload: () => ccToLogPayload,
25
26
  getEffectiveCCVersion: () => getEffectiveCCVersion
26
27
  });
27
28
  module.exports = __toCommonJS(CommandClass_exports);
@@ -224,9 +225,7 @@ class CommandClass {
224
225
  message.command = (0, import_shared.num2hex)(this.ccCommand);
225
226
  }
226
227
  }
227
- if (this.payload.length > 0) {
228
- message.payload = (0, import_shared.buffer2hex)(this.payload);
229
- }
228
+ message.payload = (0, import_core.logBuffer)(this.payload);
230
229
  return {
231
230
  tags: [tag],
232
231
  message
@@ -698,11 +697,34 @@ class InvalidCC extends CommandClass {
698
697
  };
699
698
  }
700
699
  }
700
+ function ccToLogPayload(cc, ctx) {
701
+ const entry = cc.toLogEntry(ctx);
702
+ const nested = [];
703
+ if (entry.message) {
704
+ const message = (0, import_core.toLogPayload)(entry.message);
705
+ if (message.type === "dict" && message.nested) {
706
+ nested.push({ ...message, nested: void 0 });
707
+ nested.push(...(0, import_typeguards.isArray)(message.nested) ? message.nested : [message.nested]);
708
+ } else {
709
+ nested.push(message);
710
+ }
711
+ }
712
+ if ((0, import_EncapsulatingCommandClass.isEncapsulatingCommandClass)(cc)) {
713
+ nested.push(ccToLogPayload(cc.encapsulated, ctx));
714
+ } else if ((0, import_EncapsulatingCommandClass.isMultiEncapsulatingCommandClass)(cc)) {
715
+ for (const encap of cc.encapsulated) {
716
+ nested.push(ccToLogPayload(encap, ctx));
717
+ }
718
+ }
719
+ return (0, import_core.logText)([], { tags: entry.tags, nested });
720
+ }
721
+ __name(ccToLogPayload, "ccToLogPayload");
701
722
  // Annotate the CommonJS export names for ESM import in node:
702
723
  0 && (module.exports = {
703
724
  CCRaw,
704
725
  CommandClass,
705
726
  InvalidCC,
727
+ ccToLogPayload,
706
728
  getEffectiveCCVersion
707
729
  });
708
730
  //# sourceMappingURL=CommandClass.js.map