@homebridge/hap-nodejs 2.3.1-beta.1 → 2.3.1-beta.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 (252) hide show
  1. package/README.md +13 -4
  2. package/dist/accessories/types.d.ts +0 -1
  3. package/dist/hap.d.ts +1 -1
  4. package/dist/hap.js +6 -4
  5. package/dist/hap.js.map +1 -1
  6. package/dist/index.d.ts +4 -1
  7. package/dist/index.js +4 -0
  8. package/dist/index.js.map +1 -1
  9. package/dist/internal-types.d.ts +6 -7
  10. package/dist/internal-types.js +1 -5
  11. package/dist/internal-types.js.map +1 -1
  12. package/dist/lib/Accessory.d.ts +53 -25
  13. package/dist/lib/Accessory.js +289 -171
  14. package/dist/lib/Accessory.js.map +1 -1
  15. package/dist/lib/Advertiser.d.ts +37 -18
  16. package/dist/lib/Advertiser.js +143 -62
  17. package/dist/lib/Advertiser.js.map +1 -1
  18. package/dist/lib/Bridge.d.ts +1 -2
  19. package/dist/lib/Bridge.js +1 -1
  20. package/dist/lib/Characteristic.d.ts +19 -20
  21. package/dist/lib/Characteristic.js +187 -153
  22. package/dist/lib/Characteristic.js.map +1 -1
  23. package/dist/lib/HAPServer.d.ts +19 -13
  24. package/dist/lib/HAPServer.js +266 -220
  25. package/dist/lib/HAPServer.js.map +1 -1
  26. package/dist/lib/Service.d.ts +11 -11
  27. package/dist/lib/Service.js +54 -37
  28. package/dist/lib/Service.js.map +1 -1
  29. package/dist/lib/camera/RTPProxy.d.ts +5 -5
  30. package/dist/lib/camera/RTPProxy.js +48 -23
  31. package/dist/lib/camera/RTPProxy.js.map +1 -1
  32. package/dist/lib/camera/RTPStreamManagement.d.ts +18 -13
  33. package/dist/lib/camera/RTPStreamManagement.js +247 -216
  34. package/dist/lib/camera/RTPStreamManagement.js.map +1 -1
  35. package/dist/lib/camera/RecordingManagement.d.ts +13 -13
  36. package/dist/lib/camera/RecordingManagement.js +115 -110
  37. package/dist/lib/camera/RecordingManagement.js.map +1 -1
  38. package/dist/lib/camera/index.d.ts +0 -1
  39. package/dist/lib/controller/AdaptiveLightingController.d.ts +41 -36
  40. package/dist/lib/controller/AdaptiveLightingController.js +126 -113
  41. package/dist/lib/controller/AdaptiveLightingController.js.map +1 -1
  42. package/dist/lib/controller/CameraController.d.ts +17 -17
  43. package/dist/lib/controller/CameraController.js +30 -26
  44. package/dist/lib/controller/CameraController.js.map +1 -1
  45. package/dist/lib/controller/Controller.d.ts +15 -12
  46. package/dist/lib/controller/Controller.js +0 -1
  47. package/dist/lib/controller/Controller.js.map +1 -1
  48. package/dist/lib/controller/DoorbellController.d.ts +6 -6
  49. package/dist/lib/controller/DoorbellController.js +10 -3
  50. package/dist/lib/controller/DoorbellController.js.map +1 -1
  51. package/dist/lib/controller/RemoteController.d.ts +46 -27
  52. package/dist/lib/controller/RemoteController.js +268 -178
  53. package/dist/lib/controller/RemoteController.js.map +1 -1
  54. package/dist/lib/controller/index.d.ts +0 -1
  55. package/dist/lib/datastream/DataStreamManagement.d.ts +6 -6
  56. package/dist/lib/datastream/DataStreamManagement.js +30 -26
  57. package/dist/lib/datastream/DataStreamManagement.js.map +1 -1
  58. package/dist/lib/datastream/DataStreamParser.d.ts +25 -8
  59. package/dist/lib/datastream/DataStreamParser.js +124 -105
  60. package/dist/lib/datastream/DataStreamParser.js.map +1 -1
  61. package/dist/lib/datastream/DataStreamServer.d.ts +47 -23
  62. package/dist/lib/datastream/DataStreamServer.js +285 -143
  63. package/dist/lib/datastream/DataStreamServer.js.map +1 -1
  64. package/dist/lib/datastream/index.d.ts +0 -1
  65. package/dist/lib/definitions/CharacteristicDefinitions.d.ts +0 -1
  66. package/dist/lib/definitions/CharacteristicDefinitions.js +578 -578
  67. package/dist/lib/definitions/CharacteristicDefinitions.js.map +1 -1
  68. package/dist/lib/definitions/ServiceDefinitions.d.ts +0 -1
  69. package/dist/lib/definitions/index.d.ts +0 -1
  70. package/dist/lib/gen/HomeKit.d.ts +0 -1
  71. package/dist/lib/model/AccessoryInfo.d.ts +5 -6
  72. package/dist/lib/model/AccessoryInfo.js +23 -19
  73. package/dist/lib/model/AccessoryInfo.js.map +1 -1
  74. package/dist/lib/model/ControllerStorage.d.ts +11 -5
  75. package/dist/lib/model/ControllerStorage.js +34 -8
  76. package/dist/lib/model/ControllerStorage.js.map +1 -1
  77. package/dist/lib/model/HAPFileStorage.d.ts +20 -2
  78. package/dist/lib/model/HAPFileStorage.js +59 -10
  79. package/dist/lib/model/HAPFileStorage.js.map +1 -1
  80. package/dist/lib/model/HAPStorage.d.ts +0 -1
  81. package/dist/lib/model/HAPStorage.js +6 -3
  82. package/dist/lib/model/HAPStorage.js.map +1 -1
  83. package/dist/lib/model/IdentifierCache.d.ts +2 -3
  84. package/dist/lib/model/IdentifierCache.js +26 -13
  85. package/dist/lib/model/IdentifierCache.js.map +1 -1
  86. package/dist/lib/tv/AccessControlManagement.d.ts +6 -7
  87. package/dist/lib/tv/AccessControlManagement.js +13 -19
  88. package/dist/lib/tv/AccessControlManagement.js.map +1 -1
  89. package/dist/lib/util/checkName.d.ts +1 -2
  90. package/dist/lib/util/checkName.js.map +1 -1
  91. package/dist/lib/util/clone.d.ts +0 -1
  92. package/dist/lib/util/clone.js.map +1 -1
  93. package/dist/lib/util/color-utils.d.ts +1 -2
  94. package/dist/lib/util/color-utils.js +1 -1
  95. package/dist/lib/util/errors.d.ts +4 -0
  96. package/dist/lib/util/errors.js +15 -0
  97. package/dist/lib/util/errors.js.map +1 -0
  98. package/dist/lib/util/eventedhttp.d.ts +63 -19
  99. package/dist/lib/util/eventedhttp.js +170 -48
  100. package/dist/lib/util/eventedhttp.js.map +1 -1
  101. package/dist/lib/util/hapCrypto.d.ts +1 -2
  102. package/dist/lib/util/hapCrypto.js +6 -7
  103. package/dist/lib/util/hapCrypto.js.map +1 -1
  104. package/dist/lib/util/hapStatusError.d.ts +0 -1
  105. package/dist/lib/util/hapStatusError.js +1 -1
  106. package/dist/lib/util/hapStatusError.js.map +1 -1
  107. package/dist/lib/util/net-utils.d.ts +1 -2
  108. package/dist/lib/util/net-utils.js +6 -7
  109. package/dist/lib/util/net-utils.js.map +1 -1
  110. package/dist/lib/util/once.d.ts +0 -1
  111. package/dist/lib/util/promise-utils.d.ts +1 -2
  112. package/dist/lib/util/promise-utils.js +2 -1
  113. package/dist/lib/util/promise-utils.js.map +1 -1
  114. package/dist/lib/util/request-util.d.ts +4 -4
  115. package/dist/lib/util/request-util.js +29 -28
  116. package/dist/lib/util/request-util.js.map +1 -1
  117. package/dist/lib/util/time.d.ts +1 -2
  118. package/dist/lib/util/time.js.map +1 -1
  119. package/dist/lib/util/tlv.d.ts +4 -4
  120. package/dist/lib/util/tlv.js +16 -5
  121. package/dist/lib/util/tlv.js.map +1 -1
  122. package/dist/lib/util/uuid.d.ts +5 -2
  123. package/dist/lib/util/uuid.js +6 -0
  124. package/dist/lib/util/uuid.js.map +1 -1
  125. package/dist/types.d.ts +20 -17
  126. package/dist/types.js +0 -1
  127. package/dist/types.js.map +1 -1
  128. package/package.json +8 -14
  129. package/dist/accessories/AirConditioner_accessory.d.ts +0 -2
  130. package/dist/accessories/AirConditioner_accessory.d.ts.map +0 -1
  131. package/dist/accessories/AirConditioner_accessory.js +0 -126
  132. package/dist/accessories/AirConditioner_accessory.js.map +0 -1
  133. package/dist/accessories/AppleTVRemote_accessory.d.ts +0 -2
  134. package/dist/accessories/AppleTVRemote_accessory.d.ts.map +0 -1
  135. package/dist/accessories/AppleTVRemote_accessory.js +0 -146
  136. package/dist/accessories/AppleTVRemote_accessory.js.map +0 -1
  137. package/dist/accessories/Camera_accessory.d.ts +0 -2
  138. package/dist/accessories/Camera_accessory.d.ts.map +0 -1
  139. package/dist/accessories/Camera_accessory.js +0 -562
  140. package/dist/accessories/Camera_accessory.js.map +0 -1
  141. package/dist/accessories/Fan_accessory.d.ts +0 -2
  142. package/dist/accessories/Fan_accessory.d.ts.map +0 -1
  143. package/dist/accessories/Fan_accessory.js +0 -71
  144. package/dist/accessories/Fan_accessory.js.map +0 -1
  145. package/dist/accessories/GarageDoorOpener_accessory.d.ts +0 -2
  146. package/dist/accessories/GarageDoorOpener_accessory.d.ts.map +0 -1
  147. package/dist/accessories/GarageDoorOpener_accessory.js +0 -76
  148. package/dist/accessories/GarageDoorOpener_accessory.js.map +0 -1
  149. package/dist/accessories/Light-AdaptiveLighting_accessory.d.ts +0 -2
  150. package/dist/accessories/Light-AdaptiveLighting_accessory.d.ts.map +0 -1
  151. package/dist/accessories/Light-AdaptiveLighting_accessory.js +0 -103
  152. package/dist/accessories/Light-AdaptiveLighting_accessory.js.map +0 -1
  153. package/dist/accessories/Light_accessory.d.ts +0 -2
  154. package/dist/accessories/Light_accessory.d.ts.map +0 -1
  155. package/dist/accessories/Light_accessory.js +0 -143
  156. package/dist/accessories/Light_accessory.js.map +0 -1
  157. package/dist/accessories/Lock_accessory.d.ts +0 -2
  158. package/dist/accessories/Lock_accessory.d.ts.map +0 -1
  159. package/dist/accessories/Lock_accessory.js +0 -74
  160. package/dist/accessories/Lock_accessory.js.map +0 -1
  161. package/dist/accessories/MotionSensor_accessory.d.ts +0 -2
  162. package/dist/accessories/MotionSensor_accessory.d.ts.map +0 -1
  163. package/dist/accessories/MotionSensor_accessory.js +0 -43
  164. package/dist/accessories/MotionSensor_accessory.js.map +0 -1
  165. package/dist/accessories/Outlet_accessory.d.ts +0 -2
  166. package/dist/accessories/Outlet_accessory.d.ts.map +0 -1
  167. package/dist/accessories/Outlet_accessory.js +0 -77
  168. package/dist/accessories/Outlet_accessory.js.map +0 -1
  169. package/dist/accessories/SmartSpeaker_accessory.d.ts +0 -2
  170. package/dist/accessories/SmartSpeaker_accessory.d.ts.map +0 -1
  171. package/dist/accessories/SmartSpeaker_accessory.js +0 -42
  172. package/dist/accessories/SmartSpeaker_accessory.js.map +0 -1
  173. package/dist/accessories/Sprinkler_accessory.d.ts +0 -2
  174. package/dist/accessories/Sprinkler_accessory.d.ts.map +0 -1
  175. package/dist/accessories/Sprinkler_accessory.js +0 -126
  176. package/dist/accessories/Sprinkler_accessory.js.map +0 -1
  177. package/dist/accessories/TV_accessory.d.ts +0 -2
  178. package/dist/accessories/TV_accessory.d.ts.map +0 -1
  179. package/dist/accessories/TV_accessory.js +0 -99
  180. package/dist/accessories/TV_accessory.js.map +0 -1
  181. package/dist/accessories/TemperatureSensor_accessory.d.ts +0 -2
  182. package/dist/accessories/TemperatureSensor_accessory.d.ts.map +0 -1
  183. package/dist/accessories/TemperatureSensor_accessory.js +0 -42
  184. package/dist/accessories/TemperatureSensor_accessory.js.map +0 -1
  185. package/dist/accessories/Wi-FiRouter_accessory.d.ts +0 -3
  186. package/dist/accessories/Wi-FiRouter_accessory.d.ts.map +0 -1
  187. package/dist/accessories/Wi-FiRouter_accessory.js +0 -14
  188. package/dist/accessories/Wi-FiRouter_accessory.js.map +0 -1
  189. package/dist/accessories/Wi-FiSatellite_accessory.d.ts +0 -3
  190. package/dist/accessories/Wi-FiSatellite_accessory.d.ts.map +0 -1
  191. package/dist/accessories/Wi-FiSatellite_accessory.js +0 -16
  192. package/dist/accessories/Wi-FiSatellite_accessory.js.map +0 -1
  193. package/dist/accessories/gstreamer-audioProducer.d.ts +0 -25
  194. package/dist/accessories/gstreamer-audioProducer.d.ts.map +0 -1
  195. package/dist/accessories/gstreamer-audioProducer.js +0 -145
  196. package/dist/accessories/gstreamer-audioProducer.js.map +0 -1
  197. package/dist/accessories/types.d.ts.map +0 -1
  198. package/dist/hap.d.ts.map +0 -1
  199. package/dist/index.d.ts.map +0 -1
  200. package/dist/internal-types.d.ts.map +0 -1
  201. package/dist/lib/Accessory.d.ts.map +0 -1
  202. package/dist/lib/Advertiser.d.ts.map +0 -1
  203. package/dist/lib/Bridge.d.ts.map +0 -1
  204. package/dist/lib/Characteristic.d.ts.map +0 -1
  205. package/dist/lib/HAPServer.d.ts.map +0 -1
  206. package/dist/lib/Service.d.ts.map +0 -1
  207. package/dist/lib/camera/RTPProxy.d.ts.map +0 -1
  208. package/dist/lib/camera/RTPStreamManagement.d.ts.map +0 -1
  209. package/dist/lib/camera/RecordingManagement.d.ts.map +0 -1
  210. package/dist/lib/camera/index.d.ts.map +0 -1
  211. package/dist/lib/controller/AdaptiveLightingController.d.ts.map +0 -1
  212. package/dist/lib/controller/CameraController.d.ts.map +0 -1
  213. package/dist/lib/controller/Controller.d.ts.map +0 -1
  214. package/dist/lib/controller/DoorbellController.d.ts.map +0 -1
  215. package/dist/lib/controller/RemoteController.d.ts.map +0 -1
  216. package/dist/lib/controller/index.d.ts.map +0 -1
  217. package/dist/lib/datastream/DataStreamManagement.d.ts.map +0 -1
  218. package/dist/lib/datastream/DataStreamParser.d.ts.map +0 -1
  219. package/dist/lib/datastream/DataStreamServer.d.ts.map +0 -1
  220. package/dist/lib/datastream/index.d.ts.map +0 -1
  221. package/dist/lib/definitions/CharacteristicDefinitions.d.ts.map +0 -1
  222. package/dist/lib/definitions/ServiceDefinitions.d.ts.map +0 -1
  223. package/dist/lib/definitions/generate-definitions.d.ts +0 -34
  224. package/dist/lib/definitions/generate-definitions.d.ts.map +0 -1
  225. package/dist/lib/definitions/generate-definitions.js +0 -624
  226. package/dist/lib/definitions/generate-definitions.js.map +0 -1
  227. package/dist/lib/definitions/generator-configuration.d.ts +0 -22
  228. package/dist/lib/definitions/generator-configuration.d.ts.map +0 -1
  229. package/dist/lib/definitions/generator-configuration.js +0 -674
  230. package/dist/lib/definitions/generator-configuration.js.map +0 -1
  231. package/dist/lib/definitions/index.d.ts.map +0 -1
  232. package/dist/lib/gen/HomeKit.d.ts.map +0 -1
  233. package/dist/lib/model/AccessoryInfo.d.ts.map +0 -1
  234. package/dist/lib/model/ControllerStorage.d.ts.map +0 -1
  235. package/dist/lib/model/HAPFileStorage.d.ts.map +0 -1
  236. package/dist/lib/model/HAPStorage.d.ts.map +0 -1
  237. package/dist/lib/model/IdentifierCache.d.ts.map +0 -1
  238. package/dist/lib/tv/AccessControlManagement.d.ts.map +0 -1
  239. package/dist/lib/util/checkName.d.ts.map +0 -1
  240. package/dist/lib/util/clone.d.ts.map +0 -1
  241. package/dist/lib/util/color-utils.d.ts.map +0 -1
  242. package/dist/lib/util/eventedhttp.d.ts.map +0 -1
  243. package/dist/lib/util/hapCrypto.d.ts.map +0 -1
  244. package/dist/lib/util/hapStatusError.d.ts.map +0 -1
  245. package/dist/lib/util/net-utils.d.ts.map +0 -1
  246. package/dist/lib/util/once.d.ts.map +0 -1
  247. package/dist/lib/util/promise-utils.d.ts.map +0 -1
  248. package/dist/lib/util/request-util.d.ts.map +0 -1
  249. package/dist/lib/util/time.d.ts.map +0 -1
  250. package/dist/lib/util/tlv.d.ts.map +0 -1
  251. package/dist/lib/util/uuid.d.ts.map +0 -1
  252. package/dist/types.d.ts.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"Fan_accessory.js","sourceRoot":"","sources":["../../src/accessories/Fan_accessory.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,OAAO,EACL,SAAS,EAGT,cAAc,EAEd,OAAO,EACP,IAAI,GAEL,MAAM,aAAa,CAAA;AAEpB,MAAM,QAAQ,GAAwB;IACpC,OAAO,EAAE,KAAK;IACd,MAAM,EAAE,GAAG;IACX,UAAU,EAAE,CAAC,EAAuB,EAAE,EAAE;QACtC,IAAI,EAAE,EAAE,CAAC;YACP,wCAAwC;YACxC,QAAQ,CAAC,OAAO,GAAG,EAAE,CAAA;QACvB,CAAC;aAAM,CAAC;YACN,yCAAyC;YACzC,QAAQ,CAAC,OAAO,GAAG,EAAE,CAAA;QACvB,CAAC;IACH,CAAC;IACD,QAAQ,EAAE,CAAC,KAA0B,EAAE,EAAE;QACvC,OAAO,CAAC,GAAG,CAAC,0BAA0B,EAAE,KAAK,CAAC,CAAA;QAC9C,QAAQ,CAAC,MAAM,GAAG,KAAK,CAAA;QACvB,wDAAwD;IAC1D,CAAC;IACD,QAAQ,EAAE,GAAG,EAAE;QACb,yCAAyC;QACzC,OAAO,CAAC,GAAG,CAAC,iBAAiB,CA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ACA,UAAU,CAAC,OAAO,CAAC,GAAG,CAAE;KACxB,iBAAiB,CAAC,cAAc,CAAC,aAAa,CAAC;KAC/C,KAAK,CAAC,KAAK,IAAI,EAAE;IAChB,OAAO,QAAQ,CAAC,MAAM,CAAA;AACxB,CAAC,CAAC;KACD,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;IACrB,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;AAC1B,CAAC,CAAC,CAAA"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=GarageDoorOpener_accessory.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"GarageDoorOpener_accessory.d.ts","sourceRoot":"","sources":["../../src/accessories/GarageDoorOpener_accessory.ts"],"names":[],"mappings":""}
