node-red-contrib-homekit-bridged 2.0.0-dev.5 → 2.0.0-dev.7

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 (128) hide show
  1. package/build/lib/HAPHostNode.js +183 -141
  2. package/build/lib/HAPServiceNode.js +199 -172
  3. package/build/lib/HAPServiceNode2.js +207 -172
  4. package/build/lib/NRCHKBError.js +23 -2
  5. package/build/lib/PairingQRCode.js +62 -0
  6. package/build/lib/Storage.js +157 -92
  7. package/build/lib/api.js +654 -288
  8. package/build/lib/camera/CameraControl.js +119 -84
  9. package/build/lib/camera/CameraDelegate.js +481 -404
  10. package/build/lib/camera/MP4StreamingServer.js +148 -139
  11. package/build/lib/hap/HAPCharacteristic.js +25 -4
  12. package/build/lib/hap/HAPService.js +25 -4
  13. package/build/lib/hap/eve-app/EveCharacteristics.js +124 -81
  14. package/build/lib/hap/eve-app/EveServices.js +50 -17
  15. package/build/lib/hap/hap-nodejs.js +32 -0
  16. package/build/lib/migration/HomeKitService2Migration.js +34 -0
  17. package/build/lib/migration/NodeMigration.js +75 -0
  18. package/build/lib/types/AccessoryInformationType.js +15 -1
  19. package/build/lib/types/CameraConfigType.js +15 -1
  20. package/build/lib/types/CustomCharacteristicType.js +15 -1
  21. package/build/lib/types/HAPHostConfigType.js +15 -1
  22. package/build/lib/types/HAPHostNodeType.js +15 -1
  23. package/build/lib/types/HAPService2ConfigType.js +15 -1
  24. package/build/lib/types/HAPService2NodeType.js +15 -1
  25. package/build/lib/types/HAPServiceConfigType.js +15 -1
  26. package/build/lib/types/HAPServiceNodeType.js +15 -1
  27. package/build/lib/types/HAPStatusConfigType.js +15 -1
  28. package/build/lib/types/HAPStatusNodeType.js +15 -1
  29. package/build/lib/types/HostType.js +28 -7
  30. package/build/lib/types/NodeType.js +15 -1
  31. package/build/lib/types/PublishTimersType.js +15 -1
  32. package/build/lib/types/UniFiControllerConfigType.js +16 -0
  33. package/build/lib/types/hap-nodejs/HapAdaptiveLightingControllerMode.js +28 -7
  34. package/build/lib/types/hap-nodejs/HapCategories.js +64 -43
  35. package/build/lib/types/storage/SerializedHostType.js +15 -1
  36. package/build/lib/types/storage/StorageType.js +34 -10
  37. package/build/lib/unifi/ProtectDiscovery.js +80 -0
  38. package/build/lib/utils/AccessoryUtils.js +152 -110
  39. package/build/lib/utils/BridgeUtils.js +82 -39
  40. package/build/lib/utils/CharacteristicUtils.js +5 -49
  41. package/build/lib/utils/CharacteristicUtils2.js +5 -49
  42. package/build/lib/utils/CharacteristicUtilsBase.js +81 -0
  43. package/build/lib/utils/NodeStatusUtils.js +89 -40
  44. package/build/lib/utils/ServiceUtils.js +434 -375
  45. package/build/lib/utils/ServiceUtils2.js +514 -309
  46. package/build/lib/utils/index.js +10 -11
  47. package/build/nodes/bridge.html +184 -166
  48. package/build/nodes/bridge.js +27 -9
  49. package/build/nodes/locales/en-US/node-red-contrib-homekit-bridged.json +22 -0
  50. package/build/nodes/nrchkb.html +1601 -88
  51. package/build/nodes/nrchkb.js +66 -88
  52. package/build/nodes/plugin-instance.html +499 -0
  53. package/build/nodes/plugin-instance.js +46 -0
  54. package/build/nodes/service.html +517 -299
  55. package/build/nodes/service.js +5 -6
  56. package/build/nodes/service2.html +1683 -460
  57. package/build/nodes/service2.js +5 -8
  58. package/build/nodes/standalone.html +187 -174
  59. package/build/nodes/standalone.js +27 -9
  60. package/build/nodes/status.html +51 -18
  61. package/build/nodes/status.js +47 -40
  62. package/build/nodes/unifi-controller.html +92 -0
  63. package/build/nodes/unifi-controller.js +20 -0
  64. package/build/plugins/embedded/homebridge-camera-ffmpeg/index.js +479 -0
  65. package/build/plugins/embedded/homebridge-unifi-protect/index.js +521 -0
  66. package/build/plugins/embedded/index.js +58 -0
  67. package/build/plugins/nrchkb-homekit-plugins.js +17 -0
  68. package/build/plugins/registry/index.js +203 -0
  69. package/build/plugins/registry/types.js +16 -0
  70. package/build/scripts/migrate-homekit-service-flows.js +47 -0
  71. package/examples/demo/01 - ALL Demos single import.json +1885 -1885
  72. package/examples/demo/02 - Air Purifier.json +279 -279
  73. package/examples/demo/03 - Air Quality sensor with Battery.json +254 -254
  74. package/examples/demo/04 - Dimmable Bulb.json +172 -172
  75. package/examples/demo/05 - Color Bulb (HSV).json +195 -195
  76. package/examples/demo/06 - Fan (simple, 3 speeds).json +240 -240
  77. package/examples/demo/07 - Fan (with speed, oscillate, rotation direction).json +175 -175
  78. package/examples/demo/08 - CO2 detector.json +224 -224
  79. package/examples/demo/09 - CO (carbon monoxide) example.json +255 -255
  80. package/examples/demo/10 - Door window contact sensor.json +234 -234
  81. package/examples/demos (advanced)/01 - Television with inputs and speaker.json +541 -541
  82. package/examples/switch/01 - Plain Switch.json +178 -178
  83. package/package.json +95 -84
  84. package/build/lib/HAPHostNode.d.ts +0 -1
  85. package/build/lib/HAPServiceNode.d.ts +0 -1
  86. package/build/lib/HAPServiceNode2.d.ts +0 -1
  87. package/build/lib/NRCHKBError.d.ts +0 -3
  88. package/build/lib/Storage.d.ts +0 -30
  89. package/build/lib/api.d.ts +0 -1
  90. package/build/lib/camera/CameraControl.d.ts +0 -3
  91. package/build/lib/camera/CameraDelegate.d.ts +0 -38
  92. package/build/lib/camera/MP4StreamingServer.d.ts +0 -26
  93. package/build/lib/hap/HAPCharacteristic.d.ts +0 -9
  94. package/build/lib/hap/HAPService.d.ts +0 -6
  95. package/build/lib/hap/eve-app/EveCharacteristics.d.ts +0 -20
  96. package/build/lib/hap/eve-app/EveServices.d.ts +0 -5
  97. package/build/lib/types/AccessoryInformationType.d.ts +0 -11
  98. package/build/lib/types/CameraConfigType.d.ts +0 -24
  99. package/build/lib/types/CustomCharacteristicType.d.ts +0 -6
  100. package/build/lib/types/HAPHostConfigType.d.ts +0 -22
  101. package/build/lib/types/HAPHostNodeType.d.ts +0 -14
  102. package/build/lib/types/HAPService2ConfigType.d.ts +0 -6
  103. package/build/lib/types/HAPService2NodeType.d.ts +0 -7
  104. package/build/lib/types/HAPServiceConfigType.d.ts +0 -26
  105. package/build/lib/types/HAPServiceNodeType.d.ts +0 -38
  106. package/build/lib/types/HAPStatusConfigType.d.ts +0 -5
  107. package/build/lib/types/HAPStatusNodeType.d.ts +0 -12
  108. package/build/lib/types/HostType.d.ts +0 -5
  109. package/build/lib/types/NodeType.d.ts +0 -3
  110. package/build/lib/types/PublishTimersType.d.ts +0 -4
  111. package/build/lib/types/hap-nodejs/HapAdaptiveLightingControllerMode.d.ts +0 -5
  112. package/build/lib/types/hap-nodejs/HapCategories.d.ts +0 -41
  113. package/build/lib/types/storage/SerializedHostType.d.ts +0 -5
  114. package/build/lib/types/storage/StorageType.d.ts +0 -8
  115. package/build/lib/utils/AccessoryUtils.d.ts +0 -1
  116. package/build/lib/utils/BridgeUtils.d.ts +0 -1
  117. package/build/lib/utils/CharacteristicUtils.d.ts +0 -1
  118. package/build/lib/utils/CharacteristicUtils2.d.ts +0 -1
  119. package/build/lib/utils/NodeStatusUtils.d.ts +0 -17
  120. package/build/lib/utils/ServiceUtils.d.ts +0 -1
  121. package/build/lib/utils/ServiceUtils2.d.ts +0 -1
  122. package/build/lib/utils/index.d.ts +0 -1
  123. package/build/nodes/bridge.d.ts +0 -1
  124. package/build/nodes/nrchkb.d.ts +0 -1
  125. package/build/nodes/service.d.ts +0 -1
  126. package/build/nodes/service2.d.ts +0 -1
  127. package/build/nodes/standalone.d.ts +0 -1
  128. package/build/nodes/status.d.ts +0 -1
