node-red-contrib-homekit-bridged 2.0.0-dev.1 → 2.0.0-dev.10

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 (125) hide show
  1. package/build/lib/HAPHostNode.js +185 -146
  2. package/build/lib/HAPServiceNode.js +200 -177
  3. package/build/lib/HAPServiceNode2.js +208 -177
  4. package/build/lib/NRCHKBError.js +23 -2
  5. package/build/lib/PairingQRCode.js +62 -0
  6. package/build/lib/Storage.js +152 -90
  7. package/build/lib/api.js +654 -290
  8. package/build/lib/camera/CameraControl.js +125 -0
  9. package/build/lib/camera/CameraDelegate.js +507 -0
  10. package/build/lib/camera/MP4StreamingServer.js +159 -0
  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 -112
  39. package/build/lib/utils/BridgeUtils.js +95 -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 +433 -368
  45. package/build/lib/utils/ServiceUtils2.js +519 -304
  46. package/build/lib/utils/index.js +11 -12
  47. package/build/nodes/bridge.html +206 -168
  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 +1753 -117
  51. package/build/nodes/nrchkb.js +66 -88
  52. package/build/nodes/plugin-instance.html +509 -0
  53. package/build/nodes/plugin-instance.js +46 -0
  54. package/build/nodes/service.html +557 -306
  55. package/build/nodes/service.js +5 -6
  56. package/build/nodes/service2.html +1735 -455
  57. package/build/nodes/service2.js +5 -8
  58. package/build/nodes/standalone.html +208 -176
  59. package/build/nodes/standalone.js +27 -9
  60. package/build/nodes/status.html +51 -18
  61. package/build/nodes/status.js +47 -41
  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 -82
  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/hap/HAPCharacteristic.d.ts +0 -9
  91. package/build/lib/hap/HAPService.d.ts +0 -6
  92. package/build/lib/hap/eve-app/EveCharacteristics.d.ts +0 -20
  93. package/build/lib/hap/eve-app/EveServices.d.ts +0 -5
  94. package/build/lib/types/AccessoryInformationType.d.ts +0 -11
  95. package/build/lib/types/CameraConfigType.d.ts +0 -24
  96. package/build/lib/types/CustomCharacteristicType.d.ts +0 -6
  97. package/build/lib/types/HAPHostConfigType.d.ts +0 -22
  98. package/build/lib/types/HAPHostNodeType.d.ts +0 -14
  99. package/build/lib/types/HAPService2ConfigType.d.ts +0 -6
  100. package/build/lib/types/HAPService2NodeType.d.ts +0 -7
  101. package/build/lib/types/HAPServiceConfigType.d.ts +0 -26
  102. package/build/lib/types/HAPServiceNodeType.d.ts +0 -38
  103. package/build/lib/types/HAPStatusConfigType.d.ts +0 -5
  104. package/build/lib/types/HAPStatusNodeType.d.ts +0 -12
  105. package/build/lib/types/HostType.d.ts +0 -5
  106. package/build/lib/types/NodeType.d.ts +0 -3
  107. package/build/lib/types/PublishTimersType.d.ts +0 -4
  108. package/build/lib/types/hap-nodejs/HapAdaptiveLightingControllerMode.d.ts +0 -5
  109. package/build/lib/types/hap-nodejs/HapCategories.d.ts +0 -41
  110. package/build/lib/types/storage/SerializedHostType.d.ts +0 -5
  111. package/build/lib/types/storage/StorageType.d.ts +0 -8
  112. package/build/lib/utils/AccessoryUtils.d.ts +0 -1
  113. package/build/lib/utils/BridgeUtils.d.ts +0 -1
  114. package/build/lib/utils/CharacteristicUtils.d.ts +0 -1
  115. package/build/lib/utils/CharacteristicUtils2.d.ts +0 -1
  116. package/build/lib/utils/NodeStatusUtils.d.ts +0 -17
  117. package/build/lib/utils/ServiceUtils.d.ts +0 -1
  118. package/build/lib/utils/ServiceUtils2.d.ts +0 -1
  119. package/build/lib/utils/index.d.ts +0 -1
  120. package/build/nodes/bridge.d.ts +0 -1
  121. package/build/nodes/nrchkb.d.ts +0 -1
  122. package/build/nodes/service.d.ts +0 -1
  123. package/build/nodes/service2.d.ts +0 -1
  124. package/build/nodes/standalone.d.ts +0 -1
  125. package/build/nodes/status.d.ts +0 -1
