homebridge 2.0.0-alpha.4 → 2.0.0-alpha.5

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 (70) hide show
  1. package/bin/homebridge +1 -1
  2. package/dist/api.d.ts +193 -0
  3. package/dist/api.d.ts.map +1 -0
  4. package/dist/api.js +129 -0
  5. package/dist/api.js.map +1 -0
  6. package/dist/bridgeService.d.ts +106 -0
  7. package/dist/bridgeService.d.ts.map +1 -0
  8. package/dist/bridgeService.js +390 -0
  9. package/dist/bridgeService.js.map +1 -0
  10. package/dist/childBridgeFork.d.ts +38 -0
  11. package/dist/childBridgeFork.d.ts.map +1 -0
  12. package/dist/childBridgeFork.js +241 -2
  13. package/dist/childBridgeFork.js.map +1 -7
  14. package/dist/childBridgeService.d.ts +200 -0
  15. package/dist/childBridgeService.d.ts.map +1 -0
  16. package/dist/childBridgeService.js +427 -0
  17. package/dist/childBridgeService.js.map +1 -0
  18. package/dist/cli.d.ts +3 -0
  19. package/dist/cli.d.ts.map +1 -0
  20. package/dist/cli.js +89 -2
  21. package/dist/cli.js.map +1 -7
  22. package/dist/externalPortService.d.ts +33 -0
  23. package/dist/externalPortService.d.ts.map +1 -0
  24. package/dist/externalPortService.js +59 -0
  25. package/dist/externalPortService.js.map +1 -0
  26. package/dist/index.d.ts +76 -1099
  27. package/dist/index.d.ts.map +1 -0
  28. package/dist/index.js +19 -2
  29. package/dist/index.js.map +1 -7
  30. package/dist/ipcService.d.ts +30 -0
  31. package/dist/ipcService.d.ts.map +1 -0
  32. package/dist/ipcService.js +49 -0
  33. package/dist/ipcService.js.map +1 -0
  34. package/dist/logger.d.ts +78 -0
  35. package/dist/logger.d.ts.map +1 -0
  36. package/dist/logger.js +138 -0
  37. package/dist/logger.js.map +1 -0
  38. package/dist/platformAccessory.d.ts +55 -0
  39. package/dist/platformAccessory.d.ts.map +1 -0
  40. package/dist/platformAccessory.js +98 -0
  41. package/dist/platformAccessory.js.map +1 -0
  42. package/dist/plugin.d.ts +31 -0
  43. package/dist/plugin.d.ts.map +1 -0
  44. package/dist/plugin.js +185 -0
  45. package/dist/plugin.js.map +1 -0
  46. package/dist/pluginManager.d.ts +77 -0
  47. package/dist/pluginManager.d.ts.map +1 -0
  48. package/dist/pluginManager.js +374 -0
  49. package/dist/pluginManager.js.map +1 -0
  50. package/dist/server.d.ts +58 -0
  51. package/dist/server.d.ts.map +1 -0
  52. package/dist/server.js +430 -0
  53. package/dist/server.js.map +1 -0
  54. package/dist/storageService.d.ts +13 -0
  55. package/dist/storageService.d.ts.map +1 -0
  56. package/dist/storageService.js +41 -0
  57. package/dist/storageService.js.map +1 -0
  58. package/dist/user.d.ts +13 -0
  59. package/dist/user.d.ts.map +1 -0
  60. package/dist/user.js +29 -0
  61. package/dist/user.js.map +1 -0
  62. package/dist/util/mac.d.ts +5 -0
  63. package/dist/util/mac.d.ts.map +1 -0
  64. package/dist/util/mac.js +14 -0
  65. package/dist/util/mac.js.map +1 -0
  66. package/dist/version.d.ts +3 -0
  67. package/dist/version.d.ts.map +1 -0
  68. package/dist/version.js +16 -0
  69. package/dist/version.js.map +1 -0
  70. package/package.json +7 -10