@@ -1,90 +1,125 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.configureCamera = void 0;
4
- const hap_nodejs_1 = require("@homebridge/hap-nodejs");
5
- const CameraDelegate_1 = require("./CameraDelegate");
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var CameraControl_exports = {};
20
+ __export(CameraControl_exports, {
21
+ configureCamera: () => configureCamera
22
+ });
23
+ module.exports = __toCommonJS(CameraControl_exports);
24
+ var import_hap_nodejs = require("@homebridge/hap-nodejs");
25
+ var import_CameraDelegate = require("./CameraDelegate");
6
26
  const configureCamera = (accessory, config) => {
7
- const streamDelegate = new CameraDelegate_1.CameraDelegate(accessory, config);
8
- const cameraController = new hap_nodejs_1.CameraController({
9
- cameraStreamCount: Math.max(1, (config === null || config === void 0 ? void 0 : config.cameraConfigMaxStreams) || 2),
10
- delegate: streamDelegate,
11
- streamingOptions: {
12
- supportedCryptoSuites: [
13
- 2,
14
- 0
15
- ],
16
- video: {
17
- codec: {
18
- profiles: [0, 1, 2],
19
- levels: [0, 1, 2]
20
- },
21
- resolutions: (() => {
22
- const maxW = config === null || config === void 0 ? void 0 : config.cameraConfigMaxWidth;
23
- const maxH = config === null || config === void 0 ? void 0 : config.cameraConfigMaxHeight;
24
- const maxFps = config === null || config === void 0 ? void 0 : config.cameraConfigMaxFPS;
25
- const defaults = [
26
- [1920, 1080, 30],
27
- [1280, 960, 30],
28
- [1280, 720, 30],
29
- [1024, 768, 30],
30
- [640, 480, 30],
31
- [640, 360, 30],
32
- [480, 360, 30],
33
- [480, 270, 30],
34
- [320, 240, 30],
35
- [320, 240, 15],
36
- [320, 180, 30]
37
- ];
38
- return defaults
39
- .filter(([w, h]) => (!maxW || w <= maxW) && (!maxH || h <= maxH))
40
- .map(([w, h, f]) => [w, h, Math.min(f, maxFps || f)]);
41
- })()
42
- }
27
+ const streamDelegate = new import_CameraDelegate.CameraDelegate(accessory, config);
28
+ const cameraController = new import_hap_nodejs.CameraController({
29
+ cameraStreamCount: Math.max(1, config?.cameraConfigMaxStreams || 2),
30
+ // default 2
31
+ delegate: streamDelegate,
32
+ streamingOptions: {
33
+ // srtp: true, // legacy option which will just enable AES_CM_128_HMAC_SHA1_80 (can still be used though)
34
+ // iOS does not support NONE just there for testing with Wireshark, for example
35
+ supportedCryptoSuites: [
36
+ import_hap_nodejs.SRTPCryptoSuites.NONE,
37
+ import_hap_nodejs.SRTPCryptoSuites.AES_CM_128_HMAC_SHA1_80
38
+ ],
39
+ video: {
40
+ codec: {
41
+ profiles: [
42
+ import_hap_nodejs.H264Profile.BASELINE,
43
+ import_hap_nodejs.H264Profile.MAIN,
44
+ import_hap_nodejs.H264Profile.HIGH
45
+ ],
46
+ levels: [
47
+ import_hap_nodejs.H264Level.LEVEL3_1,
48
+ import_hap_nodejs.H264Level.LEVEL3_2,
49
+ import_hap_nodejs.H264Level.LEVEL4_0
50
+ ]
51
+ },
52
+ resolutions: (() => {
53
+ const maxW = config?.cameraConfigMaxWidth;
54
+ const maxH = config?.cameraConfigMaxHeight;
55
+ const maxFps = config?.cameraConfigMaxFPS;
56
+ const defaults = [
57
+ [1920, 1080, 30],
58
+ [1280, 960, 30],
59
+ [1280, 720, 30],
60
+ [1024, 768, 30],
61
+ [640, 480, 30],
62
+ [640, 360, 30],
63
+ [480, 360, 30],
64
+ [480, 270, 30],
65
+ [320, 240, 30],
66
+ [320, 240, 15],
67
+ [320, 180, 30]
68
+ ];
69
+ return defaults.filter(
70
+ ([w, h]) => (!maxW || w <= maxW) && (!maxH || h <= maxH)
71
+ ).map(([w, h, f]) => [w, h, Math.min(f, maxFps || f)]);
72
+ })()
73
+ }
74
+ // audio options intentionally omitted here; delegate will honor config for RTP audio path
75
+ },
76
+ recording: {
77
+ options: {
78
+ prebufferLength: 4e3,
79
+ mediaContainerConfiguration: {
80
+ type: import_hap_nodejs.MediaContainerType.FRAGMENTED_MP4,
81
+ fragmentLength: 4e3
43
82
  },
44
- recording: {
45
- options: {
46
- prebufferLength: 4000,
47
- mediaContainerConfiguration: {
48
- type: 0,
49
- fragmentLength: 4000
50
- },
51
- video: {
52
- type: 0,
53
- parameters: {
54
- profiles: [2],
55
- levels: [2]
56
- },
57
- resolutions: [
58
- [320, 180, 30],
59
- [320, 240, 15],
60
- [320, 240, 30],
61
- [480, 270, 30],
62
- [480, 360, 30],
63
- [640, 360, 30],
64
- [640, 480, 30],
65
- [1280, 720, 30],
66
- [1280, 960, 30],
67
- [1920, 1080, 30],
68
- [1600, 1200, 30]
69
- ]
70
- },
71
- audio: {
72
- codecs: {
73
- type: 1,
74
- audioChannels: 1,
75
- samplerate: 5,
76
- bitrateMode: 0
77
- }
78
- }
79
- },
80
- delegate: streamDelegate
83
+ video: {
84
+ type: import_hap_nodejs.VideoCodecType.H264,
85
+ parameters: {
86
+ profiles: [import_hap_nodejs.H264Profile.HIGH],
87
+ levels: [import_hap_nodejs.H264Level.LEVEL4_0]
88
+ },
89
+ resolutions: [
90
+ [320, 180, 30],
91
+ [320, 240, 15],
92
+ [320, 240, 30],
93
+ [480, 270, 30],
94
+ [480, 360, 30],
95
+ [640, 360, 30],
96
+ [640, 480, 30],
97
+ [1280, 720, 30],
98
+ [1280, 960, 30],
99
+ [1920, 1080, 30],
100
+ [1600, 1200, 30]
101
+ ]
81
102
  },
82
- sensors: {
83
- motion: true,
84
- occupancy: true
103
+ audio: {
104
+ codecs: {
105
+ type: import_hap_nodejs.AudioRecordingCodecType.AAC_ELD,
106
+ audioChannels: 1,
107
+ samplerate: import_hap_nodejs.AudioRecordingSamplerate.KHZ_48,
108
+ bitrateMode: import_hap_nodejs.AudioBitrate.VARIABLE
109
+ }
85
110
  }
86
- });
87
- streamDelegate.controller = cameraController;
88
- accessory.configureController(cameraController);
111
+ },
112
+ delegate: streamDelegate
113
+ },
114
+ sensors: {
115
+ motion: true,
116
+ occupancy: true
117
+ }
118
+ });
119
+ streamDelegate.controller = cameraController;
120
+ accessory.configureController(cameraController);
89
121
  };
90
- exports.configureCamera = configureCamera;
122
+ // Annotate the CommonJS export names for ESM import in node:
123
+ 0 && (module.exports = {
124
+ configureCamera
125
+ });