@zwave-js/cc 9.3.1-0-pr-4662-79458fb

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 (297) hide show
  1. package/build/cc/AlarmSensorCC.d.ts +54 -0
  2. package/build/cc/AlarmSensorCC.d.ts.map +1 -0
  3. package/build/cc/AlarmSensorCC.js +378 -0
  4. package/build/cc/AlarmSensorCC.js.map +1 -0
  5. package/build/cc/AssociationCC.d.ts +123 -0
  6. package/build/cc/AssociationCC.d.ts.map +1 -0
  7. package/build/cc/AssociationCC.js +615 -0
  8. package/build/cc/AssociationCC.js.map +1 -0
  9. package/build/cc/AssociationGroupInfoCC.d.ts +97 -0
  10. package/build/cc/AssociationGroupInfoCC.d.ts.map +1 -0
  11. package/build/cc/AssociationGroupInfoCC.js +530 -0
  12. package/build/cc/AssociationGroupInfoCC.js.map +1 -0
  13. package/build/cc/BarrierOperatorCC.d.ts +75 -0
  14. package/build/cc/BarrierOperatorCC.d.ts.map +1 -0
  15. package/build/cc/BarrierOperatorCC.js +492 -0
  16. package/build/cc/BarrierOperatorCC.js.map +1 -0
  17. package/build/cc/BasicCC.d.ts +51 -0
  18. package/build/cc/BasicCC.d.ts.map +1 -0
  19. package/build/cc/BasicCC.js +344 -0
  20. package/build/cc/BasicCC.js.map +1 -0
  21. package/build/cc/BatteryCC.d.ts +56 -0
  22. package/build/cc/BatteryCC.d.ts.map +1 -0
  23. package/build/cc/BatteryCC.js +417 -0
  24. package/build/cc/BatteryCC.js.map +1 -0
  25. package/build/cc/BinarySensorCC.d.ts +52 -0
  26. package/build/cc/BinarySensorCC.d.ts.map +1 -0
  27. package/build/cc/BinarySensorCC.js +321 -0
  28. package/build/cc/BinarySensorCC.js.map +1 -0
  29. package/build/cc/BinarySwitchCC.d.ts +55 -0
  30. package/build/cc/BinarySwitchCC.d.ts.map +1 -0
  31. package/build/cc/BinarySwitchCC.js +327 -0
  32. package/build/cc/BinarySwitchCC.js.map +1 -0
  33. package/build/cc/CRC16CC.d.ts +28 -0
  34. package/build/cc/CRC16CC.d.ts.map +1 -0
  35. package/build/cc/CRC16CC.js +109 -0
  36. package/build/cc/CRC16CC.js.map +1 -0
  37. package/build/cc/CentralSceneCC.d.ts +69 -0
  38. package/build/cc/CentralSceneCC.d.ts.map +1 -0
  39. package/build/cc/CentralSceneCC.js +443 -0
  40. package/build/cc/CentralSceneCC.js.map +1 -0
  41. package/build/cc/ClimateControlScheduleCC.d.ts +78 -0
  42. package/build/cc/ClimateControlScheduleCC.d.ts.map +1 -0
  43. package/build/cc/ClimateControlScheduleCC.js +417 -0
  44. package/build/cc/ClimateControlScheduleCC.js.map +1 -0
  45. package/build/cc/ClockCC.d.ts +40 -0
  46. package/build/cc/ClockCC.d.ts.map +1 -0
  47. package/build/cc/ClockCC.js +185 -0
  48. package/build/cc/ClockCC.js.map +1 -0
  49. package/build/cc/ColorSwitchCC.d.ts +98 -0
  50. package/build/cc/ColorSwitchCC.d.ts.map +1 -0
  51. package/build/cc/ColorSwitchCC.js +1045 -0
  52. package/build/cc/ColorSwitchCC.js.map +1 -0
  53. package/build/cc/ConfigurationCC.d.ts +315 -0
  54. package/build/cc/ConfigurationCC.d.ts.map +1 -0
  55. package/build/cc/ConfigurationCC.js +2257 -0
  56. package/build/cc/ConfigurationCC.js.map +1 -0
  57. package/build/cc/DeviceResetLocallyCC.d.ts +9 -0
  58. package/build/cc/DeviceResetLocallyCC.d.ts.map +1 -0
  59. package/build/cc/DeviceResetLocallyCC.js +28 -0
  60. package/build/cc/DeviceResetLocallyCC.js.map +1 -0
  61. package/build/cc/DoorLockCC.d.ts +116 -0
  62. package/build/cc/DoorLockCC.d.ts.map +1 -0
  63. package/build/cc/DoorLockCC.js +1112 -0
  64. package/build/cc/DoorLockCC.js.map +1 -0
  65. package/build/cc/DoorLockLoggingCC.d.ts +41 -0
  66. package/build/cc/DoorLockLoggingCC.d.ts.map +1 -0
  67. package/build/cc/DoorLockLoggingCC.js +288 -0
  68. package/build/cc/DoorLockLoggingCC.js.map +1 -0
  69. package/build/cc/EntryControlCC.d.ts +71 -0
  70. package/build/cc/EntryControlCC.d.ts.map +1 -0
  71. package/build/cc/EntryControlCC.js +492 -0
  72. package/build/cc/EntryControlCC.js.map +1 -0
  73. package/build/cc/FirmwareUpdateMetaDataCC.d.ts +148 -0
  74. package/build/cc/FirmwareUpdateMetaDataCC.d.ts.map +1 -0
  75. package/build/cc/FirmwareUpdateMetaDataCC.js +727 -0
  76. package/build/cc/FirmwareUpdateMetaDataCC.js.map +1 -0
  77. package/build/cc/HailCC.d.ts +6 -0
  78. package/build/cc/HailCC.d.ts.map +1 -0
  79. package/build/cc/HailCC.js +23 -0
  80. package/build/cc/HailCC.js.map +1 -0
  81. package/build/cc/HumidityControlModeCC.d.ts +47 -0
  82. package/build/cc/HumidityControlModeCC.d.ts.map +1 -0
  83. package/build/cc/HumidityControlModeCC.js +288 -0
  84. package/build/cc/HumidityControlModeCC.js.map +1 -0
  85. package/build/cc/HumidityControlOperatingStateCC.d.ts +24 -0
  86. package/build/cc/HumidityControlOperatingStateCC.d.ts.map +1 -0
  87. package/build/cc/HumidityControlOperatingStateCC.js +129 -0
  88. package/build/cc/HumidityControlOperatingStateCC.js.map +1 -0
  89. package/build/cc/HumidityControlSetpointCC.d.ts +103 -0
  90. package/build/cc/HumidityControlSetpointCC.d.ts.map +1 -0
  91. package/build/cc/HumidityControlSetpointCC.js +626 -0
  92. package/build/cc/HumidityControlSetpointCC.js.map +1 -0
  93. package/build/cc/IndicatorCC.d.ts +88 -0
  94. package/build/cc/IndicatorCC.d.ts.map +1 -0
  95. package/build/cc/IndicatorCC.js +758 -0
  96. package/build/cc/IndicatorCC.js.map +1 -0
  97. package/build/cc/IrrigationCC.d.ts +278 -0
  98. package/build/cc/IrrigationCC.d.ts.map +1 -0
  99. package/build/cc/IrrigationCC.js +2062 -0
  100. package/build/cc/IrrigationCC.js.map +1 -0
  101. package/build/cc/LanguageCC.d.ts +41 -0
  102. package/build/cc/LanguageCC.d.ts.map +1 -0
  103. package/build/cc/LanguageCC.js +220 -0
  104. package/build/cc/LanguageCC.js.map +1 -0
  105. package/build/cc/LockCC.d.ts +41 -0
  106. package/build/cc/LockCC.d.ts.map +1 -0
  107. package/build/cc/LockCC.js +185 -0
  108. package/build/cc/LockCC.js.map +1 -0
  109. package/build/cc/ManufacturerProprietaryCC.d.ts +31 -0
  110. package/build/cc/ManufacturerProprietaryCC.d.ts.map +1 -0
  111. package/build/cc/ManufacturerProprietaryCC.js +275 -0
  112. package/build/cc/ManufacturerProprietaryCC.js.map +1 -0
  113. package/build/cc/ManufacturerSpecificCC.d.ts +59 -0
  114. package/build/cc/ManufacturerSpecificCC.d.ts.map +1 -0
  115. package/build/cc/ManufacturerSpecificCC.js +285 -0
  116. package/build/cc/ManufacturerSpecificCC.js.map +1 -0
  117. package/build/cc/MeterCC.d.ts +100 -0
  118. package/build/cc/MeterCC.d.ts.map +1 -0
  119. package/build/cc/MeterCC.js +820 -0
  120. package/build/cc/MeterCC.js.map +1 -0
  121. package/build/cc/MultiChannelAssociationCC.d.ts +127 -0
  122. package/build/cc/MultiChannelAssociationCC.d.ts.map +1 -0
  123. package/build/cc/MultiChannelAssociationCC.js +883 -0
  124. package/build/cc/MultiChannelAssociationCC.js.map +1 -0
  125. package/build/cc/MultiChannelCC.d.ts +164 -0
  126. package/build/cc/MultiChannelCC.d.ts.map +1 -0
  127. package/build/cc/MultiChannelCC.js +1004 -0
  128. package/build/cc/MultiChannelCC.js.map +1 -0
  129. package/build/cc/MultiCommandCC.d.ts +28 -0
  130. package/build/cc/MultiCommandCC.d.ts.map +1 -0
  131. package/build/cc/MultiCommandCC.js +137 -0
  132. package/build/cc/MultiCommandCC.js.map +1 -0
  133. package/build/cc/MultilevelSensorCC.d.ts +83 -0
  134. package/build/cc/MultilevelSensorCC.d.ts.map +1 -0
  135. package/build/cc/MultilevelSensorCC.js +633 -0
  136. package/build/cc/MultilevelSensorCC.js.map +1 -0
  137. package/build/cc/MultilevelSwitchCC.d.ts +86 -0
  138. package/build/cc/MultilevelSwitchCC.d.ts.map +1 -0
  139. package/build/cc/MultilevelSwitchCC.js +774 -0
  140. package/build/cc/MultilevelSwitchCC.js.map +1 -0
  141. package/build/cc/NoOperationCC.d.ts +17 -0
  142. package/build/cc/NoOperationCC.d.ts.map +1 -0
  143. package/build/cc/NoOperationCC.js +50 -0
  144. package/build/cc/NoOperationCC.js.map +1 -0
  145. package/build/cc/NodeNamingCC.d.ts +57 -0
  146. package/build/cc/NodeNamingCC.d.ts.map +1 -0
  147. package/build/cc/NodeNamingCC.js +313 -0
  148. package/build/cc/NodeNamingCC.js.map +1 -0
  149. package/build/cc/NotificationCC.d.ts +127 -0
  150. package/build/cc/NotificationCC.d.ts.map +1 -0
  151. package/build/cc/NotificationCC.js +1193 -0
  152. package/build/cc/NotificationCC.js.map +1 -0
  153. package/build/cc/PowerlevelCC.d.ts +63 -0
  154. package/build/cc/PowerlevelCC.d.ts.map +1 -0
  155. package/build/cc/PowerlevelCC.js +262 -0
  156. package/build/cc/PowerlevelCC.js.map +1 -0
  157. package/build/cc/ProtectionCC.d.ts +94 -0
  158. package/build/cc/ProtectionCC.d.ts.map +1 -0
  159. package/build/cc/ProtectionCC.js +630 -0
  160. package/build/cc/ProtectionCC.js.map +1 -0
  161. package/build/cc/SceneActivationCC.d.ts +34 -0
  162. package/build/cc/SceneActivationCC.d.ts.map +1 -0
  163. package/build/cc/SceneActivationCC.js +170 -0
  164. package/build/cc/SceneActivationCC.js.map +1 -0
  165. package/build/cc/SceneActuatorConfigurationCC.d.ts +52 -0
  166. package/build/cc/SceneActuatorConfigurationCC.d.ts.map +1 -0
  167. package/build/cc/SceneActuatorConfigurationCC.js +368 -0
  168. package/build/cc/SceneActuatorConfigurationCC.js.map +1 -0
  169. package/build/cc/SceneControllerConfigurationCC.d.ts +61 -0
  170. package/build/cc/SceneControllerConfigurationCC.d.ts.map +1 -0
  171. package/build/cc/SceneControllerConfigurationCC.js +444 -0
  172. package/build/cc/SceneControllerConfigurationCC.js.map +1 -0
  173. package/build/cc/Security2CC.d.ts +213 -0
  174. package/build/cc/Security2CC.d.ts.map +1 -0
  175. package/build/cc/Security2CC.js +1124 -0
  176. package/build/cc/Security2CC.js.map +1 -0
  177. package/build/cc/SecurityCC.d.ts +109 -0
  178. package/build/cc/SecurityCC.d.ts.map +1 -0
  179. package/build/cc/SecurityCC.js +609 -0
  180. package/build/cc/SecurityCC.js.map +1 -0
  181. package/build/cc/SoundSwitchCC.d.ts +87 -0
  182. package/build/cc/SoundSwitchCC.d.ts.map +1 -0
  183. package/build/cc/SoundSwitchCC.js +548 -0
  184. package/build/cc/SoundSwitchCC.js.map +1 -0
  185. package/build/cc/SupervisionCC.d.ts +63 -0
  186. package/build/cc/SupervisionCC.d.ts.map +1 -0
  187. package/build/cc/SupervisionCC.js +239 -0
  188. package/build/cc/SupervisionCC.js.map +1 -0
  189. package/build/cc/ThermostatFanModeCC.d.ts +53 -0
  190. package/build/cc/ThermostatFanModeCC.d.ts.map +1 -0
  191. package/build/cc/ThermostatFanModeCC.js +359 -0
  192. package/build/cc/ThermostatFanModeCC.js.map +1 -0
  193. package/build/cc/ThermostatFanStateCC.d.ts +24 -0
  194. package/build/cc/ThermostatFanStateCC.d.ts.map +1 -0
  195. package/build/cc/ThermostatFanStateCC.js +131 -0
  196. package/build/cc/ThermostatFanStateCC.js.map +1 -0
  197. package/build/cc/ThermostatModeCC.d.ts +58 -0
  198. package/build/cc/ThermostatModeCC.d.ts.map +1 -0
  199. package/build/cc/ThermostatModeCC.js +370 -0
  200. package/build/cc/ThermostatModeCC.js.map +1 -0
  201. package/build/cc/ThermostatOperatingStateCC.d.ts +24 -0
  202. package/build/cc/ThermostatOperatingStateCC.d.ts.map +1 -0
  203. package/build/cc/ThermostatOperatingStateCC.js +127 -0
  204. package/build/cc/ThermostatOperatingStateCC.js.map +1 -0
  205. package/build/cc/ThermostatSetbackCC.d.ts +42 -0
  206. package/build/cc/ThermostatSetbackCC.d.ts.map +1 -0
  207. package/build/cc/ThermostatSetbackCC.js +237 -0
  208. package/build/cc/ThermostatSetbackCC.js.map +1 -0
  209. package/build/cc/ThermostatSetpointCC.d.ts +98 -0
  210. package/build/cc/ThermostatSetpointCC.d.ts.map +1 -0
  211. package/build/cc/ThermostatSetpointCC.js +707 -0
  212. package/build/cc/ThermostatSetpointCC.js.map +1 -0
  213. package/build/cc/TimeCC.d.ts +78 -0
  214. package/build/cc/TimeCC.d.ts.map +1 -0
  215. package/build/cc/TimeCC.js +373 -0
  216. package/build/cc/TimeCC.js.map +1 -0
  217. package/build/cc/TimeParametersCC.d.ts +40 -0
  218. package/build/cc/TimeParametersCC.d.ts.map +1 -0
  219. package/build/cc/TimeParametersCC.js +275 -0
  220. package/build/cc/TimeParametersCC.js.map +1 -0
  221. package/build/cc/TransportServiceCC.d.ts +101 -0
  222. package/build/cc/TransportServiceCC.d.ts.map +1 -0
  223. package/build/cc/TransportServiceCC.js +404 -0
  224. package/build/cc/TransportServiceCC.js.map +1 -0
  225. package/build/cc/UserCodeCC.d.ts +219 -0
  226. package/build/cc/UserCodeCC.d.ts.map +1 -0
  227. package/build/cc/UserCodeCC.js +1526 -0
  228. package/build/cc/UserCodeCC.js.map +1 -0
  229. package/build/cc/VersionCC.d.ts +91 -0
  230. package/build/cc/VersionCC.d.ts.map +1 -0
  231. package/build/cc/VersionCC.js +654 -0
  232. package/build/cc/VersionCC.js.map +1 -0
  233. package/build/cc/WakeUpCC.d.ts +67 -0
  234. package/build/cc/WakeUpCC.d.ts.map +1 -0
  235. package/build/cc/WakeUpCC.js +425 -0
  236. package/build/cc/WakeUpCC.js.map +1 -0
  237. package/build/cc/ZWavePlusCC.d.ts +40 -0
  238. package/build/cc/ZWavePlusCC.d.ts.map +1 -0
  239. package/build/cc/ZWavePlusCC.js +269 -0
  240. package/build/cc/ZWavePlusCC.js.map +1 -0
  241. package/build/cc/index.d.ts +64 -0
  242. package/build/cc/index.d.ts.map +1 -0
  243. package/build/cc/index.js +496 -0
  244. package/build/cc/index.js.map +1 -0
  245. package/build/cc/manufacturerProprietary/FibaroCC.d.ts +62 -0
  246. package/build/cc/manufacturerProprietary/FibaroCC.d.ts.map +1 -0
  247. package/build/cc/manufacturerProprietary/FibaroCC.js +247 -0
  248. package/build/cc/manufacturerProprietary/FibaroCC.js.map +1 -0
  249. package/build/index.d.ts +11 -0
  250. package/build/index.d.ts.map +1 -0
  251. package/build/index.js +48 -0
  252. package/build/index.js.map +1 -0
  253. package/build/index_safe.d.ts +4 -0
  254. package/build/index_safe.d.ts.map +1 -0
  255. package/build/index_safe.js +30 -0
  256. package/build/index_safe.js.map +1 -0
  257. package/build/lib/API.d.ts +176 -0
  258. package/build/lib/API.d.ts.map +1 -0
  259. package/build/lib/API.js +325 -0
  260. package/build/lib/API.js.map +1 -0
  261. package/build/lib/CommandClass.d.ts +341 -0
  262. package/build/lib/CommandClass.d.ts.map +1 -0
  263. package/build/lib/CommandClass.js +1088 -0
  264. package/build/lib/CommandClass.js.map +1 -0
  265. package/build/lib/EncapsulatingCommandClass.d.ts +35 -0
  266. package/build/lib/EncapsulatingCommandClass.d.ts.map +1 -0
  267. package/build/lib/EncapsulatingCommandClass.js +53 -0
  268. package/build/lib/EncapsulatingCommandClass.js.map +1 -0
  269. package/build/lib/ICommandClassContainer.d.ts +9 -0
  270. package/build/lib/ICommandClassContainer.d.ts.map +1 -0
  271. package/build/lib/ICommandClassContainer.js +12 -0
  272. package/build/lib/ICommandClassContainer.js.map +1 -0
  273. package/build/lib/NotificationEventPayload.d.ts +11 -0
  274. package/build/lib/NotificationEventPayload.d.ts.map +1 -0
  275. package/build/lib/NotificationEventPayload.js +11 -0
  276. package/build/lib/NotificationEventPayload.js.map +1 -0
  277. package/build/lib/Security2/Extension.d.ts +87 -0
  278. package/build/lib/Security2/Extension.d.ts.map +1 -0
  279. package/build/lib/Security2/Extension.js +235 -0
  280. package/build/lib/Security2/Extension.js.map +1 -0
  281. package/build/lib/Security2/shared.d.ts +31 -0
  282. package/build/lib/Security2/shared.d.ts.map +1 -0
  283. package/build/lib/Security2/shared.js +37 -0
  284. package/build/lib/Security2/shared.js.map +1 -0
  285. package/build/lib/_Types.d.ts +1446 -0
  286. package/build/lib/_Types.d.ts.map +1 -0
  287. package/build/lib/_Types.js +1334 -0
  288. package/build/lib/_Types.js.map +1 -0
  289. package/build/lib/serializers.d.ts +24 -0
  290. package/build/lib/serializers.d.ts.map +1 -0
  291. package/build/lib/serializers.js +66 -0
  292. package/build/lib/serializers.js.map +1 -0
  293. package/build/lib/utils.d.ts +13 -0
  294. package/build/lib/utils.d.ts.map +1 -0
  295. package/build/lib/utils.js +675 -0
  296. package/build/lib/utils.js.map +1 -0
  297. package/package.json +77 -0