package/dist/server.js ADDED
@@ -0,0 +1,430 @@
1
+ import fs from 'node:fs';
2
+ import process from 'node:process';
3
+ import chalk from 'chalk';
4
+ import qrcode from 'qrcode-terminal';
5
+ import { HomebridgeAPI } from './api.js';
6
+ import { BridgeService } from './bridgeService.js';
7
+ import { ChildBridgeService } from './childBridgeService.js';
8
+ import { ExternalPortService } from './externalPortService.js';
9
+ import { IpcService } from './ipcService.js';
10
+ import { Logger } from './logger.js';
11
+ import { PluginManager } from './pluginManager.js';
12
+ import { User } from './user.js';
13
+ import { validMacAddress } from './util/mac.js';
14
+ const log = Logger.internal;
15
+ // eslint-disable-next-line no-restricted-syntax
16
+ export var ServerStatus;
17
+ (function (ServerStatus) {
18
+ /**
19
+ * When the server is starting up
20
+ */
21
+ ServerStatus["PENDING"] = "pending";
22
+ /**
23
+ * When the server is online and has published the main bridge
24
+ */
25
+ ServerStatus["OK"] = "ok";
26
+ /**
27
+ * When the server is shutting down
28
+ */
29
+ ServerStatus["DOWN"] = "down";
30
+ })(ServerStatus || (ServerStatus = {}));
31
+ export class Server {
32
+ options;
33
+ api;
34
+ pluginManager;
35
+ bridgeService;
36
+ ipcService;
37
+ externalPortService;
38
+ config;
39
+ // used to keep track of child bridges
40
+ childBridges = new Map();
41
+ // current server status
42
+ serverStatus = "pending" /* ServerStatus.PENDING */;
43
+ constructor(options = {}) {
44
+ this.options = options;
45
+ this.config = Server.loadConfig();
46
+ // object we feed to Plugins and BridgeService
47
+ this.api = new HomebridgeAPI();
48
+ this.ipcService = new IpcService();
49
+ this.externalPortService = new ExternalPortService(this.config.ports);
50
+ // set status to pending
51
+ this.setServerStatus("pending" /* ServerStatus.PENDING */);
52
+ // create new plugin manager
53
+ const pluginManagerOptions = {
54
+ activePlugins: this.config.plugins,
55
+ disabledPlugins: this.config.disabledPlugins,
56
+ customPluginPath: options.customPluginPath,
57
+ strictPluginResolution: options.strictPluginResolution,
58
+ };
59
+ this.pluginManager = new PluginManager(this.api, pluginManagerOptions);
60
+ // create new bridge service
61
+ const bridgeConfig = {
62
+ cachedAccessoriesDir: User.cachedAccessoryPath(),
63
+ cachedAccessoriesItemName: 'cachedAccessories',
64
+ };
65
+ // shallow copy the homebridge options to the bridge options object
66
+ Object.assign(bridgeConfig, this.options);
67
+ this.bridgeService = new BridgeService(this.api, this.pluginManager, this.externalPortService, bridgeConfig, this.config.bridge, this.config);
68
+ // watch bridge events to check when server is online
69
+ this.bridgeService.bridge.on("advertised" /* AccessoryEventTypes.ADVERTISED */, () => {
70
+ this.setServerStatus("ok" /* ServerStatus.OK */);
71
+ });
72
+ // watch for the paired event to update the server status
73
+ this.bridgeService.bridge.on("paired" /* AccessoryEventTypes.PAIRED */, () => {
74
+ this.setServerStatus(this.serverStatus);
75
+ });
76
+ // watch for the unpaired event to update the server status
77
+ this.bridgeService.bridge.on("unpaired" /* AccessoryEventTypes.UNPAIRED */, () => {
78
+ this.setServerStatus(this.serverStatus);
79
+ });
80
+ }
81
+ /**
82
+ * Set the current server status and update parent via IPC
83
+ * @param status
84
+ */
85
+ setServerStatus(status) {
86
+ this.serverStatus = status;
87
+ this.ipcService.sendMessage("serverStatusUpdate" /* IpcOutgoingEvent.SERVER_STATUS_UPDATE */, {
88
+ status: this.serverStatus,
89
+ paired: this.bridgeService?.bridge?._accessoryInfo?.paired() ?? null,
90
+ setupUri: this.bridgeService?.bridge?.setupURI() ?? null,
91
+ name: this.bridgeService?.bridge?.displayName || this.config.bridge.name,
92
+ username: this.config.bridge.username,
93
+ pin: this.config.bridge.pin,
94
+ });
95
+ }
96
+ async start() {
97
+ if (this.config.bridge.disableIpc !== true) {
98
+ this.initializeIpcEventHandlers();
99
+ }
100
+ const promises = [];
101
+ // load the cached accessories
102
+ await this.bridgeService.loadCachedPlatformAccessoriesFromDisk();
103
+ // initialize plugins
104
+ await this.pluginManager.initializeInstalledPlugins();
105
+ if (this.config.platforms.length > 0) {
106
+ promises.push(...this.loadPlatforms());
107
+ }
108
+ if (this.config.accessories.length > 0) {
109
+ this.loadAccessories();
110
+ }
111
+ // start child bridges
112
+ for (const childBridge of this.childBridges.values()) {
113
+ childBridge.start();
114
+ }
115
+ // restore cached accessories
116
+ this.bridgeService.restoreCachedPlatformAccessories();
117
+ this.api.signalFinished();
118
+ // wait for all platforms to publish their accessories before we publish the bridge
119
+ await Promise.all(promises)
120
+ .then(() => this.publishBridge());
121
+ }
122
+ teardown() {
123
+ this.bridgeService.teardown();
124
+ this.setServerStatus("down" /* ServerStatus.DOWN */);
125
+ }
126
+ publishBridge() {
127
+ this.bridgeService.publishBridge();
128
+ this.printSetupInfo(this.config.bridge.pin);
129
+ }
130
+ static loadConfig() {
131
+ // Look for the configuration file
132
+ const configPath = User.configPath();
133
+ const defaultBridge = {
134
+ name: 'Homebridge',
135
+ username: 'CC:22:3D:E3:CE:30',
136
+ pin: '031-45-154',
137
+ };
138
+ if (!fs.existsSync(configPath)) {
139
+ log.warn('config.json (%s) not found.', configPath);
140
+ return {
141
+ bridge: defaultBridge,
142
+ accessories: [],
143
+ platforms: [],
144
+ };
145
+ }
146
+ let config;
147
+ try {
148
+ config = JSON.parse(fs.readFileSync(configPath, { encoding: 'utf8' }));
149
+ }
150
+ catch (error) {
151
+ log.error('There was a problem reading your config.json file.');
152
+ log.error('Please try pasting your config.json file here to validate it: https://jsonlint.com');
153
+ log.error('');
154
+ throw error;
155
+ }
156
+ if (config.ports !== undefined) {
157
+ if (config.ports.start && config.ports.end) {
158
+ if (config.ports.start > config.ports.end) {
159
+ log.error('Invalid port pool configuration. End should be greater than or equal to start.');
160
+ config.ports = undefined;
161
+ }
162
+ }
163
+ else {
164
+ log.error('Invalid configuration for \'ports\'. Missing \'start\' and \'end\' properties! Ignoring it!');
165
+ config.ports = undefined;
166
+ }
167
+ }
168
+ const bridge = config.bridge || defaultBridge;
169
+ bridge.name = bridge.name || defaultBridge.name;
170
+ bridge.username = bridge.username || defaultBridge.username;
171
+ bridge.pin = bridge.pin || defaultBridge.pin;
172
+ config.bridge = bridge;
173
+ const username = config.bridge.username;
174
+ if (!validMacAddress(username)) {
175
+ throw new Error(`Not a valid username: ${username}. Must be 6 pairs of colon-separated hexadecimal chars (A-F 0-9), like a MAC address.`);
176
+ }
177
+ config.accessories = config.accessories || [];
178
+ config.platforms = config.platforms || [];
179
+ if (!Array.isArray(config.accessories)) {
180
+ log.error('Value provided for accessories must be an array[]');
181
+ config.accessories = [];
182
+ }
183
+ if (!Array.isArray(config.platforms)) {
184
+ log.error('Value provided for platforms must be an array[]');
185
+ config.platforms = [];
186
+ }
187
+ log.info('Loaded config.json with %s accessories and %s platforms.', config.accessories.length, config.platforms.length);
188
+ if (config.bridge.advertiser) {
189
+ if (![
190
+ "bonjour-hap" /* MDNSAdvertiser.BONJOUR */,
191
+ "ciao" /* MDNSAdvertiser.CIAO */,
192
+ "avahi" /* MDNSAdvertiser.AVAHI */,
193
+ "resolved" /* MDNSAdvertiser.RESOLVED */,
194
+ ].includes(config.bridge.advertiser)) {
195
+ config.bridge.advertiser = undefined;
196
+ log.error('Value provided in bridge.advertiser is not valid, reverting to platform default.');
197
+ }
198
+ }
199
+ else {
200
+ config.bridge.advertiser = undefined;
201
+ }
202
+ return config;
203
+ }
204
+ loadAccessories() {
205
+ log.info(`Loading ${this.config.accessories.length} accessories...`);
206
+ this.config.accessories.forEach((accessoryConfig, index) => {
207
+ if (!accessoryConfig.accessory) {
208
+ log.warn('Your config.json contains an illegal accessory configuration object at position %d. '
209
+ + 'Missing property \'accessory\'. Skipping entry...', index + 1); // we rather count from 1 for the normal people?
210
+ return;
211
+ }
212
+ const accessoryIdentifier = accessoryConfig.accessory;
213
+ const displayName = accessoryConfig.name;
214
+ if (!displayName) {
215
+ log.warn('Could not load accessory %s at position %d as it is missing the required \'name\' property!', accessoryIdentifier, index + 1);
216
+ return;
217
+ }
218
+ let plugin;
219
+ let constructor;
220
+ try {
221
+ plugin = this.pluginManager.getPluginForAccessory(accessoryIdentifier);
222
+ }
223
+ catch (error) {
224
+ log.error(error.message);
225
+ return;
226
+ }
227
+ // check the plugin is not disabled
228
+ if (plugin.disabled) {
229
+ log.warn(`Ignoring config for the accessory "${accessoryIdentifier}" in your config.json as the plugin "${plugin.getPluginIdentifier()}" has been disabled.`);
230
+ return;
231
+ }
232
+ try {
233
+ constructor = plugin.getAccessoryConstructor(accessoryIdentifier);
234
+ }
235
+ catch (error) {
236
+ log.error(`Error loading the accessory "${accessoryIdentifier}" requested in your config.json at position ${index + 1} - this is likely an issue with the "${plugin.getPluginIdentifier()}" plugin.`);
237
+ log.error(error); // error message contains more information and full stack trace
238
+ return;
239
+ }
240
+ const logger = Logger.withPrefix(displayName);
241
+ logger('Initializing %s accessory...', accessoryIdentifier);
242
+ if (accessoryConfig._bridge) {
243
+ // ensure the username is always uppercase
244
+ accessoryConfig._bridge.username = accessoryConfig._bridge.username.toUpperCase();
245
+ try {
246
+ this.validateChildBridgeConfig("accessory" /* PluginType.ACCESSORY */, accessoryIdentifier, accessoryConfig._bridge);
247
+ }
248
+ catch (error) {
249
+ log.error(error.message);
250
+ return;
251
+ }
252
+ let childBridge;
253
+ if (this.childBridges.has(accessoryConfig._bridge.username)) {
254
+ childBridge = this.childBridges.get(accessoryConfig._bridge.username);
255
+ logger(`Adding to existing child bridge ${accessoryConfig._bridge.username}`);
256
+ }
257
+ else {
258
+ logger(`Initializing child bridge ${accessoryConfig._bridge.username}`);
259
+ childBridge = new ChildBridgeService("accessory" /* PluginType.ACCESSORY */, accessoryIdentifier, plugin, accessoryConfig._bridge, this.config, this.options, this.api, this.ipcService, this.externalPortService);
260
+ this.childBridges.set(accessoryConfig._bridge.username, childBridge);
261
+ }
262
+ // add config to child bridge service
263
+ childBridge.addConfig(accessoryConfig);
264
+ return;
265
+ }
266
+ const accessoryInstance = new constructor(logger, accessoryConfig, this.api);
267
+ // pass accessoryIdentifier for UUID generation, and optional parameter uuid_base which can be used instead of displayName for UUID generation
268
+ const accessory = this.bridgeService.createHAPAccessory(plugin, accessoryInstance, displayName, accessoryIdentifier, accessoryConfig.uuid_base);
269
+ if (accessory) {
270
+ try {
271
+ this.bridgeService.bridge.addBridgedAccessory(accessory);
272
+ }
273
+ catch (error) {
274
+ logger.error(`Error loading the accessory "${accessoryIdentifier}" from "${plugin.getPluginIdentifier()}" requested in your config.json:`, error.message);
275
+ }
276
+ }
277
+ else {
278
+ logger.info('Accessory %s returned empty set of services; not adding it to the bridge.', accessoryIdentifier);
279
+ }
280
+ });
281
+ }
282
+ loadPlatforms() {
283
+ log.info(`Loading ${this.config.platforms.length} platforms...`);
284
+ const promises = [];
285
+ this.config.platforms.forEach((platformConfig, index) => {
286
+ if (!platformConfig.platform) {
287
+ log.warn('Your config.json contains an illegal platform configuration object at position %d. '
288
+ + 'Missing property \'platform\'. Skipping entry...', index + 1); // we rather count from 1 for the normal people?
289
+ return;
290
+ }
291
+ const platformIdentifier = platformConfig.platform;
292
+ const displayName = platformConfig.name || platformIdentifier;
293
+ let plugin;
294
+ let constructor;
295
+ // do not load homebridge-config-ui-x when running in service mode
296
+ if (platformIdentifier === 'config' && process.env.UIX_SERVICE_MODE === '1') {
297
+ return;
298
+ }
299
+ try {
300
+ plugin = this.pluginManager.getPluginForPlatform(platformIdentifier);
301
+ }
302
+ catch (error) {
303
+ log.error(error.message);
304
+ return;
305
+ }
306
+ // check the plugin is not disabled
307
+ if (plugin.disabled) {
308
+ log.warn(`Ignoring config for the platform "${platformIdentifier}" in your config.json as the plugin "${plugin.getPluginIdentifier()}" has been disabled.`);
309
+ return;
310
+ }
311
+ try {
312
+ constructor = plugin.getPlatformConstructor(platformIdentifier);
313
+ }
314
+ catch (error) {
315
+ log.error(`Error loading the platform "${platformIdentifier}" requested in your config.json at position ${index + 1} - this is likely an issue with the "${plugin.getPluginIdentifier()}" plugin.`);
316
+ log.error(error); // error message contains more information and full stack trace
317
+ return;
318
+ }
319
+ const logger = Logger.withPrefix(displayName);
320
+ logger('Initializing %s platform...', platformIdentifier);
321
+ if (platformConfig._bridge) {
322
+ // ensure the username is always uppercase
323
+ platformConfig._bridge.username = platformConfig._bridge.username.toUpperCase();
324
+ try {
325
+ this.validateChildBridgeConfig("platform" /* PluginType.PLATFORM */, platformIdentifier, platformConfig._bridge);
326
+ }
327
+ catch (error) {
328
+ log.error(error.message);
329
+ return;
330
+ }
331
+ logger(`Initializing child bridge ${platformConfig._bridge.username}`);
332
+ const childBridge = new ChildBridgeService("platform" /* PluginType.PLATFORM */, platformIdentifier, plugin, platformConfig._bridge, this.config, this.options, this.api, this.ipcService, this.externalPortService);
333
+ this.childBridges.set(platformConfig._bridge.username, childBridge);
334
+ // add config to child bridge service
335
+ childBridge.addConfig(platformConfig);
336
+ return;
337
+ }
338
+ const platform = new constructor(logger, platformConfig, this.api);
339
+ if (HomebridgeAPI.isDynamicPlatformPlugin(platform)) {
340
+ plugin.assignDynamicPlatform(platformIdentifier, platform);
341
+ }
342
+ else if (HomebridgeAPI.isStaticPlatformPlugin(platform)) { // Plugin 1.0, load accessories
343
+ promises.push(this.bridgeService.loadPlatformAccessories(plugin, platform, platformIdentifier, logger));
344
+ }
345
+ else {
346
+ // otherwise it's a IndependentPlatformPlugin which doesn't expose any methods at all.
347
+ // We just call the constructor and let it be enabled.
348
+ }
349
+ });
350
+ return promises;
351
+ }
352
+ /**
353
+ * Validate an external bridge config
354
+ */
355
+ validateChildBridgeConfig(type, identifier, bridgeConfig) {
356
+ if (!validMacAddress(bridgeConfig.username)) {
357
+ throw new Error(`Error loading the ${type} "${identifier}" requested in your config.json - `
358
+ + `not a valid username in _bridge.username: "${bridgeConfig.username}". Must be 6 pairs of colon-separated hexadecimal chars (A-F 0-9), like a MAC address.`);
359
+ }
360
+ if (this.childBridges.has(bridgeConfig.username)) {
361
+ const childBridge = this.childBridges.get(bridgeConfig.username);
362
+ if (type === "platform" /* PluginType.PLATFORM */) {
363
+ // only a single platform can exist on one child bridge
364
+ throw new Error(`Error loading the ${type} "${identifier}" requested in your config.json - `
365
+ + `Duplicate username found in _bridge.username: "${bridgeConfig.username}". Each platform child bridge must have it's own unique username.`);
366
+ }
367
+ else if (childBridge?.identifier !== identifier) {
368
+ // only accessories of the same type can be added to the same child bridge
369
+ throw new Error(`Error loading the ${type} "${identifier}" requested in your config.json - `
370
+ + `Duplicate username found in _bridge.username: "${bridgeConfig.username}". You can only group accessories of the same type in a child bridge.`);
371
+ }
372
+ }
373
+ if (bridgeConfig.username === this.config.bridge.username.toUpperCase()) {
374
+ throw new Error(`Error loading the ${type} "${identifier}" requested in your config.json - `
375
+ + `Username found in _bridge.username: "${bridgeConfig.username}" is the same as the main bridge. Each child bridge platform/accessory must have it's own unique username.`);
376
+ }
377
+ }
378
+ /**
379
+ * Takes care of the IPC Events sent to Homebridge
380
+ */
381
+ initializeIpcEventHandlers() {
382
+ // start ipc service
383
+ this.ipcService.start();
384
+ // handle restart child bridge event
385
+ this.ipcService.on("restartChildBridge" /* IpcIncomingEvent.RESTART_CHILD_BRIDGE */, (username) => {
386
+ if (typeof username === 'string') {
387
+ const childBridge = this.childBridges.get(username.toUpperCase());
388
+ childBridge?.restartChildBridge();
389
+ }
390
+ });
391
+ // handle stop child bridge event
392
+ this.ipcService.on("stopChildBridge" /* IpcIncomingEvent.STOP_CHILD_BRIDGE */, (username) => {
393
+ if (typeof username === 'string') {
394
+ const childBridge = this.childBridges.get(username.toUpperCase());
395
+ childBridge?.stopChildBridge();
396
+ }
397
+ });
398
+ // handle start child bridge event
399
+ this.ipcService.on("startChildBridge" /* IpcIncomingEvent.START_CHILD_BRIDGE */, (username) => {
400
+ if (typeof username === 'string') {
401
+ const childBridge = this.childBridges.get(username.toUpperCase());
402
+ childBridge?.startChildBridge();
403
+ }
404
+ });
405
+ this.ipcService.on("childBridgeMetadataRequest" /* IpcIncomingEvent.CHILD_BRIDGE_METADATA_REQUEST */, () => {
406
+ this.ipcService.sendMessage("childBridgeMetadataResponse" /* IpcOutgoingEvent.CHILD_BRIDGE_METADATA_RESPONSE */, Array.from(this.childBridges.values()).map(x => x.getMetadata()));
407
+ });
408
+ }
409
+ printSetupInfo(pin) {
410
+ /* eslint-disable no-console */
411
+ console.log('Setup Payload:');
412
+ console.log(this.bridgeService.bridge.setupURI());
413
+ if (!this.options.hideQRCode) {
414
+ console.log('Scan this code with your HomeKit app on your iOS device to pair with Homebridge:');
415
+ qrcode.setErrorLevel('M'); // HAP specifies level M or higher for ECC
416
+ qrcode.generate(this.bridgeService.bridge.setupURI());
417
+ console.log('Or enter this code with your HomeKit app on your iOS device to pair with Homebridge:');
418
+ }
419
+ else {
420
+ console.log('Enter this code with your HomeKit app on your iOS device to pair with Homebridge:');
421
+ }
422
+ console.log(chalk.black.bgWhite(' '));
423
+ console.log(chalk.black.bgWhite(' ┌────────────┐ '));
424
+ console.log(chalk.black.bgWhite(` │ ${pin} │ `));
425
+ console.log(chalk.black.bgWhite(' └────────────┘ '));
426
+ console.log(chalk.black.bgWhite(' '));
427
+ /* eslint-enable no-console */
428
+ }
429
+ }
430
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,OAAO,MAAM,cAAc,CAAA;AAElC,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,MAAM,MAAM,iBAAiB,CAAA;AAEpC,OAAO,EAAE,aAAa,EAAc,MAAM,UAAU,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAsC,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAChF,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAE/C,MAAM,GAAG,GAAG,MAAM,CAAC,QAAQ,CAAA;AAc3B,gDAAgD;AAChD,MAAM,CAAN,IAAkB,YAejB;AAfD,WAAkB,YAAY;IAC5B;;OAEG;IACH,mCAAmB,CAAA;IAEnB;;OAEG;IACH,yBAAS,CAAA;IAET;;OAEG;IACH,6BAAa,CAAA;AACf,CAAC,EAfiB,YAAY,KAAZ,YAAY,QAe7B;AAED,MAAM,OAAO,MAAM;IAgBP;IAfO,GAAG,CAAe;IAClB,aAAa,CAAe;IAC5B,aAAa,CAAe;IAC5B,UAAU,CAAY;IACtB,mBAAmB,CAAqB;IAExC,MAAM,CAAkB;IAEzC,sCAAsC;IACrB,YAAY,GAAwC,IAAI,GAAG,EAAE,CAAA;I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CAAC,yBAAyB,CAAC,CAAC,CAAA;QAC3D,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,yBAAyB,CAAC,CAAC,CAAA;QAC3D,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAAC,CAAA;QACvD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,yBAAyB,CAAC,CAAC,CAAA;QAC3D,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,yBAAyB,CAAC,CAAC,CAAA;QAC3D,8BAA8B;IAChC,CAAC;CACF"}
@@ -0,0 +1,13 @@
1
+ export declare class StorageService {
2
+ baseDirectory: string;
3
+ constructor(baseDirectory: string);
4
+ initSync(): void;
5
+ getItemSync<T>(itemName: string): T | null;
6
+ getItem<T>(itemName: string): Promise<T | null>;
7
+ setItemSync(itemName: string, data: Record<any, any> | Array<any>): void;
8
+ setItem(itemName: string, data: Record<any, any> | Array<any>): Promise<void>;
9
+ copyItem(srcItemName: string, destItemName: string): Promise<void>;
10
+ copyItemSync(srcItemName: string, destItemName: string): void;
11
+ removeItemSync(itemName: string): void;
12
+ }
13
+ //# sourceMappingURL=storageService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storageService.d.ts","sourceRoot":"","sources":["../src/storageService.ts"],"names":[],"mappings":"AAIA,qBAAa,cAAc;IAEhB,aAAa,EAAE,MAAM;gBAArB,aAAa,EAAE,MAAM;IAGvB,QAAQ,IAAI,IAAI;IAIhB,WAAW,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI;IAUpC,OAAO,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IAUrD,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI;IAIxE,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAI7E,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIlE,YAAY,CAAC,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI;IAI7D,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;CAG9C"}
@@ -0,0 +1,41 @@
1
+ import path from 'node:path';
2
+ import fs from 'fs-extra';
3
+ export class StorageService {
4
+ baseDirectory;
5
+ constructor(baseDirectory) {
6
+ this.baseDirectory = baseDirectory;
7
+ }
8
+ initSync() {
9
+ return fs.ensureDirSync(this.baseDirectory);
10
+ }
11
+ getItemSync(itemName) {
12
+ const filePath = path.resolve(this.baseDirectory, itemName);
13
+ if (!fs.pathExistsSync(filePath)) {
14
+ return null;
15
+ }
16
+ return fs.readJsonSync(filePath);
17
+ }
18
+ async getItem(itemName) {
19
+ const filePath = path.resolve(this.baseDirectory, itemName);
20
+ if (!await fs.pathExists(filePath)) {
21
+ return null;
22
+ }
23
+ return await fs.readJson(filePath);
24
+ }
25
+ setItemSync(itemName, data) {
26
+ return fs.writeJsonSync(path.resolve(this.baseDirectory, itemName), data);
27
+ }
28
+ setItem(itemName, data) {
29
+ return fs.writeJson(path.resolve(this.baseDirectory, itemName), data);
30
+ }
31
+ copyItem(srcItemName, destItemName) {
32
+ return fs.copyFile(path.resolve(this.baseDirectory, srcItemName), path.resolve(this.baseDirectory, destItemName));
33
+ }
34
+ copyItemSync(srcItemName, destItemName) {
35
+ return fs.copyFileSync(path.resolve(this.baseDirectory, srcItemName), path.resolve(this.baseDirectory, destItemName));
36
+ }
37
+ removeItemSync(itemName) {
38
+ return fs.removeSync(path.resolve(this.baseDirectory, itemName));
39
+ }
40
+ }
41
+ //# sourceMappingURL=storageService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storageService.js","sourceRoot":"","sources":["../src/storageService.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B,OAAO,EAAE,MAAM,UAAU,CAAA;AAEzB,MAAM,OAAO,cAAc;IAEhB;IADT,YACS,aAAqB;QAArB,kBAAa,GAAb,aAAa,CAAQ;IAC3B,CAAC;IAEG,QAAQ;QACb,OAAO,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;IAC7C,CAAC;IAEM,WAAW,CAAI,QAAgB;QACpC,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAA;QAE3D,IAAI,CAAC,EAAE,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,CAAC;YACjC,OAAO,IAAI,CAAA;QACb,CAAC;QAED,OAAO,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAA;IAClC,CAAC;IAEM,KAAK,CAAC,OAAO,CAAI,QAAgB;QACtC,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAA;QAE3D,IAAI,CAAC,MAAM,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YACnC,OAAO,IAAI,CAAA;QACb,CAAC;QAED,OAAO,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;IACpC,CAAC;IAEM,WAAW,CAAC,QAAgB,EAAE,IAAmC;QACtE,OAAO,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,EAAE,IAAI,CAAC,CAAA;IAC3E,CAAC;IAEM,OAAO,CAAC,QAAgB,EAAE,IAAmC;QAClE,OAAO,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,EAAE,IAAI,CAAC,CAAA;IACvE,CAAC;IAEM,QAAQ,CAAC,WAAmB,EAAE,YAAoB;QACvD,OAAO,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,WAAW,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC,CAAA;IACnH,CAAC;IAEM,YAAY,CAAC,WAAmB,EAAE,YAAoB;QAC3D,OAAO,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,WAAW,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC,CAAA;IACvH,CAAC;IAEM,cAAc,CAAC,QAAgB;QACpC,OAAO,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC,CAAA;IAClE,CAAC;CACF"}
package/dist/user.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Manages user settings and storage locations.
3
+ */
4
+ export declare class User {
5
+ private static customStoragePath?;
6
+ private static storageAccessed;
7
+ static configPath(): string;
8
+ static persistPath(): string;
9
+ static cachedAccessoryPath(): string;
10
+ static storagePath(): string;
11
+ static setStoragePath(...storagePathSegments: string[]): void;
12
+ }
13
+ //# sourceMappingURL=user.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../src/user.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,qBAAa,IAAI;IACf,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAQ;IACzC,OAAO,CAAC,MAAM,CAAC,eAAe,CAAQ;IAEtC,MAAM,CAAC,UAAU,IAAI,MAAM;IAI3B,MAAM,CAAC,WAAW,IAAI,MAAM;IAI5B,MAAM,CAAC,mBAAmB,IAAI,MAAM;IAIpC,MAAM,CAAC,WAAW,IAAI,MAAM;WAMd,cAAc,CAAC,GAAG,mBAAmB,EAAE,MAAM,EAAE,GAAG,IAAI;CAOrE"}
package/dist/user.js ADDED
@@ -0,0 +1,29 @@
1
+ import os from 'node:os';
2
+ import path from 'node:path';
3
+ /**
4
+ * Manages user settings and storage locations.
5
+ */
6
+ export class User {
7
+ static customStoragePath;
8
+ static storageAccessed = false;
9
+ static configPath() {
10
+ return path.join(User.storagePath(), 'config.json');
11
+ }
12
+ static persistPath() {
13
+ return path.join(User.storagePath(), 'persist'); // hap-nodejs data is stored here
14
+ }
15
+ static cachedAccessoryPath() {
16
+ return path.join(User.storagePath(), 'accessories');
17
+ }
18
+ static storagePath() {
19
+ User.storageAccessed = true;
20
+ return User.customStoragePath ? User.customStoragePath : path.join(os.homedir(), '.homebridge');
21
+ }
22
+ static setStoragePath(...storagePathSegments) {
23
+ if (User.storageAccessed) {
24
+ throw new Error('Storage path was already accessed and cannot be changed anymore. Try initializing your custom storage path earlier!');
25
+ }
26
+ User.customStoragePath = path.resolve(...storagePathSegments);
27
+ }
28
+ }
29
+ //# sourceMappingURL=user.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user.js","sourceRoot":"","sources":["../src/user.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B;;GAEG;AACH,MAAM,OAAO,IAAI;IACP,MAAM,CAAC,iBAAiB,CAAS;IACjC,MAAM,CAAC,eAAe,GAAG,KAAK,CAAA;IAEtC,MAAM,CAAC,UAAU;QACf,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,aAAa,CAAC,CAAA;IACrD,CAAC;IAED,MAAM,CAAC,WAAW;QAChB,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,SAAS,CAAC,CAAA,CAAC,iCAAiC;IACnF,CAAC;IAED,MAAM,CAAC,mBAAmB;QACxB,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,aAAa,CAAC,CAAA;IACrD,CAAC;IAED,MAAM,CAAC,WAAW;QAChB,IAAI,CAAC,eAAe,GAAG,IAAI,CAAA;QAE3B,OAAO,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,aAAa,CAAC,CAAA;IACjG,CAAC;IAEM,MAAM,CAAC,cAAc,CAAC,GAAG,mBAA6B;QAC3D,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CAAC,qHAAqH,CAAC,CAAA;QACxI,CAAC;QAED,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,mBAAmB,CAAC,CAAA;IAC/D,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { Buffer } from 'node:buffer';
2
+ export type MacAddress = string;
3
+ export declare function validMacAddress(address: string): boolean;
4
+ export declare function generate(data: string | Buffer | NodeJS.TypedArray | DataView): MacAddress;
5
+ //# sourceMappingURL=mac.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mac.d.ts","sourceRoot":"","sources":["../../src/util/mac.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAMzC,MAAM,MAAM,UAAU,GAAG,MAAM,CAAA;AAE/B,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAExD;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC,UAAU,GAAG,QAAQ,GAAG,UAAU,CAOzF"}
@@ -0,0 +1,14 @@
1
+ /* global NodeJS */
2
+ import crypto from 'node:crypto';
3
+ const validMac = /^(?:[0-9A-F]{2}:){5}[0-9A-F]{2}$/;
4
+ export function validMacAddress(address) {
5
+ return validMac.test(address);
6
+ }
7
+ export function generate(data) {
8
+ const sha1sum = crypto.createHash('sha1');
9
+ sha1sum.update(data);
10
+ const s = sha1sum.digest('hex');
11
+ let i = 0;
12
+ return 'xx:xx:xx:xx:xx:xx'.replace(/x/g, () => s[i++]).toUpperCase();
13
+ }
14
+ //# sourceMappingURL=mac.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mac.js","sourceRoot":"","sources":["../../src/util/mac.ts"],"names":[],"mappings":"AAAA,mBAAmB;AAInB,OAAO,MAAM,MAAM,aAAa,CAAA;AAEhC,MAAM,QAAQ,GAAG,kCAAkC,CAAA;AAInD,MAAM,UAAU,eAAe,CAAC,OAAe;IAC7C,OAAO,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;AAC/B,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,IAAoD;IAC3E,MAAM,OAAO,GAAG,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAA;IACzC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IACpB,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IAE/B,IAAI,CAAC,GAAG,CAAC,CAAA;IACT,OAAO,mBAAmB,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAA;AACtE,CAAC"}
@@ -0,0 +1,3 @@
1
+ export default function getVersion(): string;
2
+ export declare function getRequiredNodeVersion(): string;
3
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAYA,MAAM,CAAC,OAAO,UAAU,UAAU,IAAI,MAAM,CAE3C;AAED,wBAAgB,sBAAsB,IAAI,MAAM,CAE/C"}
@@ -0,0 +1,16 @@
1
+ import fs from 'node:fs';
2
+ import { dirname, join } from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+ const __filename = fileURLToPath(import.meta.url);
5
+ const __dirname = dirname(__filename);
6
+ function loadPackageJson() {
7
+ const packageJSONPath = join(__dirname, '../package.json');
8
+ return JSON.parse(fs.readFileSync(packageJSONPath, { encoding: 'utf8' }));
9
+ }
10
+ export default function getVersion() {
11
+ return loadPackageJson().version;
12
+ }
13
+ export function getRequiredNodeVersion() {
14
+ return loadPackageJson().engines.node;
15
+ }
16
+ //# sourceMappingURL=version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AACjD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;AAErC,SAAS,eAAe;IACtB,MAAM,eAAe,GAAG,IAAI,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAA;IAC1D,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,eAAe,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC,CAAA;AAC3E,CAAC;AAED,MAAM,CAAC,OAAO,UAAU,UAAU;IAChC,OAAO,eAAe,EAAE,CAAC,OAAO,CAAA;AAClC,CAAC;AAED,MAAM,UAAU,sBAAsB;IACpC,OAAO,eAAe,EAAE,CAAC,OAAO,CAAC,IAAI,CAAA;AACvC,CAAC"}