@@ -1,76 +0,0 @@
1
- import { Accessory, Characteristic, Service, uuid, } from '../index.js';
2
- const FAKE_GARAGE = {
3
- opened: false,
4
- open: () => {
5
- console.log('Opening the Garage!');
6
- // add your code here which allows the garage to open
7
- FAKE_GARAGE.opened = true;
8
- },
9
- close: () => {
10
- console.log('Closing the Garage!');
11
- // add your code here which allows the garage to close
12
- FAKE_GARAGE.opened = false;
13
- },
14
- identify: () => {
15
- // add your code here which allows the garage to be identified
16
- console.log('Identify the Garage');
17
- },
18
- status: () => {
19
- // use this section to get sensor values. set the boolean FAKE_GARAGE.opened with a sensor value.
20
- console.log('Sensor queried!');
21
- // FAKE_GARAGE.opened = true/false;
22
- },
23
- };
24
- const garageUUID = uuid.generate('hap-nodejs:accessories:' + 'GarageDoor');
25
- const garage = exports.accessory = new Accessory('Garage Door', garageUUID);
26
- // Add properties for publishing (in case we're using Core.js and not BridgedCore.js)
27
- // @ts-expect-error: Core/BridgeCore API
28
- garage.username = 'C1:5D:3F:EE:5E:FA'; // edit this if you use Core.js
29
- // @ts-expect-error: Core/BridgeCore API
30
- garage.pincode = '031-45-154';
31
- garage.category = 4 /* Categories.GARAGE_DOOR_OPENER */;
32
- garage
33
- .getService(Service.AccessoryInformation)
34
- .setCharacteristic(Characteristic.Manufacturer, 'Liftmaster')
35
- .setCharacteristic(Characteristic.Model, 'Rev-1')
36
- .setCharacteristic(Characteristic.SerialNumber, 'TW000165');
37
- garage.on("identify" /* AccessoryEventTypes.IDENTIFY */, (paired, callback) => {
38
- FAKE_GARAGE.identify();
39
- callback();
40
- });
41
- garage
42
- .addService(Service.GarageDoorOpener, 'Garage Door')
43
- .setCharacteristic(Characteristic.TargetDoorState, Characteristic.TargetDoorState.CLOSED) // force initial state to CLOSED
44
- .getCharacteristic(Characteristic.TargetDoorState)
45
- .on("set" /* CharacteristicEventTypes.SET */, (value, callback) => {
46
- if (value === Characteristic.TargetDoorState.CLOSED) {
47
- FAKE_GARAGE.close();
48
- callback();
49
- garage
50
- .getService(Service.GarageDoorOpener)
51
- .setCharacteristic(Characteristic.CurrentDoorState, Characteristic.CurrentDoorState.CLOSED);
52
- }
53
- else if (value === Characteristic.TargetDoorState.OPEN) {
54
- FAKE_GARAGE.open();
55
- callback();
56
- garage
57
- .getService(Service.GarageDoorOpener)
58
- .setCharacteristic(Characteristic.CurrentDoorState, Characteristic.CurrentDoorState.OPEN);
59
- }
60
- });
61
- garage
62
- .getService(Service.GarageDoorOpener)
63
- .getCharacteristic(Characteristic.CurrentDoorState)
64
- .on("get" /* CharacteristicEventTypes.GET */, (callback) => {
65
- const err = null;
66
- FAKE_GARAGE.status();
67
- if (FAKE_GARAGE.opened) {
68
- console.log('Query: Is Garage Open? Yes.');
69
- callback(err, Characteristic.CurrentDoorState.OPEN);
70
- }
71
- else {
72
- console.log('Query: Is Garage Open? No.');
73
- callback(err, Characteristic.CurrentDoorState.CLOSED);
74
- }
75
- });
76
- //# sourceMappingURL=GarageDoorOpener_accessory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"GarageDoorOpener_accessory.js","sourceRoot":"","sources":["../../src/accessories/GarageDoorOpener_accessory.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAGT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,EAAE,CAAA;IAEpB,IAAI,WAAW,CAAC,MAAM,EAAE,CAAC;QACvB,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAA;QAC1C,QAAQ,CAAC,GAAG,EAAE,cAAc,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAA;IACrD,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAA;QACzC,QAAQ,CAAC,GAAG,EAAE,cAAc,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAA;IACvD,CAAC;AACH,CAAC,CAAC,CAAA"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=Light-AdaptiveLighting_accessory.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Light-AdaptiveLighting_accessory.d.ts","sourceRoot":"","sources":["../../src/accessories/Light-AdaptiveLighting_accessory.ts"],"names":[],"mappings":""}
@@ -1,103 +0,0 @@
1
- import util from 'node:util';
2
- import { Accessory, AdaptiveLightingController, Characteristic, ColorUtils, Service, uuid, } from '../index.js';
3
- /**
4
- * This example light gives an example how a light with AdaptiveLighting (in AUTOMATIC mode) support
5
- * can look like.
6
- * This example not only exposes the ColorTemperature characteristic but also shows how
7
- * ColorTemperature and Hue/Saturation characteristics can be combined on a Lightbulb service.
8
- *
9
- * The example also uses the new Promise based onGet and onSet handlers instead of the "old"
10
- * SET/GET event handlers.
11
- *
12
- * AdaptiveLighting setup is pretty much at the end of the file, don't miss it.
13
- */
14
- const lightUUID = uuid.generate('hap-nodejs:accessories:light-adaptive-lighting');
15
- const accessory = exports.accessory = new Accessory('Light Example', lightUUID);
16
- // this section stores the basic state of the lightbulb
17
- let on = false;
18
- let brightness = 100;
19
- let colorTemperature = 140; // 140 is the lowest color temperature in mired as by the HAP spec (you can lower the minimum though)
20
- let hue = 0; // we start with white color
21
- let saturation = 0;
22
- // Add properties for publishing (in case we're using Core.js and not BridgedCore.js)
23
- // @ts-expect-error: Core/BridgeCore API
24
- accessory.username = 'AA:BB:CC:DD:EE:FF';
25
- // @ts-expect-error: Core/BridgeCore API
26
- accessory.pincode = '031-45-154';
27
- accessory.category = 5 /* Categories.LIGHTBULB */;
28
- accessory.getService(Service.AccessoryInformation)
29
- .setCharacteristic(Characteristic.Manufacturer, 'HAP-NodeJS')
30
- .setCharacteristic(Characteristic.Model, 'Light with AdaptiveLighting')
31
- .setCharacteristic(Characteristic.FirmwareRevision, '1.0.0');
32
- const lightbulbService = accessory.addService(Service.Lightbulb, 'Light Example');
33
- lightbulbService.getCharacteristic(Characteristic.On)
34
- .onGet(() => {
35
- console.log(`Light power is currently ${on}`);
36
- return on;
37
- })
38
- .onSet((value) => {
39
- console.log(`Light power was turn to ${on}`);
40
- on = value;
41
- });
42
- lightbulbService.getCharacteristic(Characteristic.Brightness) // Brightness characteristic is required for adaptive lighting
43
- .updateValue(brightness) // ensure default value is set
44
- .onGet(() => {
45
- console.log(`Light brightness is currently ${brightness}`);
46
- return brightness;
47
- })
48
- .onSet((value) => {
49
- console.log(`Light brightness was set to ${value}%`);
50
- brightness = value;
51
- });
52
- lightbulbService.getCharacteristic(Characteristic.ColorTemperature) // ColorTemperature characteristic is required for adaptive lighting
53
- .onGet(() => {
54
- console.log(`Light color temperature is currently ${colorTemperature}`);
55
- return colorTemperature;
56
- })
57
- .onSet((value) => {
58
- console.log(`Light color temperature was set to ${value}`);
59
- colorTemperature = value;
60
- // following statements are only needed when using ColorTemperature characteristic in combination with Hue/Saturation
61
- const color = ColorUtils.colorTemperatureToHueAndSaturation(colorTemperature);
62
- // save internal values for read handlers
63
- hue = color.hue;
64
- saturation = color.saturation;
65
- // and notify HomeKit devices about changed values
66
- lightbulbService.getCharacteristic(Characteristic.Hue).updateValue(hue);
67
- lightbulbService.getCharacteristic(Characteristic.Saturation).updateValue(saturation);
68
- });
69
- lightbulbService.getCharacteristic(Characteristic.Hue)
70
- .onGet(() => {
71
- console.log(`Light hue is currently ${hue}`);
72
- return hue;
73
- })
74
- .onSet((value) => {
75
- console.log(`Light hue was set to ${value}`);
76
- hue = value;
77
- colorTemperature = 140; // setting color temperature to lowest possible value
78
- });
79
- lightbulbService.getCharacteristic(Characteristic.Saturation)
80
- .onGet(() => {
81
- console.log(`Light saturation is currently ${saturation}`);
82
- return saturation;
83
- })
84
- .onSet((value) => {
85
- console.log(`Light saturation was set to ${value}`);
86
- saturation = value;
87
- colorTemperature = 140; // setting color temperature to lowest possible value
88
- });
89
- const adaptiveLightingController = new AdaptiveLightingController(lightbulbService, {
90
- // options object is optional, default mode is AUTOMATIC, can be set to MANUAL to do transitions yourself
91
- // look into the docs for more information
92
- controllerMode: 1 /* AdaptiveLightingControllerMode.AUTOMATIC */,
93
- });
94
- // Requires AdaptiveLightingControllerMode.MANUAL to be set as a controllerMode
95
- adaptiveLightingController.on('update', () => {
96
- console.log('Adaptive Lighting updated');
97
- }).on('update', (update) => {
98
- console.log(`Adaptive Lighting schedule updated to ${util.inspect(update)}`);
99
- }).on('disable', () => {
100
- console.log('Adaptive Lighting disabled');
101
- });
102
- accessory.configureController(adaptiveLightingController);
103
- //# sourceMappingURL=Light-AdaptiveLighting_accessory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Light-AdaptiveLighting_accessory.js","sourceRoot":"","sources":["../../src/accessories/Light-AdaptiveLighting_accessory.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B,OAAO,EACL,SAAS,EACT,0BAA0B,EAG1B,cAAc,EACd,UAAU,EACV,OAAO,EACP,IAAI,GACL,MAAM,aAAa,CAAA;AAEpB;;;;;;;;;;GAUG;AAEH,MAAM,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC,gDAAgD,CAAC,CAAA;AACjF,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,SAAS,CAAC,eAAe,EAAE,SAAS,CAAC,CAAA;AAE/E,uDAAuD;AACvD,IAAI,EAAE,GAAG,KAAK,CAAA;AACd,IAAI,UAA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version":3,"file":"Light_accessory.d.ts","sourceRoot":"","sources":["../../src/accessories/Light_accessory.ts"],"names":[],"mappings":""}
@@ -1,143 +0,0 @@
1
- import { Accessory, Characteristic, Service, uuid, } from '../index.js';
2
- class LightControllerClass {
3
- name = 'Simple Light'; // name of accessory
4
- pincode = '031-45-154';
5
- username = 'FA:3C:ED:5A:1A:1A'; // MAC like address used by HomeKit to differentiate accessories.
6
- manufacturer = 'HAP-NodeJS'; // manufacturer (optional)
7
- model = 'v1.0'; // model (optional)
8
- serialNumber = 'A12S345KGB'; // serial number (optional)
9
- power = false; // current power status
10
- brightness = 100; // current brightness
11
- hue = 0; // current hue
12
- saturation = 0; // current saturation
13
- outputLogs = true; // output logs
14
- setPower(status) {
15
- if (this.outputLogs) {
16
- console.log('Turning the \'%s\' %s', this.name, status ? 'on' : 'off');
17
- }
18
- this.power = status;
19
- }
20
- getPower() {
21
- if (this.outputLogs) {
22
- console.log('\'%s\' is %s.', this.name, this.power ? 'on' : 'off');
23
- }
24
- return this.power;
25
- }
26
- setBrightness(brightness) {
27
- if (this.outputLogs) {
28
- console.log('Setting \'%s\' brightness to %s', this.name, brightness);
29
- }
30
- this.brightness = brightness;
31
- }
32
- getBrightness() {
33
- if (this.outputLogs) {
34
- console.log('\'%s\' brightness is %s', this.name, this.brightness);
35
- }
36
- return this.brightness;
37
- }
38
- setSaturation(saturation) {
39
- if (this.outputLogs) {
40
- console.log('Setting \'%s\' saturation to %s', this.name, saturation);
41
- }
42
- this.saturation = saturation;
43
- }
44
- getSaturation() {
45
- if (this.outputLogs) {
46
- console.log('\'%s\' saturation is %s', this.name, this.saturation);
47
- }
48
- return this.saturation;
49
- }
50
- setHue(hue) {
51
- if (this.outputLogs) {
52
- console.log('Setting \'%s\' hue to %s', this.name, hue);
53
- }
54
- this.hue = hue;
55
- }
56
- getHue() {
57
- if (this.outputLogs) {
58
- console.log('\'%s\' hue is %s', this.name, this.hue);
59
- }
60
- return this.hue;
61
- }
62
- identify() {
63
- if (this.outputLogs) {
64
- console.log('Identify the \'%s\'', this.name);
65
- }
66
- }
67
- }
68
- const LightController = new LightControllerClass();
69
- // Generate a consistent UUID for our light Accessory that will remain the same even when
70
- // restarting our server. We use the `uuid.generate` helper function to create a deterministic
71
- // UUID based on an arbitrary "namespace" and the word "light".
72
- const lightUUID = uuid.generate(`hap-nodejs:accessories:light${LightController.name}`);
73
- // This is the Accessory that we'll return to HAP-NodeJS that represents our light.
74
- const lightAccessory = exports.accessory = new Accessory(LightController.name, lightUUID);
75
- // Add properties for publishing (in case we're using Core.js and not BridgedCore.js)
76
- // @ts-expect-error: Core/BridgeCore API
77
- lightAccessory.username = LightController.username;
78
- // @ts-expect-error: Core/BridgeCore API
79
- lightAccessory.pincode = LightController.pincode;
80
- lightAccessory.category = 5 /* Categories.LIGHTBULB */;
81
- // set some basic properties (these values are arbitrary and setting them is optional)
82
- lightAccessory
83
- .getService(Service.AccessoryInformation)
84
- .setCharacteristic(Characteristic.Manufacturer, LightController.manufacturer)
85
- .setCharacteristic(Characteristic.Model, LightController.model)
86
- .setCharacteristic(Characteristic.SerialNumber, LightController.serialNumber);
87
- // listen for the "identify" event for this Accessory
88
- lightAccessory.on("identify" /* AccessoryEventTypes.IDENTIFY */, (paired, callback) => {
89
- LightController.identify();
90
- callback();
91
- });
92
- // services exposed to the user should have "names" like "Light" for this case
93
- const lightbulb = lightAccessory.addService(Service.Lightbulb, LightController.name);
94
- lightbulb.getCharacteristic(Characteristic.On)
95
- .on("set" /* CharacteristicEventTypes.SET */, (value, callback) => {
96
- LightController.setPower(value);
97
- // Our light is synchronous - this value has been successfully set
98
- // Invoke the callback when you finished processing the request
99
- // If it's going to take more than 1s to finish the request, try to invoke the callback
100
- // after getting the request instead of after finishing it. This avoids blocking other
101
- // requests from HomeKit.
102
- callback();
103
- })
104
- // We want to intercept requests for our current power state, so we can query the hardware itself instead of
105
- // allowing HAP-NodeJS to return the cached Characteristic.value.
106
- .on("get" /* CharacteristicEventTypes.GET */, (callback) => {
107
- callback(null, LightController.getPower());
108
- });
109
- // To inform HomeKit about changes occurred outside of HomeKit (like user physically turn on the light)
110
- // Please use Characteristic.updateValue
111
- //
112
- // lightAccessory
113
- // .getService(Service.Lightbulb)
114
- // .getCharacteristic(Characteristic.On)
115
- // .updateValue(true);
116
- // also add an "optional" Characteristic for Brightness
117
- lightbulb.addCharacteristic(Characteristic.Brightness)
118
- .on("set" /* CharacteristicEventTypes.SET */, (value, callback) => {
119
- LightController.setBrightness(value);
120
- callback();
121
- })
122
- .on("get" /* CharacteristicEventTypes.GET */, (callback) => {
123
- callback(null, LightController.getBrightness());
124
- });
125
- // also add an "optional" Characteristic for Saturation
126
- lightbulb.addCharacteristic(Characteristic.Saturation)
127
- .on("set" /* CharacteristicEventTypes.SET */, (value, callback) => {
128
- LightController.setSaturation(value);
129
- callback();
130
- })
131
- .on("get" /* CharacteristicEventTypes.GET */, (callback) => {
132
- callback(null, LightController.getSaturation());
133
- });
134
- // also add an "optional" Characteristic for Hue
135
- lightbulb.addCharacteristic(Characteristic.Hue)
136
- .on("set" /* CharacteristicEventTypes.SET */, (value, callback) => {
137
- LightController.setHue(value);
138
- callback();
139
- })
140
- .on("get" /* CharacteristicEventTypes.GET */, (callback) => {
141
- callback(null, LightController.getHue());
142
- });
143
- //# sourceMappingURL=Light_accessory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Light_accessory.js","sourceRoot":"","sources":["../../src/accessories/Light_accessory.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAGT,cAAc,EAKd,OAAO,EACP,IAAI,GAEL,MAAM,aAAa,CAAA;AAEpB,MAAM,oBAAoB;IACxB,IAAI,GAAG,cAAc,CAAA,CAAC,oBAAoB;IAC1C,OAAO,GAAwB,YAAY,CAAA;IAC3C,QAAQ,GAAwB,mBAAmB,CAAA,CAAC,iEAAiE;IACrH,YAAY,GAAwB,YAAY,CAAA,CAAC,0BAA0B;IAC3E,KAAK,GAAwB,MAAM,CAAA,CAAC,m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AE,CAAC,CAAA;AAC1C,CAAC,CAAC,CAAA"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=Lock_accessory.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Lock_accessory.d.ts","sourceRoot":"","sources":["../../src/accessories/Lock_accessory.ts"],"names":[],"mappings":""}
@@ -1,74 +0,0 @@
1
- import { Accessory, Characteristic, Service, uuid, } from '../index.js';
2
- // here's a fake hardware device that we'll expose to HomeKit
3
- const FAKE_LOCK = {
4
- locked: false,
5
- lock: () => {
6
- console.log('Locking the lock!');
7
- FAKE_LOCK.locked = true;
8
- },
9
- unlock: () => {
10
- console.log('Unlocking the lock!');
11
- FAKE_LOCK.locked = false;
12
- },
13
- identify: () => {
14
- console.log('Identify the lock!');
15
- },
16
- };
17
- // Generate a consistent UUID for our Lock Accessory that will remain the same even when
18
- // restarting our server. We use the `uuid.generate` helper function to create a deterministic
19
- // UUID based on an arbitrary "namespace" and the word "lock".
20
- const lockUUID = uuid.generate('hap-nodejs:accessories:lock');
21
- // This is the Accessory that we'll return to HAP-NodeJS that represents our fake lock.
22
- const lock = exports.accessory = new Accessory('Lock', lockUUID);
23
- // Add properties for publishing (in case we're using Core.js and not BridgedCore.js)
24
- // @ts-expect-error: Core/BridgeCore API
25
- lock.username = 'C1:5D:3A:EE:5E:FA';
26
- // @ts-expect-error: Core/BridgeCore API
27
- lock.pincode = '031-45-154';
28
- lock.category = 6 /* Categories.DOOR_LOCK */;
29
- // set some basic properties (these values are arbitrary and setting them is optional)
30
- lock
31
- .getService(Service.AccessoryInformation)
32
- .setCharacteristic(Characteristic.Manufacturer, 'Lock Manufacturer')
33
- .setCharacteristic(Characteristic.Model, 'Rev-2')
34
- .setCharacteristic(Characteristic.SerialNumber, 'MY-Serial-Number');
35
- // listen for the "identify" event for this Accessory
36
- lock.on("identify" /* AccessoryEventTypes.IDENTIFY */, (paired, callback) => {
37
- FAKE_LOCK.identify();
38
- callback(); // success
39
- });
40
- const service = new Service.LockMechanism('Fake Lock');
41
- // Add the actual Door Lock Service and listen for change events from iOS.
42
- service.getCharacteristic(Characteristic.LockTargetState)
43
- .on("set" /* CharacteristicEventTypes.SET */, (value, callback) => {
44
- if (value === Characteristic.LockTargetState.UNSECURED) {
45
- FAKE_LOCK.unlock();
46
- callback(); // Our fake Lock is synchronous - this value has been successfully set
47
- // now we want to set our lock's "actual state" to be unsecured so it shows as unlocked in iOS apps
48
- service.updateCharacteristic(Characteristic.LockCurrentState, Characteristic.LockCurrentState.UNSECURED);
49
- }
50
- else if (value === Characteristic.LockTargetState.SECURED) {
51
- FAKE_LOCK.lock();
52
- callback(); // Our fake Lock is synchronous - this value has been successfully set
53
- // now we want to set our lock's "actual state" to be locked so it shows as open in iOS apps
54
- service.updateCharacteristic(Characteristic.LockCurrentState, Characteristic.LockCurrentState.SECURED);
55
- }
56
- });
57
- // We want to intercept requests for our current state so we can query the hardware itself instead of
58
- // allowing HAP-NodeJS to return the cached Characteristic.value.
59
- service.getCharacteristic(Characteristic.LockCurrentState)
60
- .on("get" /* CharacteristicEventTypes.GET */, (callback) => {
61
- // this event is emitted when you ask Siri directly whether your lock is locked or not. you might query
62
- // the lock hardware itself to find this out, then call the callback. But if you take longer than a
63
- // few seconds to respond, Siri will give up.
64
- if (FAKE_LOCK.locked) {
65
- console.log('Are we locked? Yes.');
66
- callback(undefined, Characteristic.LockCurrentState.SECURED);
67
- }
68
- else {
69
- console.log('Are we locked? No.');
70
- callback(undefined, Characteristic.LockCurrentState.UNSECURED);
71
- }
72
- });
73
- lock.addService(service);
74
- //# sourceMappingURL=Lock_accessory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Lock_accessory.js","sourceRoot":"","sources":["../../src/accessories/Lock_accessory.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAGT,cAAc,EAEd,OAAO,EACP,IAAI,GACL,MAAM,aAAa,CAAA;AAEpB,6DAA6D;AAC7D,MAAM,SAAS,GAAG;IAChB,MAAM,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gB,CAAC,SAAS,CAAC,CAAA;IAChE,CAAC;AACH,CAAC,CAAC,CAAA;AAEJ,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAA"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=MotionSensor_accessory.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MotionSensor_accessory.d.ts","sourceRoot":"","sources":["../../src/accessories/MotionSensor_accessory.ts"],"names":[],"mappings":""}
@@ -1,43 +0,0 @@
1
- // here's a fake hardware device that we'll expose to HomeKit
2
- import { Accessory, Characteristic, Service, uuid, } from '../index.js';
3
- const MOTION_SENSOR = {
4
- motionDetected: false,
5
- getStatus: () => {
6
- // set the boolean here, this will be returned to the device
7
- MOTION_SENSOR.motionDetected = false;
8
- },
9
- identify: () => {
10
- console.log('Identify the motion sensor!');
11
- },
12
- };
13
- // Generate a consistent UUID for our Motion Sensor Accessory that will remain the same even when
14
- // restarting our server. We use the `uuid.generate` helper function to create a deterministic
15
- // UUID based on an arbitrary "namespace" and the word "motionsensor".
16
- const motionSensorUUID = uuid.generate('hap-nodejs:accessories:motionsensor');
17
- // This is the Accessory that we'll return to HAP-NodeJS that represents our fake motionSensor.
18
- const motionSensor = exports.accessory = new Accessory('Motion Sensor', motionSensorUUID);
19
- // Add properties for publishing (in case we're using Core.js and not BridgedCore.js)
20
- // @ts-expect-error: Core/BridgeCore API
21
- motionSensor.username = '1A:2B:3D:4D:2E:AF';
22
- // @ts-expect-error: Core/BridgeCore API
23
- motionSensor.pincode = '031-45-154';
24
- motionSensor.category = 10 /* Categories.SENSOR */;
25
- // set some basic properties (these values are arbitrary and setting them is optional)
26
- motionSensor
27
- .getService(Service.AccessoryInformation)
28
- .setCharacteristic(Characteristic.Manufacturer, 'Oltica')
29
- .setCharacteristic(Characteristic.Model, 'Rev-1')
30
- .setCharacteristic(Characteristic.SerialNumber, 'A1S2NASF88EW');
31
- // listen for the "identify" event for this Accessory
32
- motionSensor.on("identify" /* AccessoryEventTypes.IDENTIFY */, (paired, callback) => {
33
- MOTION_SENSOR.identify();
34
- callback(); // success
35
- });
36
- motionSensor
37
- .addService(Service.MotionSensor, 'Fake Motion Sensor') // services exposed to the user should have "names" like "Fake Motion Sensor" for us
38
- .getCharacteristic(Characteristic.MotionDetected)
39
- .on("get" /* CharacteristicEventTypes.GET */, (callback) => {
40
- MOTION_SENSOR.getStatus();
41
- callback(null, Boolean(MOTION_SENSOR.motionDetected));
42
- });
43
- //# sourceMappingURL=MotionSensor_accessory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MotionSensor_accessory.js","sourceRoot":"","sources":["../../src/accessories/MotionSensor_accessory.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,OAAO,EACL,SAAS,EAGT,cAAc,EAId,OAAO,EACP,IAAI,GACL,MAAM,aAAa,CAAA;AAEpB,MAAM,aAAa,GAAG;IACpB,cAAc,EAAE,KAAK;IAErB,SAAS,EAAE,GAAG,EAAE;QACd,4DAA4D;QAC5D,aAAa,CAAC,cAAc,GAAG,KAAK,CAAA;IACtC,CAAC;IACD,QAAQ,EAAE,GAAG,EAAE;QACb,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAA;IAC5C,CAAC;CACF,CAAA;AAED,iGAAiG;AACjG,8FAA8F;AAC9F,sEAAsE;AACtE,MAAM,gBAAgB,GAAG,IAAI,CAAC,QAAQ,CAAC,qCAAqC,CAAC,CAAA;AAE7E,+FAA+F;AAC/F,MAAM,YAAY,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,SAAS,CAAC,eAAe,EAAE,gBAAgB,CAAC,CAAA;AAEzF,qFAAqF;AACrF,wCAAwC;AACxC,YAAY,CAAC,QAAQ,GAAG,mBAAmB,CAAA;AAC3C,wCAAwC;AACxC,YAAY,CAAC,OAAO,GAAG,YAAY,CAAA;AACnC,YAAY,CAAC,QAAQ,6BAAoB,CAAA;AAEzC,sFAAsF;AACtF,YAAY;KACT,UAAU,CAAC,OAAO,CAAC,oBAAoB,CAAE;KACzC,iBAAiB,CAAC,cAAc,CAAC,YAAY,EAAE,QAAQ,CAAC;KACxD,iBAAiB,CAAC,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC;KAChD,iBAAiB,CAAC,cAAc,CAAC,YAAY,EAAE,cAAc,CAAC,CAAA;AAEjE,qDAAqD;AACrD,YAAY,CAAC,EAAE,gDAA+B,CAAC,MAAe,EAAE,QAAsB,EAAE,EAAE;IACxF,aAAa,CAAC,QAAQ,EAAE,CAAA;IACxB,QAAQ,EAAE,CAAA,CAAC,UAAU;AACvB,CAAC,CAAC,CAAA;AAEF,YAAY;KACT,UAAU,CAAC,OAAO,CAAC,YAAY,EAAE,oBAAoB,CAAC,CAAC,oFAAoF;KAC3I,iBAAiB,CAAC,cAAc,CAAC,cAAc,CAAE;KACjD,EAAE,2CAA+B,CAAC,QAA2C,EAAE,EAAE;IAChF,aAAa,CAAC,SAAS,EAAE,CAAA;IACzB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC,CAAA;AACvD,CAAC,CAAC,CAAA"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=Outlet_accessory.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Outlet_accessory.d.ts","sourceRoot":"","sources":["../../src/accessories/Outlet_accessory.ts"],"names":[],"mappings":""}
@@ -1,77 +0,0 @@
1
- import { Accessory, Characteristic, Service, uuid, } from '../index.js';
2
- const err = null; // in case there were any problems
3
- // here's a fake hardware device that we'll expose to HomeKit
4
- const FAKE_OUTLET = {
5
- powerOn: false,
6
- setPowerOn: (on) => {
7
- console.log('Turning the outlet %s!...', on ? 'on' : 'off');
8
- if (on) {
9
- FAKE_OUTLET.powerOn = true;
10
- if (err) {
11
- return console.log(err);
12
- }
13
- console.log('...outlet is now on.');
14
- }
15
- else {
16
- FAKE_OUTLET.powerOn = false;
17
- if (err) {
18
- return console.log(err);
19
- }
20
- console.log('...outlet is now off.');
21
- }
22
- },
23
- identify() {
24
- console.log('Identify the outlet.');
25
- },
26
- };
27
- // Generate a consistent UUID for our outlet Accessory that will remain the same even when
28
- // restarting our server. We use the `uuid.generate` helper function to create a deterministic
29
- // UUID based on an arbitrary "namespace" and the accessory name.
30
- const outletUUID = uuid.generate('hap-nodejs:accessories:Outlet');
31
- // This is the Accessory that we'll return to HAP-NodeJS that represents our fake light.
32
- const outlet = exports.accessory = new Accessory('Outlet', outletUUID);
33
- // Add properties for publishing (in case we're using Core.js and not BridgedCore.js)
34
- // @ts-expect-error: Core/BridgeCore API
35
- outlet.username = '1A:2B:3C:4D:5D:FF';
36
- // @ts-expect-error: Core/BridgeCore API
37
- outlet.pincode = '031-45-154';
38
- outlet.category = 7 /* Categories.OUTLET */;
39
- // set some basic properties (these values are arbitrary and setting them is optional)
40
- outlet
41
- .getService(Service.AccessoryInformation)
42
- .setCharacteristic(Characteristic.Manufacturer, 'Oltica')
43
- .setCharacteristic(Characteristic.Model, 'Rev-1')
44
- .setCharacteristic(Characteristic.SerialNumber, 'A1S2NASF88EW');
45
- // listen for the "identify" event for this Accessory
46
- outlet.on("identify" /* AccessoryEventTypes.IDENTIFY */, (paired, callback) => {
47
- FAKE_OUTLET.identify();
48
- callback(); // success
49
- });
50
- // Add the actual outlet Service and listen for change events from iOS.
51
- outlet
52
- .addService(Service.Outlet, 'Fake Outlet') // services exposed to the user should have "names" like "Fake Light" for us
53
- .getCharacteristic(Characteristic.On)
54
- .on("set" /* CharacteristicEventTypes.SET */, (value, callback) => {
55
- FAKE_OUTLET.setPowerOn(value);
56
- callback(); // Our fake Outlet is synchronous - this value has been successfully set
57
- });
58
- // We want to intercept requests for our current power state so we can query the hardware itself instead of
59
- // allowing HAP-NodeJS to return the cached Characteristic.value.
60
- outlet
61
- .getService(Service.Outlet)
62
- .getCharacteristic(Characteristic.On)
63
- .on("get" /* CharacteristicEventTypes.GET */, (callback) => {
64
- // this event is emitted when you ask Siri directly whether your light is on or not. you might query
65
- // the light hardware itself to find this out, then call the callback. But if you take longer than a
66
- // few seconds to respond, Siri will give up.
67
- const err = null; // in case there were any problems
68
- if (FAKE_OUTLET.powerOn) {
69
- console.log('Are we on? Yes.');
70
- callback(err, true);
71
- }
72
- else {
73
- console.log('Are we on? No.');
74
- callback(err, false);
75
- }
76
- });
77
- //# sourceMappingURL=Outlet_accessory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Outlet_accessory.js","sourceRoot":"","sources":["../../src/accessories/Outlet_accessory.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAGT,cAAc,EAGd,OAAO,EACP,IAAI,GAEL,MAAM,aAAa,CAAA;AAGpB,MAAM,GAAG,GAAoB,IAAI,CAAA,CAAC,kCAAkC;AAEpE,6DAA6D;AAC7D,MAAM,WAAW,GAAG;IAClB,OAAO,EAAE,KAAK;IACd,UAAU,EAAE,CAAC,EAAuB,EAAE,EAAE;QACtC,OAAO,CAAC,GAAG,CAAC,2BAA2B,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;QAC3D,IAAI,EAAE,EAAE,CAAC;YACP,WAAW,CAAC,OAAO,GAAG,IAAI,CAAA;YAC1B,IAAI,GAAG,EAAE,CAAC;gBACR,OAAO,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;YACzB,CAAC;YACD,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAA;QACrC,CAAC;aAAM,CAAC;YACN,WAAW,CAAC,OAAO,GAAG,KAAK,CAAA;YAC3B,IAAI,GAAG,EAAE,CAAC;gBACR,OAAO,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;YACzB,CAAC;YACD,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAA;QACtC,CAAC;IACH,CAAC;IACD,QAAQ;QACN,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAA;IACrC,CAAC;CACF,CAAA;AA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iBAAiB,CAAC,cAAc,CAAC,EAAE,CAAE;KACrC,EAAE,2CAA+B,CAAC,QAA2C,EAAE,EAAE;IAChF,oGAAoG;IACpG,oGAAoG;IACpG,6CAA6C;IAE7C,MAAM,GAAG,GAAG,IAAI,CAAA,CAAC,kCAAkC;IAEnD,IAAI,WAAW,CAAC,OAAO,EAAE,CAAC;QACxB,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAA;QAC9B,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;IACrB,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAA;QAC7B,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;IACtB,CAAC;AACH,CAAC,CAAC,CAAA"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=SmartSpeaker_accessory.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SmartSpeaker_accessory.d.ts","sourceRoot":"","sources":["../../src/accessories/SmartSpeaker_accessory.ts"],"names":[],"mappings":""}