@@ -0,0 +1,417 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.ClimateControlScheduleCCOverrideSet = exports.ClimateControlScheduleCCOverrideGet = exports.ClimateControlScheduleCCOverrideReport = exports.ClimateControlScheduleCCChangedGet = exports.ClimateControlScheduleCCChangedReport = exports.ClimateControlScheduleCCGet = exports.ClimateControlScheduleCCReport = exports.ClimateControlScheduleCCSet = exports.ClimateControlScheduleCC = exports.ClimateControlScheduleCCAPI = void 0;
10
+ function __assertType(argName, typeName, boundHasError) {
11
+ const { ZWaveError, ZWaveErrorCodes } = require("@zwave-js/core");
12
+ if (boundHasError()) {
13
+ throw new ZWaveError(typeName ? `${argName} is not a ${typeName}` : `${argName} has the wrong type`, ZWaveErrorCodes.Argument_Invalid);
14
+ }
15
+ }
16
+ const __assertType__Weekday = $o => {
17
+ function su__1__2__3__4__5__6__7__8_eu($o) {
18
+ return ![0, 1, 2, 3, 4, 5, 6, 7].includes($o) ? {} : null;
19
+ }
20
+ return su__1__2__3__4__5__6__7__8_eu($o);
21
+ };
22
+ const __assertType__sa__2_ea_2 = $o => {
23
+ function _number($o) {
24
+ return typeof $o !== "number" ? {} : null;
25
+ }
26
+ function _undefined($o) {
27
+ return $o !== undefined ? {} : null;
28
+ }
29
+ function _6($o) {
30
+ return $o !== "Frost Protection" ? {} : null;
31
+ }
32
+ function _7($o) {
33
+ return $o !== "Energy Saving" ? {} : null;
34
+ }
35
+ function _8($o) {
36
+ return $o !== "Unused" ? {} : null;
37
+ }
38
+ function su__undefined__number__6__7__8_eu($o) {
39
+ const conditions = [_undefined, _number, _6, _7, _8];
40
+ for (const condition of conditions) {
41
+ const error = condition($o);
42
+ if (!error)
43
+ return null;
44
+ }
45
+ return {};
46
+ }
47
+ function _2($o) {
48
+ if (typeof $o !== "object" || $o === null || Array.isArray($o))
49
+ return {};
50
+ if ("hour" in $o && $o["hour"] !== undefined) {
51
+ const error = _number($o["hour"]);
52
+ if (error)
53
+ return error;
54
+ }
55
+ else
56
+ return {};
57
+ if ("minute" in $o && $o["minute"] !== undefined) {
58
+ const error = _number($o["minute"]);
59
+ if (error)
60
+ return error;
61
+ }
62
+ else
63
+ return {};
64
+ if ("state" in $o && $o["state"] !== undefined) {
65
+ const error = su__undefined__number__6__7__8_eu($o["state"]);
66
+ if (error)
67
+ return error;
68
+ }
69
+ else
70
+ return {};
71
+ return null;
72
+ }
73
+ function sa__2_ea_2($o) {
74
+ if (!Array.isArray($o))
75
+ return {};
76
+ for (let i = 0; i < $o.length; i++) {
77
+ const error = _2($o[i]);
78
+ if (error)
79
+ return error;
80
+ }
81
+ return null;
82
+ }
83
+ return sa__2_ea_2($o);
84
+ };
85
+ const __assertType__ScheduleOverrideType = $o => {
86
+ function su__1__2__3_eu($o) {
87
+ return ![0, 1, 2].includes($o) ? {} : null;
88
+ }
89
+ return su__1__2__3_eu($o);
90
+ };
91
+ const __assertType__SetbackState = $o => {
92
+ function _number($o) {
93
+ return typeof $o !== "number" ? {} : null;
94
+ }
95
+ function _2($o) {
96
+ return $o !== "Frost Protection" ? {} : null;
97
+ }
98
+ function _3($o) {
99
+ return $o !== "Energy Saving" ? {} : null;
100
+ }
101
+ function _4($o) {
102
+ return $o !== "Unused" ? {} : null;
103
+ }
104
+ function su__number__2__3__4_eu($o) {
105
+ const conditions = [_number, _2, _3, _4];
106
+ for (const condition of conditions) {
107
+ const error = condition($o);
108
+ if (!error)
109
+ return null;
110
+ }
111
+ return {};
112
+ }
113
+ return su__number__2__3__4_eu($o);
114
+ };
115
+ const safe_1 = require("@zwave-js/core/safe");
116
+ const safe_2 = require("@zwave-js/shared/safe");
117
+ const strings_1 = require("alcalzone-shared/strings");
118
+ const API_1 = require("../lib/API");
119
+ const CommandClass_1 = require("../lib/CommandClass");
120
+ const serializers_1 = require("../lib/serializers");
121
+ const _Types_1 = require("../lib/_Types");
122
+ let ClimateControlScheduleCCAPI = class ClimateControlScheduleCCAPI extends API_1.CCAPI {
123
+ supportsCommand(cmd) {
124
+ switch (cmd) {
125
+ case _Types_1.ClimateControlScheduleCommand.Set:
126
+ case _Types_1.ClimateControlScheduleCommand.OverrideSet:
127
+ return true; // mandatory
128
+ case _Types_1.ClimateControlScheduleCommand.Get:
129
+ case _Types_1.ClimateControlScheduleCommand.ChangedGet:
130
+ case _Types_1.ClimateControlScheduleCommand.OverrideGet:
131
+ return this.isSinglecast();
132
+ }
133
+ return super.supportsCommand(cmd);
134
+ }
135
+ async set(weekday, switchPoints) {
136
+ __assertType("weekday", "Weekday", __assertType__Weekday.bind(void 0, weekday));
137
+ __assertType("switchPoints", undefined, __assertType__sa__2_ea_2.bind(void 0, switchPoints));
138
+ this.assertSupportsCommand(_Types_1.ClimateControlScheduleCommand, _Types_1.ClimateControlScheduleCommand.Set);
139
+ const cc = new ClimateControlScheduleCCSet(this.applHost, {
140
+ nodeId: this.endpoint.nodeId,
141
+ endpoint: this.endpoint.index,
142
+ weekday,
143
+ switchPoints,
144
+ });
145
+ await this.applHost.sendCommand(cc, this.commandOptions);
146
+ }
147
+ async get(weekday) {
148
+ __assertType("weekday", "Weekday", __assertType__Weekday.bind(void 0, weekday));
149
+ this.assertSupportsCommand(_Types_1.ClimateControlScheduleCommand, _Types_1.ClimateControlScheduleCommand.Get);
150
+ const cc = new ClimateControlScheduleCCGet(this.applHost, {
151
+ nodeId: this.endpoint.nodeId,
152
+ endpoint: this.endpoint.index,
153
+ weekday,
154
+ });
155
+ const response = await this.applHost.sendCommand(cc, this.commandOptions);
156
+ return response === null || response === void 0 ? void 0 : response.switchPoints;
157
+ }
158
+ async getChangeCounter() {
159
+ this.assertSupportsCommand(_Types_1.ClimateControlScheduleCommand, _Types_1.ClimateControlScheduleCommand.ChangedGet);
160
+ const cc = new ClimateControlScheduleCCChangedGet(this.applHost, {
161
+ nodeId: this.endpoint.nodeId,
162
+ endpoint: this.endpoint.index,
163
+ });
164
+ const response = await this.applHost.sendCommand(cc, this.commandOptions);
165
+ return response === null || response === void 0 ? void 0 : response.changeCounter;
166
+ }
167
+ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
168
+ async getOverride() {
169
+ this.assertSupportsCommand(_Types_1.ClimateControlScheduleCommand, _Types_1.ClimateControlScheduleCommand.OverrideGet);
170
+ const cc = new ClimateControlScheduleCCOverrideGet(this.applHost, {
171
+ nodeId: this.endpoint.nodeId,
172
+ endpoint: this.endpoint.index,
173
+ });
174
+ const response = await this.applHost.sendCommand(cc, this.commandOptions);
175
+ if (response) {
176
+ return {
177
+ type: response.overrideType,
178
+ state: response.overrideState,
179
+ };
180
+ }
181
+ }
182
+ async setOverride(type, state) {
183
+ __assertType("type", "ScheduleOverrideType", __assertType__ScheduleOverrideType.bind(void 0, type));
184
+ __assertType("state", "SetbackState", __assertType__SetbackState.bind(void 0, state));
185
+ this.assertSupportsCommand(_Types_1.ClimateControlScheduleCommand, _Types_1.ClimateControlScheduleCommand.OverrideSet);
186
+ const cc = new ClimateControlScheduleCCOverrideSet(this.applHost, {
187
+ nodeId: this.endpoint.nodeId,
188
+ endpoint: this.endpoint.index,
189
+ overrideType: type,
190
+ overrideState: state,
191
+ });
192
+ await this.applHost.sendCommand(cc, this.commandOptions);
193
+ }
194
+ };
195
+ ClimateControlScheduleCCAPI = __decorate([
196
+ (0, CommandClass_1.API)(safe_1.CommandClasses["Climate Control Schedule"])
197
+ ], ClimateControlScheduleCCAPI);
198
+ exports.ClimateControlScheduleCCAPI = ClimateControlScheduleCCAPI;
199
+ let ClimateControlScheduleCC = class ClimateControlScheduleCC extends CommandClass_1.CommandClass {
200
+ };
201
+ ClimateControlScheduleCC = __decorate([
202
+ (0, CommandClass_1.commandClass)(safe_1.CommandClasses["Climate Control Schedule"]),
203
+ (0, CommandClass_1.implementedVersion)(1)
204
+ ], ClimateControlScheduleCC);
205
+ exports.ClimateControlScheduleCC = ClimateControlScheduleCC;
206
+ let ClimateControlScheduleCCSet = class ClimateControlScheduleCCSet extends ClimateControlScheduleCC {
207
+ constructor(host, options) {
208
+ super(host, options);
209
+ if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
210
+ throw new safe_1.ZWaveError(`${this.constructor.name}: deserialization not implemented`, safe_1.ZWaveErrorCodes.Deserialization_NotImplemented);
211
+ }
212
+ else {
213
+ this.switchPoints = options.switchPoints;
214
+ this.weekday = options.weekday;
215
+ }
216
+ }
217
+ serialize() {
218
+ // Make sure we have exactly 9 entries
219
+ const allSwitchPoints = this.switchPoints.slice(0, 9); // maximum 9
220
+ while (allSwitchPoints.length < 9) {
221
+ allSwitchPoints.push({
222
+ hour: 0,
223
+ minute: 0,
224
+ state: "Unused",
225
+ });
226
+ }
227
+ this.payload = Buffer.concat([
228
+ Buffer.from([this.weekday & 0b111]),
229
+ ...allSwitchPoints.map((sp) => (0, serializers_1.encodeSwitchpoint)(sp)),
230
+ ]);
231
+ return super.serialize();
232
+ }
233
+ toLogEntry(applHost) {
234
+ return {
235
+ ...super.toLogEntry(applHost),
236
+ message: {
237
+ weekday: (0, safe_2.getEnumMemberName)(_Types_1.Weekday, this.weekday),
238
+ switchpoints: `${this.switchPoints
239
+ .map((sp) => `
240
+ · ${(0, strings_1.padStart)(sp.hour.toString(), 2, "0")}:${(0, strings_1.padStart)(sp.minute.toString(), 2, "0")} --> ${sp.state}`)
241
+ .join("")}`,
242
+ },
243
+ };
244
+ }
245
+ };
246
+ ClimateControlScheduleCCSet = __decorate([
247
+ (0, CommandClass_1.CCCommand)(_Types_1.ClimateControlScheduleCommand.Set)
248
+ ], ClimateControlScheduleCCSet);
249
+ exports.ClimateControlScheduleCCSet = ClimateControlScheduleCCSet;
250
+ let ClimateControlScheduleCCReport = class ClimateControlScheduleCCReport extends ClimateControlScheduleCC {
251
+ constructor(host, options) {
252
+ super(host, options);
253
+ (0, safe_1.validatePayload)(this.payload.length >= 28); // 1 + 9 * 3
254
+ const weekday = this.payload[0] & 0b111;
255
+ const allSwitchpoints = [];
256
+ for (let i = 0; i <= 8; i++) {
257
+ allSwitchpoints.push((0, serializers_1.decodeSwitchpoint)(this.payload.slice(1 + 3 * i)));
258
+ }
259
+ const switchPoints = allSwitchpoints.filter((sp) => sp.state !== "Unused");
260
+ this.schedule = [weekday, switchPoints];
261
+ }
262
+ get switchPoints() {
263
+ return this.schedule[1];
264
+ }
265
+ get weekday() {
266
+ return this.schedule[0];
267
+ }
268
+ toLogEntry(applHost) {
269
+ return {
270
+ ...super.toLogEntry(applHost),
271
+ message: {
272
+ weekday: (0, safe_2.getEnumMemberName)(_Types_1.Weekday, this.weekday),
273
+ switchpoints: `${this.switchPoints
274
+ .map((sp) => `
275
+ · ${(0, strings_1.padStart)(sp.hour.toString(), 2, "0")}:${(0, strings_1.padStart)(sp.minute.toString(), 2, "0")} --> ${sp.state}`)
276
+ .join("")}`,
277
+ },
278
+ };
279
+ }
280
+ };
281
+ __decorate([
282
+ (0, CommandClass_1.ccKeyValuePair)()
283
+ ], ClimateControlScheduleCCReport.prototype, "schedule", void 0);
284
+ ClimateControlScheduleCCReport = __decorate([
285
+ (0, CommandClass_1.CCCommand)(_Types_1.ClimateControlScheduleCommand.Report)
286
+ ], ClimateControlScheduleCCReport);
287
+ exports.ClimateControlScheduleCCReport = ClimateControlScheduleCCReport;
288
+ let ClimateControlScheduleCCGet = class ClimateControlScheduleCCGet extends ClimateControlScheduleCC {
289
+ constructor(host, options) {
290
+ super(host, options);
291
+ if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
292
+ throw new safe_1.ZWaveError(`${this.constructor.name}: deserialization not implemented`, safe_1.ZWaveErrorCodes.Deserialization_NotImplemented);
293
+ }
294
+ else {
295
+ this.weekday = options.weekday;
296
+ }
297
+ }
298
+ serialize() {
299
+ this.payload = Buffer.from([this.weekday & 0b111]);
300
+ return super.serialize();
301
+ }
302
+ toLogEntry(applHost) {
303
+ return {
304
+ ...super.toLogEntry(applHost),
305
+ message: { weekday: (0, safe_2.getEnumMemberName)(_Types_1.Weekday, this.weekday) },
306
+ };
307
+ }
308
+ };
309
+ ClimateControlScheduleCCGet = __decorate([
310
+ (0, CommandClass_1.CCCommand)(_Types_1.ClimateControlScheduleCommand.Get),
311
+ (0, CommandClass_1.expectedCCResponse)(ClimateControlScheduleCCReport)
312
+ ], ClimateControlScheduleCCGet);
313
+ exports.ClimateControlScheduleCCGet = ClimateControlScheduleCCGet;
314
+ let ClimateControlScheduleCCChangedReport = class ClimateControlScheduleCCChangedReport extends ClimateControlScheduleCC {
315
+ constructor(host, options) {
316
+ super(host, options);
317
+ (0, safe_1.validatePayload)(this.payload.length >= 1);
318
+ this._changeCounter = this.payload[0];
319
+ }
320
+ get changeCounter() {
321
+ return this._changeCounter;
322
+ }
323
+ toLogEntry(applHost) {
324
+ return {
325
+ ...super.toLogEntry(applHost),
326
+ message: { "change counter": this.changeCounter },
327
+ };
328
+ }
329
+ };
330
+ __decorate([
331
+ (0, CommandClass_1.ccValue)()
332
+ ], ClimateControlScheduleCCChangedReport.prototype, "changeCounter", null);
333
+ ClimateControlScheduleCCChangedReport = __decorate([
334
+ (0, CommandClass_1.CCCommand)(_Types_1.ClimateControlScheduleCommand.ChangedReport)
335
+ ], ClimateControlScheduleCCChangedReport);
336
+ exports.ClimateControlScheduleCCChangedReport = ClimateControlScheduleCCChangedReport;
337
+ let ClimateControlScheduleCCChangedGet = class ClimateControlScheduleCCChangedGet extends ClimateControlScheduleCC {
338
+ };
339
+ ClimateControlScheduleCCChangedGet = __decorate([
340
+ (0, CommandClass_1.CCCommand)(_Types_1.ClimateControlScheduleCommand.ChangedGet),
341
+ (0, CommandClass_1.expectedCCResponse)(ClimateControlScheduleCCChangedReport)
342
+ ], ClimateControlScheduleCCChangedGet);
343
+ exports.ClimateControlScheduleCCChangedGet = ClimateControlScheduleCCChangedGet;
344
+ let ClimateControlScheduleCCOverrideReport = class ClimateControlScheduleCCOverrideReport extends ClimateControlScheduleCC {
345
+ constructor(host, options) {
346
+ super(host, options);
347
+ (0, safe_1.validatePayload)(this.payload.length >= 2);
348
+ this._overrideType = this.payload[0] & 0b11;
349
+ this._overrideState =
350
+ (0, serializers_1.decodeSetbackState)(this.payload[1]) || this.payload[1];
351
+ }
352
+ get overrideType() {
353
+ return this._overrideType;
354
+ }
355
+ get overrideState() {
356
+ return this._overrideState;
357
+ }
358
+ toLogEntry(applHost) {
359
+ return {
360
+ ...super.toLogEntry(applHost),
361
+ message: {
362
+ "override type": (0, safe_2.getEnumMemberName)(_Types_1.ScheduleOverrideType, this._overrideType),
363
+ "override state": this._overrideState,
364
+ },
365
+ };
366
+ }
367
+ };
368
+ __decorate([
369
+ (0, CommandClass_1.ccValue)()
370
+ ], ClimateControlScheduleCCOverrideReport.prototype, "overrideType", null);
371
+ __decorate([
372
+ (0, CommandClass_1.ccValue)()
373
+ ], ClimateControlScheduleCCOverrideReport.prototype, "overrideState", null);
374
+ ClimateControlScheduleCCOverrideReport = __decorate([
375
+ (0, CommandClass_1.CCCommand)(_Types_1.ClimateControlScheduleCommand.OverrideReport)
376
+ ], ClimateControlScheduleCCOverrideReport);
377
+ exports.ClimateControlScheduleCCOverrideReport = ClimateControlScheduleCCOverrideReport;
378
+ let ClimateControlScheduleCCOverrideGet = class ClimateControlScheduleCCOverrideGet extends ClimateControlScheduleCC {
379
+ };
380
+ ClimateControlScheduleCCOverrideGet = __decorate([
381
+ (0, CommandClass_1.CCCommand)(_Types_1.ClimateControlScheduleCommand.OverrideGet),
382
+ (0, CommandClass_1.expectedCCResponse)(ClimateControlScheduleCCOverrideReport)
383
+ ], ClimateControlScheduleCCOverrideGet);
384
+ exports.ClimateControlScheduleCCOverrideGet = ClimateControlScheduleCCOverrideGet;
385
+ let ClimateControlScheduleCCOverrideSet = class ClimateControlScheduleCCOverrideSet extends ClimateControlScheduleCC {
386
+ constructor(host, options) {
387
+ super(host, options);
388
+ if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
389
+ throw new safe_1.ZWaveError(`${this.constructor.name}: deserialization not implemented`, safe_1.ZWaveErrorCodes.Deserialization_NotImplemented);
390
+ }
391
+ else {
392
+ this.overrideType = options.overrideType;
393
+ this.overrideState = options.overrideState;
394
+ }
395
+ }
396
+ serialize() {
397
+ this.payload = Buffer.from([
398
+ this.overrideType & 0b11,
399
+ (0, serializers_1.encodeSetbackState)(this.overrideState),
400
+ ]);
401
+ return super.serialize();
402
+ }
403
+ toLogEntry(applHost) {
404
+ return {
405
+ ...super.toLogEntry(applHost),
406
+ message: {
407
+ "override type": (0, safe_2.getEnumMemberName)(_Types_1.ScheduleOverrideType, this.overrideType),
408
+ "override state": this.overrideState,
409
+ },
410
+ };
411
+ }
412
+ };
413
+ ClimateControlScheduleCCOverrideSet = __decorate([
414
+ (0, CommandClass_1.CCCommand)(_Types_1.ClimateControlScheduleCommand.OverrideSet)
415
+ ], ClimateControlScheduleCCOverrideSet);
416
+ exports.ClimateControlScheduleCCOverrideSet = ClimateControlScheduleCCOverrideSet;
417
+ //# sourceMappingURL=ClimateControlScheduleCC.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ClimateControlScheduleCC.js","sourceRoot":"","sources":["../../src/cc/ClimateControlScheduleCC.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,8CAK6B;AAE7B,gDAA0D;AAE1D,sDAAoD;AACpD,oCAAmC;AACnC,sDAY6B;AAC7B,oDAK4B;AAC5B,0CAMuB;AAGvB,IAAa,2BAA2B,GAAxC,MAAa,2BAA4B,SAAQ,WAAK;IAC9C,eAAe,CAAC,GAAkC;QACxD,QAAQ,GAAG,EAAE;YACZ,KAAK,sCAA6B,CAAC,GAAG,CAAC;YACvC,KAAK,sCAA6B,CAAC,WAAW;gBAC7C,OAAO,IAAI,CAAC,CAAC,YAAY;YAC1B,KAAK,sCAA6B,CAAC,GAAG,CAAC;YACvC,KAAK,sCAA6B,CAAC,UAAU,CAAC;YAC9C,KAAK,sCAA6B,CAAC,WAAW;gBAC7C,OAAO,IAAI,CAAC,YAAY,EAAE,CAAC;SAC5B;QACD,OAAO,KAAK,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;IACnC,CAAC;IAGM,KAAK,CAAC,GAAG,CACf,OAAgB,EAChB,YAA2B;;;QAE3B,IAAI,CAAC,qBAAqB,CACzB,sCAA6B,EAC7B,sCAA6B,CAAC,GAAG,CACjC,CAAC;QAEF,MAAM,EAAE,GAAG,IAAI,2BAA2B,CAAC,IAAI,CAAC,QAAQ,EAAE;YACzD,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM;YAC5B,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,KAAK;YAC7B,OAAO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C,aAAa;aACpC;SACD,CAAC;IACH,CAAC;CACD,CAAA;AA1CY,mCAAmC;IAD/C,IAAA,wBAAS,EAAC,sCAA6B,CAAC,WAAW,CAAC;GACxC,mCAAmC,CA0C/C;AA1CY,kFAAmC"}
@@ -0,0 +1,40 @@
1
+ /// <reference types="node" />
2
+ import type { Maybe, MessageOrCCLogEntry } from "@zwave-js/core/safe";
3
+ import type { ZWaveApplicationHost, ZWaveHost } from "@zwave-js/host/safe";
4
+ import { CCAPI } from "../lib/API";
5
+ import { CommandClass, type CCCommandOptions, type CommandClassDeserializationOptions } from "../lib/CommandClass";
6
+ import { ClockCommand, Weekday } from "../lib/_Types";
7
+ export declare class ClockCCAPI extends CCAPI {
8
+ supportsCommand(cmd: ClockCommand): Maybe<boolean>;
9
+ get(): Promise<Pick<ClockCCReport, "weekday" | "hour" | "minute"> | undefined>;
10
+ set(hour: number, minute: number, weekday?: Weekday): Promise<void>;
11
+ }
12
+ export declare class ClockCC extends CommandClass {
13
+ ccCommand: ClockCommand;
14
+ interview(applHost: ZWaveApplicationHost): Promise<void>;
15
+ refreshValues(applHost: ZWaveApplicationHost): Promise<void>;
16
+ }
17
+ interface ClockCCSetOptions extends CCCommandOptions {
18
+ weekday: Weekday;
19
+ hour: number;
20
+ minute: number;
21
+ }
22
+ export declare class ClockCCSet extends ClockCC {
23
+ constructor(host: ZWaveHost, options: CommandClassDeserializationOptions | ClockCCSetOptions);
24
+ weekday: Weekday;
25
+ hour: number;
26
+ minute: number;
27
+ serialize(): Buffer;
28
+ toLogEntry(applHost: ZWaveApplicationHost): MessageOrCCLogEntry;
29
+ }
30
+ export declare class ClockCCReport extends ClockCC {
31
+ constructor(host: ZWaveHost, options: CommandClassDeserializationOptions);
32
+ readonly weekday: Weekday;
33
+ readonly hour: number;
34
+ readonly minute: number;
35
+ toLogEntry(applHost: ZWaveApplicationHost): MessageOrCCLogEntry;
36
+ }
37
+ export declare class ClockCCGet extends ClockCC {
38
+ }
39
+ export {};
40
+ //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C;IAEf,SAAS,IAAI,MAAM;IAQnB,UAAU,CAAC,QAAQ,EAAE,oBAAoB,GAAG,mBAAmB;CAetE;AAED,qBACa,aAAc,SAAQ,OAAO;gBAExC,IAAI,EAAE,SAAS,EACf,OAAO,EAAE,kCAAkC;IAe5C,SAAgB,OAAO,EAAE,OAAO,CAAC;IACjC,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,SAAgB,MAAM,EAAE,MAAM,CAAC;IAExB,UAAU,CAAC,QAAQ,EAAE,oBAAoB,GAAG,mBAAmB;CAetE;AAED,qBAEa,UAAW,SAAQ,OAAO;CAAG"}
@@ -0,0 +1,185 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.ClockCCGet = exports.ClockCCReport = exports.ClockCCSet = exports.ClockCC = exports.ClockCCAPI = void 0;
10
+ function __assertType(argName, typeName, boundHasError) {
11
+ const { ZWaveError, ZWaveErrorCodes } = require("@zwave-js/core");
12
+ if (boundHasError()) {
13
+ throw new ZWaveError(typeName ? `${argName} is not a ${typeName}` : `${argName} has the wrong type`, ZWaveErrorCodes.Argument_Invalid);
14
+ }
15
+ }
16
+ const __assertType__number = $o => {
17
+ function _number($o) {
18
+ return typeof $o !== "number" ? {} : null;
19
+ }
20
+ return _number($o);
21
+ };
22
+ const __assertType__optional_Weekday = $o => {
23
+ function su__1__2__3__4__5__6__7__8_eu($o) {
24
+ return ![0, 1, 2, 3, 4, 5, 6, 7].includes($o) ? {} : null;
25
+ }
26
+ function optional_su__1__2__3__4__5__6__7__8_eu($o) {
27
+ if ($o !== undefined) {
28
+ const error = su__1__2__3__4__5__6__7__8_eu($o);
29
+ if (error)
30
+ return error;
31
+ }
32
+ return null;
33
+ }
34
+ return optional_su__1__2__3__4__5__6__7__8_eu($o);
35
+ };
36
+ const safe_1 = require("@zwave-js/core/safe");
37
+ const safe_2 = require("@zwave-js/shared/safe");
38
+ const strings_1 = require("alcalzone-shared/strings");
39
+ const API_1 = require("../lib/API");
40
+ const CommandClass_1 = require("../lib/CommandClass");
41
+ const _Types_1 = require("../lib/_Types");
42
+ // @noSetValueAPI - This CC has no simple value to set
43
+ let ClockCCAPI = class ClockCCAPI extends API_1.CCAPI {
44
+ supportsCommand(cmd) {
45
+ switch (cmd) {
46
+ case _Types_1.ClockCommand.Get:
47
+ return this.isSinglecast();
48
+ case _Types_1.ClockCommand.Set:
49
+ return true; // This is mandatory
50
+ }
51
+ return super.supportsCommand(cmd);
52
+ }
53
+ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
54
+ async get() {
55
+ this.assertSupportsCommand(_Types_1.ClockCommand, _Types_1.ClockCommand.Get);
56
+ const cc = new ClockCCGet(this.applHost, {
57
+ nodeId: this.endpoint.nodeId,
58
+ endpoint: this.endpoint.index,
59
+ });
60
+ const response = await this.applHost.sendCommand(cc, this.commandOptions);
61
+ if (response) {
62
+ return (0, safe_2.pick)(response, ["weekday", "hour", "minute"]);
63
+ }
64
+ }
65
+ async set(hour, minute, weekday) {
66
+ __assertType("hour", "number", __assertType__number.bind(void 0, hour));
67
+ __assertType("minute", "number", __assertType__number.bind(void 0, minute));
68
+ __assertType("weekday", "(optional) Weekday", __assertType__optional_Weekday.bind(void 0, weekday));
69
+ this.assertSupportsCommand(_Types_1.ClockCommand, _Types_1.ClockCommand.Set);
70
+ const cc = new ClockCCSet(this.applHost, {
71
+ nodeId: this.endpoint.nodeId,
72
+ endpoint: this.endpoint.index,
73
+ hour,
74
+ minute,
75
+ weekday: weekday !== null && weekday !== void 0 ? weekday : _Types_1.Weekday.Unknown,
76
+ });
77
+ await this.applHost.sendCommand(cc, this.commandOptions);
78
+ }
79
+ };
80
+ ClockCCAPI = __decorate([
81
+ (0, CommandClass_1.API)(safe_1.CommandClasses.Clock)
82
+ ], ClockCCAPI);
83
+ exports.ClockCCAPI = ClockCCAPI;
84
+ let ClockCC = class ClockCC extends CommandClass_1.CommandClass {
85
+ async interview(applHost) {
86
+ const node = this.getNode(applHost);
87
+ applHost.controllerLog.logNode(node.id, {
88
+ endpoint: this.endpointIndex,
89
+ message: `Interviewing ${this.ccName}...`,
90
+ direction: "none",
91
+ });
92
+ await this.refreshValues(applHost);
93
+ // Remember that the interview is complete
94
+ this.setInterviewComplete(applHost, true);
95
+ }
96
+ async refreshValues(applHost) {
97
+ const node = this.getNode(applHost);
98
+ const endpoint = this.getEndpoint(applHost);
99
+ const api = API_1.CCAPI.create(safe_1.CommandClasses.Clock, applHost, endpoint).withOptions({
100
+ priority: safe_1.MessagePriority.NodeQuery,
101
+ });
102
+ applHost.controllerLog.logNode(node.id, {
103
+ message: "requesting current clock setting...",
104
+ direction: "outbound",
105
+ });
106
+ const response = await api.get();
107
+ if (response) {
108
+ const logMessage = `received current clock setting: ${response.weekday !== _Types_1.Weekday.Unknown
109
+ ? _Types_1.Weekday[response.weekday] + ", "
110
+ : ""}${response.hour < 10 ? "0" : ""}${response.hour}:${response.minute < 10 ? "0" : ""}${response.minute}`;
111
+ applHost.controllerLog.logNode(node.id, {
112
+ message: logMessage,
113
+ direction: "inbound",
114
+ });
115
+ }
116
+ }
117
+ };
118
+ ClockCC = __decorate([
119
+ (0, CommandClass_1.commandClass)(safe_1.CommandClasses.Clock),
120
+ (0, CommandClass_1.implementedVersion)(1)
121
+ ], ClockCC);
122
+ exports.ClockCC = ClockCC;
123
+ let ClockCCSet = class ClockCCSet extends ClockCC {
124
+ constructor(host, options) {
125
+ super(host, options);
126
+ if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
127
+ // TODO: Deserialize payload
128
+ throw new safe_1.ZWaveError(`${this.constructor.name}: deserialization not implemented`, safe_1.ZWaveErrorCodes.Deserialization_NotImplemented);
129
+ }
130
+ else {
131
+ this.weekday = options.weekday;
132
+ this.hour = options.hour;
133
+ this.minute = options.minute;
134
+ }
135
+ }
136
+ serialize() {
137
+ this.payload = Buffer.from([
138
+ ((this.weekday & 0b111) << 5) | (this.hour & 0b11111),
139
+ this.minute,
140
+ ]);
141
+ return super.serialize();
142
+ }
143
+ toLogEntry(applHost) {
144
+ return {
145
+ ...super.toLogEntry(applHost),
146
+ message: {
147
+ "clock setting": `${(0, safe_2.getEnumMemberName)(_Types_1.Weekday, this.weekday)}, ${(0, strings_1.padStart)(this.hour.toString(), 2, "0")}:${(0, strings_1.padStart)(this.minute.toString(), 2, "0")}`,
148
+ },
149
+ };
150
+ }
151
+ };
152
+ ClockCCSet = __decorate([
153
+ (0, CommandClass_1.CCCommand)(_Types_1.ClockCommand.Set)
154
+ ], ClockCCSet);
155
+ exports.ClockCCSet = ClockCCSet;
156
+ let ClockCCReport = class ClockCCReport extends ClockCC {
157
+ constructor(host, options) {
158
+ super(host, options);
159
+ (0, safe_1.validatePayload)(this.payload.length >= 2);
160
+ this.weekday = this.payload[0] >>> 5;
161
+ this.hour = this.payload[0] & 0b11111;
162
+ this.minute = this.payload[1];
163
+ (0, safe_1.validatePayload)(this.weekday <= _Types_1.Weekday.Sunday, this.hour <= 23, this.minute <= 59);
164
+ }
165
+ toLogEntry(applHost) {
166
+ return {
167
+ ...super.toLogEntry(applHost),
168
+ message: {
169
+ "clock setting": `${(0, safe_2.getEnumMemberName)(_Types_1.Weekday, this.weekday)}, ${(0, strings_1.padStart)(this.hour.toString(), 2, "0")}:${(0, strings_1.padStart)(this.minute.toString(), 2, "0")}`,
170
+ },
171
+ };
172
+ }
173
+ };
174
+ ClockCCReport = __decorate([
175
+ (0, CommandClass_1.CCCommand)(_Types_1.ClockCommand.Report)
176
+ ], ClockCCReport);
177
+ exports.ClockCCReport = ClockCCReport;
178
+ let ClockCCGet = class ClockCCGet extends ClockCC {
179
+ };
180
+ ClockCCGet = __decorate([
181
+ (0, CommandClass_1.CCCommand)(_Types_1.ClockCommand.Get),
182
+ (0, CommandClass_1.expectedCCResponse)(ClockCCReport)
183
+ ], ClockCCGet);
184
+ exports.ClockCCGet = ClockCCGet;
185
+ //# sourceMappingURL=ClockCC.js.map