@@ -0,0 +1,159 @@
1
+ "use strict";
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 MP4StreamingServer_exports = {};
20
+ __export(MP4StreamingServer_exports, {
21
+ MP4StreamingServer: () => MP4StreamingServer
22
+ });
23
+ module.exports = __toCommonJS(MP4StreamingServer_exports);
24
+ var import_node_child_process = require("node:child_process");
25
+ var import_node_events = require("node:events");
26
+ var import_node_net = require("node:net");
27
+ var import_logger = require("@nrchkb/logger");
28
+ const log = (0, import_logger.logger)("NRCHKB", "MP4StreamingServer");
29
+ class MP4StreamingServer {
30
+ constructor(ffmpegPath, ffmpegInput, audioOutputArgs, videoOutputArgs) {
31
+ /**
32
+ * This can be configured to output ffmpeg debug output!
33
+ */
34
+ this.debugMode = false;
35
+ this.destroyed = false;
36
+ this.connectPromise = new Promise((resolve) => {
37
+ this.connectResolve = resolve;
38
+ });
39
+ this.server = (0, import_node_net.createServer)(this.handleConnection.bind(this));
40
+ this.ffmpegPath = ffmpegPath;
41
+ this.args = [];
42
+ this.args.push(...ffmpegInput);
43
+ this.args.push(...audioOutputArgs);
44
+ this.args.push("-f", "mp4");
45
+ this.args.push(...videoOutputArgs);
46
+ this.args.push("-fflags", "+genpts", "-reset_timestamps", "1");
47
+ this.args.push(
48
+ "-movflags",
49
+ "frag_keyframe+empty_moov+default_base_moof"
50
+ );
51
+ }
52
+ async start() {
53
+ const promise = (0, import_node_events.once)(this.server, "listening");
54
+ this.server.listen();
55
+ await promise;
56
+ if (this.destroyed) {
57
+ return;
58
+ }
59
+ const port = this.server.address().port;
60
+ this.args.push(`tcp://127.0.0.1:${port}`);
61
+ log.debug(`${this.ffmpegPath} ${this.args.join(" ")}`);
62
+ this.childProcess = (0, import_node_child_process.spawn)(this.ffmpegPath, this.args, {
63
+ env: process.env,
64
+ stdio: this.debugMode ? "pipe" : "ignore"
65
+ });
66
+ if (!this.childProcess) {
67
+ log.error("ChildProcess is undefined directly after the init!");
68
+ }
69
+ if (this.debugMode) {
70
+ this.childProcess.stdout?.on(
71
+ "data",
72
+ (data) => log.debug(data.toString())
73
+ );
74
+ this.childProcess.stderr?.on(
75
+ "data",
76
+ (data) => log.debug(data.toString())
77
+ );
78
+ }
79
+ }
80
+ destroy() {
81
+ this.socket?.destroy();
82
+ this.childProcess?.kill();
83
+ this.socket = void 0;
84
+ this.childProcess = void 0;
85
+ this.destroyed = true;
86
+ }
87
+ handleConnection(socket) {
88
+ this.server.close();
89
+ this.socket = socket;
90
+ this.connectResolve?.();
91
+ }
92
+ /**
93
+ * Generator for `MP4Atom`s.
94
+ * Throws error to signal EOF when socket is closed.
95
+ */
96
+ async *generator() {
97
+ await this.connectPromise;
98
+ if (!this.socket || !this.childProcess) {
99
+ log.error(
100
+ "Socket undefined " + !!this.socket + " childProcess undefined " + !!this.childProcess
101
+ );
102
+ throw new Error("Unexpected state!");
103
+ }
104
+ while (true) {
105
+ const header = await this.read(8);
106
+ const length = header.readInt32BE(0) - 8;
107
+ const type = header.subarray(4).toString();
108
+ const data = await this.read(length);
109
+ yield {
110
+ header,
111
+ length,
112
+ type,
113
+ data
114
+ };
115
+ }
116
+ }
117
+ async read(length) {
118
+ if (!this.socket) {
119
+ throw Error("FFMPEG tried reading from closed socket!");
120
+ }
121
+ if (!length) {
122
+ return Buffer.alloc(0);
123
+ }
124
+ const value = this.socket.read(length);
125
+ if (value) {
126
+ return value;
127
+ }
128
+ return new Promise((resolve, reject) => {
129
+ const readHandler = () => {
130
+ const value2 = this.socket?.read(length);
131
+ if (value2) {
132
+ cleanup();
133
+ resolve(value2);
134
+ }
135
+ };
136
+ const endHandler = () => {
137
+ cleanup();
138
+ reject(
139
+ new Error(
140
+ `FFMPEG socket closed during read for ${length} bytes!`
141
+ )
142
+ );
143
+ };
144
+ const cleanup = () => {
145
+ this.socket?.removeListener("readable", readHandler);
146
+ this.socket?.removeListener("close", endHandler);
147
+ };
148
+ if (!this.socket) {
149
+ throw new Error("FFMPEG socket is closed now!");
150
+ }
151
+ this.socket.on("readable", readHandler);
152
+ this.socket.on("close", endHandler);
153
+ });
154
+ }
155
+ }
156
+ // Annotate the CommonJS export names for ESM import in node:
157
+ 0 && (module.exports = {
158
+ MP4StreamingServer
159
+ });
@@ -1,6 +1,27 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const hap_nodejs_1 = require("@homebridge/hap-nodejs");
4
- class HAPCharacteristic extends hap_nodejs_1.Characteristic {
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 HAPCharacteristic_exports = {};
20
+ __export(HAPCharacteristic_exports, {
21
+ default: () => HAPCharacteristic_default
22
+ });
23
+ module.exports = __toCommonJS(HAPCharacteristic_exports);
24
+ var import_hap_nodejs = require("@homebridge/hap-nodejs");
25
+ class HAPCharacteristic extends import_hap_nodejs.Characteristic {
5
26
  }
6
- exports.default = HAPCharacteristic;
27
+ var HAPCharacteristic_default = HAPCharacteristic;
@@ -1,6 +1,27 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const hap_nodejs_1 = require("@homebridge/hap-nodejs");
4
- class HAPService extends hap_nodejs_1.Service {
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 HAPService_exports = {};
20
+ __export(HAPService_exports, {
21
+ default: () => HAPService_default
22
+ });
23
+ module.exports = __toCommonJS(HAPService_exports);
24
+ var import_hap_nodejs = require("@homebridge/hap-nodejs");
25
+ class HAPService extends import_hap_nodejs.Service {
5
26
  }
6
- exports.default = HAPService;
27
+ var HAPService_default = HAPService;
@@ -1,89 +1,132 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
4
11
  };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.EveS2W2 = exports.EveS2W1 = exports.EveS2R2 = exports.EveS2R1 = void 0;
7
- const HAPCharacteristic_1 = __importDefault(require("../HAPCharacteristic"));
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var EveCharacteristics_exports = {};
30
+ __export(EveCharacteristics_exports, {
31
+ EveS2R1: () => EveS2R1,
32
+ EveS2R2: () => EveS2R2,
33
+ EveS2W1: () => EveS2W1,
34
+ EveS2W2: () => EveS2W2,
35
+ default: () => EveCharacteristics_default
36
+ });
37
+ module.exports = __toCommonJS(EveCharacteristics_exports);
38
+ var import_HAPCharacteristic = __toESM(require("../HAPCharacteristic"));
39
+ var import_hap_nodejs = require("../hap-nodejs");
8
40
  const EveCharacteristics = [
9
- {
10
- UUID: 'E863F10A-079E-48FF-8F27-9C2605A29F52',
11
- name: 'Eve-Volt',
12
- format: "float",
13
- perms: ["pr"],
14
- description: 'Volt (V) value. Used by Eve.app.'
15
- },
16
- {
17
- UUID: 'E863F126-079E-48FF-8F27-9C2605A29F52',
18
- name: 'Eve-Ampere',
19
- format: "float",
20
- perms: ["pr"],
21
- description: 'Ampere (A) value. Used by Eve.app.'
22
- },
23
- {
24
- UUID: 'E863F10D-079E-48FF-8F27-9C2605A29F52',
25
- name: 'Eve-Watt',
26
- format: "float",
27
- perms: ["pr"],
28
- description: 'Watt (W) value. Used by Eve.app, reported as "Consumption".'
29
- },
30
- {
31
- UUID: 'E863F10C-079E-48FF-8F27-9C2605A29F52',
32
- name: 'Eve-Kilowatt-hour',
33
- format: "float",
34
- perms: ["pr"],
35
- description: 'Kilowatt-hour (kWh) value. Used by Eve.app, reported as Total Consumption.'
36
- },
37
- {
38
- UUID: 'E863F110-079E-48FF-8F27-9C2605A29F52',
39
- name: 'Eve-Volt-Ampere',
40
- format: "uint16",
41
- perms: ["pr"],
42
- description: 'Volt-Ampere (VA) value. Used by Eve.app.'
43
- }
41
+ {
42
+ UUID: "E863F10A-079E-48FF-8F27-9C2605A29F52",
43
+ name: "Eve-Volt",
44
+ format: import_hap_nodejs.Formats.FLOAT,
45
+ perms: [import_hap_nodejs.Perms.PAIRED_READ],
46
+ description: "Volt (V) value. Used by Eve.app."
47
+ },
48
+ {
49
+ UUID: "E863F126-079E-48FF-8F27-9C2605A29F52",
50
+ name: "Eve-Ampere",
51
+ format: import_hap_nodejs.Formats.FLOAT,
52
+ perms: [import_hap_nodejs.Perms.PAIRED_READ],
53
+ description: "Ampere (A) value. Used by Eve.app."
54
+ },
55
+ {
56
+ UUID: "E863F10D-079E-48FF-8F27-9C2605A29F52",
57
+ name: "Eve-Watt",
58
+ format: import_hap_nodejs.Formats.FLOAT,
59
+ perms: [import_hap_nodejs.Perms.PAIRED_READ],
60
+ description: 'Watt (W) value. Used by Eve.app, reported as "Consumption".'
61
+ },
62
+ {
63
+ UUID: "E863F10C-079E-48FF-8F27-9C2605A29F52",
64
+ name: "Eve-Kilowatt-hour",
65
+ format: import_hap_nodejs.Formats.FLOAT,
66
+ perms: [import_hap_nodejs.Perms.PAIRED_READ],
67
+ description: "Kilowatt-hour (kWh) value. Used by Eve.app, reported as Total Consumption."
68
+ },
69
+ {
70
+ UUID: "E863F110-079E-48FF-8F27-9C2605A29F52",
71
+ name: "Eve-Volt-Ampere",
72
+ format: import_hap_nodejs.Formats.UINT16,
73
+ perms: [import_hap_nodejs.Perms.PAIRED_READ],
74
+ description: "Volt-Ampere (VA) value. Used by Eve.app."
75
+ }
44
76
  ];
45
- class EveS2R1 extends HAPCharacteristic_1.default {
46
- constructor() {
47
- super('Eve-S2R1', EveS2R1.UUID, {
48
- format: "data",
49
- perms: ["pr", "ev", "hd"]
50
- });
51
- }
77
+ class EveS2R1 extends import_HAPCharacteristic.default {
78
+ static {
79
+ this.UUID = "E863F116-079E-48FF-8F27-9C2605A29F52";
80
+ }
81
+ constructor() {
82
+ super("Eve-S2R1", EveS2R1.UUID, {
83
+ format: import_hap_nodejs.Formats.DATA,
84
+ perms: [import_hap_nodejs.Perms.PAIRED_READ, import_hap_nodejs.Perms.NOTIFY, import_hap_nodejs.Perms.HIDDEN]
85
+ });
86
+ }
52
87
  }
53
- exports.EveS2R1 = EveS2R1;
54
- EveS2R1.UUID = 'E863F116-079E-48FF-8F27-9C2605A29F52';
55
- HAPCharacteristic_1.default.EveS2R1 = EveS2R1;
56
- class EveS2R2 extends HAPCharacteristic_1.default {
57
- constructor() {
58
- super('Eve-S2R2', EveS2R2.UUID, {
59
- format: "data",
60
- perms: ["pr", "ev", "hd"]
61
- });
62
- }
88
+ import_HAPCharacteristic.default.EveS2R1 = EveS2R1;
89
+ class EveS2R2 extends import_HAPCharacteristic.default {
90
+ static {
91
+ this.UUID = "E863F117-079E-48FF-8F27-9C2605A29F52";
92
+ }
93
+ constructor() {
94
+ super("Eve-S2R2", EveS2R2.UUID, {
95
+ format: import_hap_nodejs.Formats.DATA,
96
+ perms: [import_hap_nodejs.Perms.PAIRED_READ, import_hap_nodejs.Perms.NOTIFY, import_hap_nodejs.Perms.HIDDEN]
97
+ });
98
+ }
63
99
  }
64
- exports.EveS2R2 = EveS2R2;
65
- EveS2R2.UUID = 'E863F117-079E-48FF-8F27-9C2605A29F52';
66
- HAPCharacteristic_1.default.EveS2R2 = EveS2R2;
67
- class EveS2W1 extends HAPCharacteristic_1.default {
68
- constructor() {
69
- super('Eve-S2W1', EveS2W1.UUID, {
70
- format: "data",
71
- perms: ["pw", "hd"]
72
- });
73
- }
100
+ import_HAPCharacteristic.default.EveS2R2 = EveS2R2;
101
+ class EveS2W1 extends import_HAPCharacteristic.default {
102
+ static {
103
+ this.UUID = "E863F11C-079E-48FF-8F27-9C2605A29F52";
104
+ }
105
+ constructor() {
106
+ super("Eve-S2W1", EveS2W1.UUID, {
107
+ format: import_hap_nodejs.Formats.DATA,
108
+ perms: [import_hap_nodejs.Perms.PAIRED_WRITE, import_hap_nodejs.Perms.HIDDEN]
109
+ });
110
+ }
74
111
  }
75
- exports.EveS2W1 = EveS2W1;
76
- EveS2W1.UUID = 'E863F11C-079E-48FF-8F27-9C2605A29F52';
77
- HAPCharacteristic_1.default.EveS2W1 = EveS2W1;
78
- class EveS2W2 extends HAPCharacteristic_1.default {
79
- constructor() {
80
- super('Eve-S2W2', EveS2W2.UUID, {
81
- format: "data",
82
- perms: ["pw", "hd"]
83
- });
84
- }
112
+ import_HAPCharacteristic.default.EveS2W1 = EveS2W1;
113
+ class EveS2W2 extends import_HAPCharacteristic.default {
114
+ static {
115
+ this.UUID = "E863F121-079E-48FF-8F27-9C2605A29F52";
116
+ }
117
+ constructor() {
118
+ super("Eve-S2W2", EveS2W2.UUID, {
119
+ format: import_hap_nodejs.Formats.DATA,
120
+ perms: [import_hap_nodejs.Perms.PAIRED_WRITE, import_hap_nodejs.Perms.HIDDEN]
121
+ });
122
+ }
85
123
  }
86
- exports.EveS2W2 = EveS2W2;
87
- EveS2W2.UUID = 'E863F121-079E-48FF-8F27-9C2605A29F52';
88
- HAPCharacteristic_1.default.EveS2W2 = EveS2W2;
89
- exports.default = EveCharacteristics;
124
+ import_HAPCharacteristic.default.EveS2W2 = EveS2W2;
125
+ var EveCharacteristics_default = EveCharacteristics;
126
+ // Annotate the CommonJS export names for ESM import in node:
127
+ 0 && (module.exports = {
128
+ EveS2R1,
129
+ EveS2R2,
130
+ EveS2W1,
131
+ EveS2W2
132
+ });
@@ -1,20 +1,53 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
4
11
  };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.EveHistoryData = void 0;
7
- const HAPCharacteristic_1 = __importDefault(require("../HAPCharacteristic"));
8
- const HAPService_1 = __importDefault(require("../HAPService"));
9
- class EveHistoryData extends HAPService_1.default {
10
- constructor() {
11
- super('EveHistoryData', EveHistoryData.UUID);
12
- this.addCharacteristic(HAPCharacteristic_1.default.EveS2R1);
13
- this.addCharacteristic(HAPCharacteristic_1.default.EveS2R2);
14
- this.addCharacteristic(HAPCharacteristic_1.default.EveS2W1);
15
- this.addCharacteristic(HAPCharacteristic_1.default.EveS2W2);
16
- }
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var EveServices_exports = {};
30
+ __export(EveServices_exports, {
31
+ EveHistoryData: () => EveHistoryData
32
+ });
33
+ module.exports = __toCommonJS(EveServices_exports);
34
+ var import_HAPCharacteristic = __toESM(require("../HAPCharacteristic"));
35
+ var import_HAPService = __toESM(require("../HAPService"));
36
+ class EveHistoryData extends import_HAPService.default {
37
+ static {
38
+ // Custom service for meta and/or historical information. Characteristics for logging: E863F11C, E863F121, E863F116, E863F117. Used by Eve.app.
39
+ this.UUID = "E863F007-079E-48FF-8F27-9C2605A29F52";
40
+ }
41
+ constructor() {
42
+ super("EveHistoryData", EveHistoryData.UUID);
43
+ this.addCharacteristic(import_HAPCharacteristic.default.EveS2R1);
44
+ this.addCharacteristic(import_HAPCharacteristic.default.EveS2R2);
45
+ this.addCharacteristic(import_HAPCharacteristic.default.EveS2W1);
46
+ this.addCharacteristic(import_HAPCharacteristic.default.EveS2W2);
47
+ }
17
48
  }
18
- exports.EveHistoryData = EveHistoryData;
19
- EveHistoryData.UUID = 'E863F007-079E-48FF-8F27-9C2605A29F52';
20
- HAPService_1.default.EveHistoryData = EveHistoryData;
49
+ import_HAPService.default.EveHistoryData = EveHistoryData;
50
+ // Annotate the CommonJS export names for ESM import in node:
51
+ 0 && (module.exports = {
52
+ EveHistoryData
53
+ });
@@ -0,0 +1,32 @@
1
+ "use strict";
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 hap_nodejs_exports = {};
20
+ __export(hap_nodejs_exports, {
21
+ AdaptiveLightingControllerMode: () => import_hap_nodejs.AdaptiveLightingControllerMode,
22
+ Formats: () => import_hap_nodejs.Formats,
23
+ Perms: () => import_hap_nodejs.Perms
24
+ });
25
+ module.exports = __toCommonJS(hap_nodejs_exports);
26
+ var import_hap_nodejs = require("@homebridge/hap-nodejs");
27
+ // Annotate the CommonJS export names for ESM import in node:
28
+ 0 && (module.exports = {
29
+ AdaptiveLightingControllerMode,
30
+ Formats,
31
+ Perms
32
+ });
@@ -0,0 +1,34 @@
1
+ "use strict";
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 HomeKitService2Migration_exports = {};
20
+ __export(HomeKitService2Migration_exports, {
21
+ migrateHomeKitServiceFlow: () => migrateHomeKitServiceFlow,
22
+ migrateHomeKitServiceNode: () => migrateHomeKitServiceNode
23
+ });
24
+ module.exports = __toCommonJS(HomeKitService2Migration_exports);
25
+ var import_NodeMigration = require("./NodeMigration");
26
+ const migrateHomeKitServiceNode = (node) => {
27
+ return (0, import_NodeMigration.migrateNode)(node).migrated;
28
+ };
29
+ const migrateHomeKitServiceFlow = (nodes) => (0, import_NodeMigration.migrateFlow)(nodes);
30
+ // Annotate the CommonJS export names for ESM import in node:
31
+ 0 && (module.exports = {
32
+ migrateHomeKitServiceFlow,
33
+ migrateHomeKitServiceNode
34
+ });
@@ -0,0 +1,75 @@
1
+ "use strict";
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 NodeMigration_exports = {};
20
+ __export(NodeMigration_exports, {
21
+ migrateFlow: () => migrateFlow,
22
+ migrateNode: () => migrateNode
23
+ });
24
+ module.exports = __toCommonJS(NodeMigration_exports);
25
+ var import_embedded = require("../../plugins/embedded");
26
+ const migrateNode = (node) => {
27
+ const cameraMigrated = node.type === "homekit-service" && node.serviceName === "CameraControl";
28
+ if (node.type !== "homekit-service") {
29
+ return {
30
+ migrated: false,
31
+ cameraMigrated: false,
32
+ node
33
+ };
34
+ }
35
+ node.type = "homekit-service2";
36
+ if (cameraMigrated) {
37
+ node.serviceName = "Camera";
38
+ node.plugins = [(0, import_embedded.createAutomaticHomebridgeCameraFfmpegPluginEntry)(node)];
39
+ }
40
+ node.outputMode = "legacy";
41
+ node.useEventCallback = false;
42
+ node.outputs = cameraMigrated ? 3 : 2;
43
+ return {
44
+ migrated: true,
45
+ cameraMigrated,
46
+ node
47
+ };
48
+ };
49
+ const migrateFlow = (nodes) => {
50
+ let migrated = 0;
51
+ let cameraMigrated = 0;
52
+ let skipped = 0;
53
+ nodes.forEach((node) => {
54
+ const result = migrateNode(node);
55
+ if (result.migrated) {
56
+ migrated += 1;
57
+ if (result.cameraMigrated) {
58
+ cameraMigrated += 1;
59
+ }
60
+ } else {
61
+ skipped += 1;
62
+ }
63
+ });
64
+ return {
65
+ migrated,
66
+ cameraMigrated,
67
+ skipped,
68
+ nodes
69
+ };
70
+ };
71
+ // Annotate the CommonJS export names for ESM import in node:
72
+ 0 && (module.exports = {
73
+ migrateFlow,
74
+ migrateNode
75
+ });