homebridge 2.0.0-alpha.4 → 2.0.0-alpha.40
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.
- package/README.md +1 -1
- package/bin/homebridge.js +22 -0
- package/config-sample.json +12 -1
- package/dist/api.d.ts +226 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +166 -0
- package/dist/api.js.map +1 -0
- package/dist/bridgeService.d.ts +125 -0
- package/dist/bridgeService.d.ts.map +1 -0
- package/dist/bridgeService.js +396 -0
- package/dist/bridgeService.js.map +1 -0
- package/dist/childBridgeFork.d.ts +38 -0
- package/dist/childBridgeFork.d.ts.map +1 -0
- package/dist/childBridgeFork.js +241 -2
- package/dist/childBridgeFork.js.map +1 -7
- package/dist/childBridgeService.d.ts +203 -0
- package/dist/childBridgeService.d.ts.map +1 -0
- package/dist/childBridgeService.js +451 -0
- package/dist/childBridgeService.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +90 -2
- package/dist/cli.js.map +1 -7
- package/dist/externalPortService.d.ts +33 -0
- package/dist/externalPortService.d.ts.map +1 -0
- package/dist/externalPortService.js +59 -0
- package/dist/externalPortService.js.map +1 -0
- package/dist/index.d.ts +85 -1099
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -2
- package/dist/index.js.map +1 -7
- package/dist/ipcService.d.ts +30 -0
- package/dist/ipcService.d.ts.map +1 -0
- package/dist/ipcService.js +49 -0
- package/dist/ipcService.js.map +1 -0
- package/dist/logger.d.ts +78 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +138 -0
- package/dist/logger.js.map +1 -0
- package/dist/matterConfigValidator.d.ts +34 -0
- package/dist/matterConfigValidator.d.ts.map +1 -0
- package/dist/matterConfigValidator.js +249 -0
- package/dist/matterConfigValidator.js.map +1 -0
- package/dist/matterService.d.ts +168 -0
- package/dist/matterService.d.ts.map +1 -0
- package/dist/matterService.js +677 -0
- package/dist/matterService.js.map +1 -0
- package/dist/matterTypes.d.ts +20 -0
- package/dist/matterTypes.d.ts.map +1 -0
- package/dist/matterTypes.js +278 -0
- package/dist/matterTypes.js.map +1 -0
- package/dist/platformAccessory.d.ts +56 -0
- package/dist/platformAccessory.d.ts.map +1 -0
- package/dist/platformAccessory.js +105 -0
- package/dist/platformAccessory.js.map +1 -0
- package/dist/plugin.d.ts +30 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +182 -0
- package/dist/plugin.js.map +1 -0
- package/dist/pluginManager.d.ts +77 -0
- package/dist/pluginManager.d.ts.map +1 -0
- package/dist/pluginManager.js +375 -0
- package/dist/pluginManager.js.map +1 -0
- package/dist/server.d.ts +61 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +467 -0
- package/dist/server.js.map +1 -0
- package/dist/storageService.d.ts +13 -0
- package/dist/storageService.d.ts.map +1 -0
- package/dist/storageService.js +41 -0
- package/dist/storageService.js.map +1 -0
- package/dist/user.d.ts +13 -0
- package/dist/user.d.ts.map +1 -0
- package/dist/user.js +29 -0
- package/dist/user.js.map +1 -0
- package/dist/util/mac.d.ts +5 -0
- package/dist/util/mac.d.ts.map +1 -0
- package/dist/util/mac.js +14 -0
- package/dist/util/mac.js.map +1 -0
- package/dist/util/matter-cli.d.ts +3 -0
- package/dist/util/matter-cli.d.ts.map +1 -0
- package/dist/util/matter-cli.js +211 -0
- package/dist/util/matter-cli.js.map +1 -0
- package/dist/version.d.ts +3 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +16 -0
- package/dist/version.js.map +1 -0
- package/package.json +31 -34
- package/bin/homebridge +0 -19
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
<img src="https://media.giphy.com/media/10l79ICohTu4iQ/giphy.gif" align="right" alt="Unlocking Door">
|
|
18
18
|
|
|
19
|
-
**Homebridge** is a lightweight Node.js server you can run on your home network
|
|
19
|
+
**Homebridge** is a lightweight Node.js server you can run on your home network to emulate the HomeKit Accessory Protocol (HAP). It supports plugins, which are community-contributed modules that provide a basic bridge from HomeKit to various 3rd-party APIs provided by manufacturers of "smart home" devices.
|
|
20
20
|
|
|
21
21
|
Since Siri supports devices added through HomeKit, this means that with Homebridge you can ask Siri to control devices that don't have any support for HomeKit at all. For instance, using just some of the available plugins, you can say:
|
|
22
22
|
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
//
|
|
4
|
+
// This executable sets up the environment and runs the Homebridge CLI.
|
|
5
|
+
//
|
|
6
|
+
|
|
7
|
+
import { realpathSync } from 'node:fs'
|
|
8
|
+
import { dirname, join } from 'node:path'
|
|
9
|
+
import process from 'node:process'
|
|
10
|
+
import { fileURLToPath, pathToFileURL } from 'node:url'
|
|
11
|
+
|
|
12
|
+
process.title = 'homebridge'
|
|
13
|
+
|
|
14
|
+
// Find the Homebridge lib
|
|
15
|
+
const __filename = fileURLToPath(import.meta.url)
|
|
16
|
+
const lib = join(dirname(realpathSync(__filename)), '../dist')
|
|
17
|
+
|
|
18
|
+
// Convert the path to a file URL
|
|
19
|
+
const libUrl = pathToFileURL(join(lib, 'cli.js')).href
|
|
20
|
+
|
|
21
|
+
// Run Homebridge
|
|
22
|
+
import(libUrl).then(({ default: run }) => run())
|
package/config-sample.json
CHANGED
|
@@ -7,7 +7,18 @@
|
|
|
7
7
|
"port": 51826,
|
|
8
8
|
"pin": "031-45-154"
|
|
9
9
|
},
|
|
10
|
-
|
|
10
|
+
"matter": {
|
|
11
|
+
"_comment": "Optional Matter protocol support for Homebridge. When enabled, accessories can be published via both HomeKit HAP and Matter protocols simultaneously.",
|
|
12
|
+
"enabled": false,
|
|
13
|
+
"port": 5540,
|
|
14
|
+
"discriminator": 3840,
|
|
15
|
+
"passcode": 20202021,
|
|
16
|
+
"vendorId": 65521,
|
|
17
|
+
"productId": 32769,
|
|
18
|
+
"deviceName": "Homebridge Matter Bridge",
|
|
19
|
+
"deviceType": 22,
|
|
20
|
+
"_note": "Set 'enabled' to true to enable Matter support. Accessories will be available via both HomeKit and Matter protocols. Plugins can use api.publishMatterAccessories() to publish accessories to Matter."
|
|
21
|
+
},
|
|
11
22
|
"description": "This is an example configuration file with one fake accessory and one fake platform. You can use this as a template for creating your own configuration file containing devices you actually own.",
|
|
12
23
|
"ports": {
|
|
13
24
|
"start": 52100,
|
package/dist/api.d.ts
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import type { Controller, Service } from 'hap-nodejs';
|
|
2
|
+
import type { AccessoryConfig, PlatformConfig } from './bridgeService.js';
|
|
3
|
+
import type { Logging } from './logger.js';
|
|
4
|
+
import { EventEmitter } from 'node:events';
|
|
5
|
+
import hapNodeJs from 'hap-nodejs';
|
|
6
|
+
import { getMatterClustersForHAPService, getMatterDeviceTypeForHAPService, HAPToMatterClusterMapping, HAPToMatterDeviceMapping, MatterClusters, MatterDeviceTypes } from './matterTypes.js';
|
|
7
|
+
import { PlatformAccessory } from './platformAccessory.js';
|
|
8
|
+
import { User } from './user.js';
|
|
9
|
+
export type HAP = typeof hapNodeJs;
|
|
10
|
+
export type HAPLegacyTypes = typeof hapNodeJs.LegacyTypes;
|
|
11
|
+
export type PluginIdentifier = PluginName | ScopedPluginName;
|
|
12
|
+
export type PluginName = string;
|
|
13
|
+
export type ScopedPluginName = string;
|
|
14
|
+
export type AccessoryName = string;
|
|
15
|
+
export type PlatformName = string;
|
|
16
|
+
export type AccessoryIdentifier = string;
|
|
17
|
+
export type PlatformIdentifier = string;
|
|
18
|
+
export declare const enum PluginType {
|
|
19
|
+
ACCESSORY = "accessory",
|
|
20
|
+
PLATFORM = "platform"
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The {PluginInitializer} is a method which must be the default export for every homebridge plugin.
|
|
24
|
+
* It is called once the plugin is loaded from disk.
|
|
25
|
+
*/
|
|
26
|
+
export interface PluginInitializer {
|
|
27
|
+
/**
|
|
28
|
+
* When the initializer is called the plugin must use the provided api instance and call the appropriate
|
|
29
|
+
* register methods - {@link API.registerAccessory} or {@link API.registerPlatform} - in order to
|
|
30
|
+
* correctly register for the following startup sequence.
|
|
31
|
+
*
|
|
32
|
+
* @param {API} api
|
|
33
|
+
*/
|
|
34
|
+
(api: API): void | Promise<void>;
|
|
35
|
+
}
|
|
36
|
+
export interface AccessoryPluginConstructor {
|
|
37
|
+
new (logger: Logging, config: AccessoryConfig, api: API): AccessoryPlugin;
|
|
38
|
+
}
|
|
39
|
+
export interface AccessoryPlugin {
|
|
40
|
+
/**
|
|
41
|
+
* Optional method which will be called if an 'identify' of an Accessory is requested by HomeKit.
|
|
42
|
+
*/
|
|
43
|
+
identify?: () => void;
|
|
44
|
+
/**
|
|
45
|
+
* This method will be called once on startup, to query all services to be exposed by the Accessory.
|
|
46
|
+
* All event handlers for characteristics should be set up before the array is returned.
|
|
47
|
+
*
|
|
48
|
+
* @returns {Service[]} services - returned services will be added to the Accessory
|
|
49
|
+
*/
|
|
50
|
+
getServices: () => Service[];
|
|
51
|
+
/**
|
|
52
|
+
* This method will be called once on startup, to query all controllers to be exposed by the Accessory.
|
|
53
|
+
* It is optional to implement.
|
|
54
|
+
*
|
|
55
|
+
* This includes controllers like the RemoteController or the CameraController.
|
|
56
|
+
* Any necessary controller specific setup should have been done when returning the array.
|
|
57
|
+
* In most cases the plugin will only return an array of the size 1.
|
|
58
|
+
*
|
|
59
|
+
* In the case that the Plugin does not add any additional services (returned by {@link getServices}) the
|
|
60
|
+
* method {@link getServices} must be defined in any way and should just return an empty array.
|
|
61
|
+
*
|
|
62
|
+
* @returns {Controller[]} controllers - returned controllers will be configured for the Accessory
|
|
63
|
+
*/
|
|
64
|
+
getControllers?: () => Controller[];
|
|
65
|
+
}
|
|
66
|
+
export interface PlatformPluginConstructor<Config extends PlatformConfig = PlatformConfig> {
|
|
67
|
+
new (logger: Logging, config: Config, api: API): DynamicPlatformPlugin | StaticPlatformPlugin | IndependentPlatformPlugin;
|
|
68
|
+
}
|
|
69
|
+
export interface PlatformPlugin {
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Platform that is able to dynamically add or remove accessories.
|
|
73
|
+
* All configured accessories are stored to disk and recreated on startup.
|
|
74
|
+
* Accessories can be added or removed by using {@link API.registerPlatformAccessories} or {@link API.unregisterPlatformAccessories}.
|
|
75
|
+
*/
|
|
76
|
+
export interface DynamicPlatformPlugin extends PlatformPlugin {
|
|
77
|
+
/**
|
|
78
|
+
* This method is called for every PlatformAccessory, which is recreated from disk on startup.
|
|
79
|
+
* It should be used to properly initialize the Accessory and setup all event handlers for
|
|
80
|
+
* all services and their characteristics.
|
|
81
|
+
*
|
|
82
|
+
* @param {PlatformAccessory} accessory which needs to be configured
|
|
83
|
+
*/
|
|
84
|
+
configureAccessory: (accessory: PlatformAccessory) => void;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Platform that exposes all available characteristics at the start of the plugin.
|
|
88
|
+
* The set of accessories can not change at runtime.
|
|
89
|
+
* The bridge waits for all callbacks to return before it is published and accessible by HomeKit controllers.
|
|
90
|
+
*/
|
|
91
|
+
export interface StaticPlatformPlugin extends PlatformPlugin {
|
|
92
|
+
/**
|
|
93
|
+
* This method is called once at startup. The Platform should pass all accessories which need to be created
|
|
94
|
+
* to the callback in form of a {@link AccessoryPlugin}.
|
|
95
|
+
* The Platform must respond in a timely manner as otherwise the startup of the bridge would be unnecessarily delayed.
|
|
96
|
+
*
|
|
97
|
+
* @param {(foundAccessories: AccessoryPlugin[]) => void} callback
|
|
98
|
+
*/
|
|
99
|
+
accessories: (callback: (foundAccessories: AccessoryPlugin[]) => void) => void;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Platform that does not aim to add any accessories to the main bridge accessory.
|
|
103
|
+
* This platform should be used if for example a plugin aims to only expose external accessories.
|
|
104
|
+
* It should also be used when the platform doesn't intend to expose any accessories at all, like plugins
|
|
105
|
+
* providing a UI for homebridge.
|
|
106
|
+
*/
|
|
107
|
+
export interface IndependentPlatformPlugin extends PlatformPlugin {
|
|
108
|
+
}
|
|
109
|
+
export declare const enum APIEvent {
|
|
110
|
+
/**
|
|
111
|
+
* Event is fired once homebridge has finished with booting up and initializing all components and plugins.
|
|
112
|
+
* When this event is fired it is possible that the Bridge accessory isn't published yet, if homebridge still needs
|
|
113
|
+
* to wait for some {@see StaticPlatformPlugin | StaticPlatformPlugins} to finish accessory creation.
|
|
114
|
+
*/
|
|
115
|
+
DID_FINISH_LAUNCHING = "didFinishLaunching",
|
|
116
|
+
/**
|
|
117
|
+
* This event is fired when homebridge gets shutdown. This could be a regular shutdown or an unexpected crash.
|
|
118
|
+
* At this stage all Accessories are already unpublished and all PlatformAccessories are already saved to disk!
|
|
119
|
+
*/
|
|
120
|
+
SHUTDOWN = "shutdown"
|
|
121
|
+
}
|
|
122
|
+
export declare const enum InternalAPIEvent {
|
|
123
|
+
REGISTER_ACCESSORY = "registerAccessory",
|
|
124
|
+
REGISTER_PLATFORM = "registerPlatform",
|
|
125
|
+
PUBLISH_EXTERNAL_ACCESSORIES = "publishExternalAccessories",
|
|
126
|
+
REGISTER_PLATFORM_ACCESSORIES = "registerPlatformAccessories",
|
|
127
|
+
UPDATE_PLATFORM_ACCESSORIES = "updatePlatformAccessories",
|
|
128
|
+
UNREGISTER_PLATFORM_ACCESSORIES = "unregisterPlatformAccessories",
|
|
129
|
+
PUBLISH_MATTER_ACCESSORIES = "publishMatterAccessories",
|
|
130
|
+
UNPUBLISH_MATTER_ACCESSORIES = "unpublishMatterAccessories"
|
|
131
|
+
}
|
|
132
|
+
export interface API {
|
|
133
|
+
/**
|
|
134
|
+
* The homebridge API version as a floating point number.
|
|
135
|
+
*/
|
|
136
|
+
readonly version: number;
|
|
137
|
+
/**
|
|
138
|
+
* The current homebridge semver version.
|
|
139
|
+
*/
|
|
140
|
+
readonly serverVersion: string;
|
|
141
|
+
readonly user: typeof User;
|
|
142
|
+
readonly hap: HAP;
|
|
143
|
+
readonly hapLegacyTypes: HAPLegacyTypes;
|
|
144
|
+
readonly platformAccessory: typeof PlatformAccessory;
|
|
145
|
+
readonly matter: {
|
|
146
|
+
readonly clusters: typeof MatterClusters;
|
|
147
|
+
readonly deviceTypes: typeof MatterDeviceTypes;
|
|
148
|
+
readonly hapToMatterClusterMapping: typeof HAPToMatterClusterMapping;
|
|
149
|
+
readonly hapToMatterDeviceMapping: typeof HAPToMatterDeviceMapping;
|
|
150
|
+
readonly getMatterDeviceTypeForHAPService: typeof getMatterDeviceTypeForHAPService;
|
|
151
|
+
readonly getMatterClustersForHAPService: typeof getMatterClustersForHAPService;
|
|
152
|
+
};
|
|
153
|
+
/**
|
|
154
|
+
* Returns true if the current running homebridge version is greater or equal to the
|
|
155
|
+
* passed version string.
|
|
156
|
+
*
|
|
157
|
+
* Example:
|
|
158
|
+
*
|
|
159
|
+
* We assume the homebridge version 1.3.0-beta.12 ({@link serverVersion}) and the following example calls below
|
|
160
|
+
* ```
|
|
161
|
+
* versionGreaterOrEqual("1.2.0"); // will return true
|
|
162
|
+
* versionGreaterOrEqual("1.3.0"); // will return false (the RELEASE version 1.3.0 is bigger than the BETA version 1.3.0-beta.12)
|
|
163
|
+
* versionGreaterOrEqual("1.3.0-beta.8); // will return true
|
|
164
|
+
* ```
|
|
165
|
+
*
|
|
166
|
+
* @param version
|
|
167
|
+
*/
|
|
168
|
+
versionGreaterOrEqual: (version: string) => boolean;
|
|
169
|
+
registerAccessory: ((accessoryName: AccessoryName, constructor: AccessoryPluginConstructor) => void) & ((pluginIdentifier: PluginIdentifier, accessoryName: AccessoryName, constructor: AccessoryPluginConstructor) => void);
|
|
170
|
+
registerPlatform: (<Config extends PlatformConfig>(platformName: PlatformName, constructor: PlatformPluginConstructor<Config>) => void) & (<Config extends PlatformConfig>(pluginIdentifier: PluginIdentifier, platformName: PlatformName, constructor: PlatformPluginConstructor<Config>) => void);
|
|
171
|
+
registerPlatformAccessories: (pluginIdentifier: PluginIdentifier, platformName: PlatformName, accessories: PlatformAccessory[]) => void;
|
|
172
|
+
updatePlatformAccessories: (accessories: PlatformAccessory[]) => void;
|
|
173
|
+
unregisterPlatformAccessories: (pluginIdentifier: PluginIdentifier, platformName: PlatformName, accessories: PlatformAccessory[]) => void;
|
|
174
|
+
/**
|
|
175
|
+
* Publish accessories via Matter protocol in addition to HomeKit HAP
|
|
176
|
+
* @param pluginIdentifier - Plugin identifier
|
|
177
|
+
* @param accessories - Array of accessories to publish via Matter
|
|
178
|
+
*/
|
|
179
|
+
publishMatterAccessories: (pluginIdentifier: PluginIdentifier, accessories: PlatformAccessory[]) => void;
|
|
180
|
+
/**
|
|
181
|
+
* Unpublish accessories from Matter protocol
|
|
182
|
+
* @param pluginIdentifier - Plugin identifier
|
|
183
|
+
* @param accessories - Array of accessories to unpublish from Matter
|
|
184
|
+
*/
|
|
185
|
+
unpublishMatterAccessories: (pluginIdentifier: PluginIdentifier, accessories: PlatformAccessory[]) => void;
|
|
186
|
+
publishExternalAccessories: (pluginIdentifier: PluginIdentifier, accessories: PlatformAccessory[]) => void;
|
|
187
|
+
on: ((event: 'didFinishLaunching', listener: () => void) => this) & ((event: 'shutdown', listener: () => void) => this);
|
|
188
|
+
}
|
|
189
|
+
export declare interface HomebridgeAPI {
|
|
190
|
+
on: ((event: 'didFinishLaunching', listener: () => void) => this) & ((event: 'shutdown', listener: () => void) => this) & ((event: InternalAPIEvent.REGISTER_ACCESSORY, listener: (accessoryName: AccessoryName, accessoryConstructor: AccessoryPluginConstructor, pluginIdentifier?: PluginIdentifier) => void) => this) & ((event: InternalAPIEvent.REGISTER_PLATFORM, listener: (platformName: PlatformName, platformConstructor: PlatformPluginConstructor, pluginIdentifier?: PluginIdentifier) => void) => this) & ((event: InternalAPIEvent.PUBLISH_EXTERNAL_ACCESSORIES, listener: (accessories: PlatformAccessory[]) => void) => this) & ((event: InternalAPIEvent.REGISTER_PLATFORM_ACCESSORIES, listener: (accessories: PlatformAccessory[]) => void) => this) & ((event: InternalAPIEvent.UPDATE_PLATFORM_ACCESSORIES, listener: (accessories: PlatformAccessory[]) => void) => this) & ((event: InternalAPIEvent.UNREGISTER_PLATFORM_ACCESSORIES, listener: (accessories: PlatformAccessory[]) => void) => this) & ((event: InternalAPIEvent.PUBLISH_MATTER_ACCESSORIES, listener: (accessories: PlatformAccessory[]) => void) => this) & ((event: InternalAPIEvent.UNPUBLISH_MATTER_ACCESSORIES, listener: (accessories: PlatformAccessory[]) => void) => this);
|
|
191
|
+
emit: ((event: 'didFinishLaunching') => boolean) & ((event: 'shutdown') => boolean) & ((event: InternalAPIEvent.REGISTER_ACCESSORY, accessoryName: AccessoryName, accessoryConstructor: AccessoryPluginConstructor, pluginIdentifier?: PluginIdentifier) => boolean) & ((event: InternalAPIEvent.REGISTER_PLATFORM, platformName: PlatformName, platformConstructor: PlatformPluginConstructor, pluginIdentifier?: PluginIdentifier) => boolean) & ((event: InternalAPIEvent.PUBLISH_EXTERNAL_ACCESSORIES, accessories: PlatformAccessory[]) => boolean) & ((event: InternalAPIEvent.REGISTER_PLATFORM_ACCESSORIES, accessories: PlatformAccessory[]) => boolean) & ((event: InternalAPIEvent.UPDATE_PLATFORM_ACCESSORIES, accessories: PlatformAccessory[]) => boolean) & ((event: InternalAPIEvent.UNREGISTER_PLATFORM_ACCESSORIES, accessories: PlatformAccessory[]) => boolean) & ((event: InternalAPIEvent.PUBLISH_MATTER_ACCESSORIES, accessories: PlatformAccessory[]) => boolean) & ((event: InternalAPIEvent.UNPUBLISH_MATTER_ACCESSORIES, accessories: PlatformAccessory[]) => boolean);
|
|
192
|
+
}
|
|
193
|
+
export declare class HomebridgeAPI extends EventEmitter implements API {
|
|
194
|
+
readonly version = 2.7;
|
|
195
|
+
readonly serverVersion: string;
|
|
196
|
+
readonly user: typeof User;
|
|
197
|
+
readonly hap: typeof hapNodeJs;
|
|
198
|
+
readonly hapLegacyTypes: typeof hapNodeJs.LegacyTypes;
|
|
199
|
+
readonly platformAccessory: typeof PlatformAccessory;
|
|
200
|
+
readonly matter: {
|
|
201
|
+
clusters: Record<string, unknown>;
|
|
202
|
+
deviceTypes: Record<string, unknown>;
|
|
203
|
+
hapToMatterClusterMapping: Record<string, string[]>;
|
|
204
|
+
hapToMatterDeviceMapping: Record<string, string>;
|
|
205
|
+
getMatterDeviceTypeForHAPService: typeof getMatterDeviceTypeForHAPService;
|
|
206
|
+
getMatterClustersForHAPService: typeof getMatterClustersForHAPService;
|
|
207
|
+
};
|
|
208
|
+
constructor();
|
|
209
|
+
versionGreaterOrEqual(version: string): boolean;
|
|
210
|
+
static isDynamicPlatformPlugin(platformPlugin: PlatformPlugin): platformPlugin is DynamicPlatformPlugin;
|
|
211
|
+
static isStaticPlatformPlugin(platformPlugin: PlatformPlugin): platformPlugin is StaticPlatformPlugin;
|
|
212
|
+
signalFinished(): void;
|
|
213
|
+
signalShutdown(): void;
|
|
214
|
+
registerAccessory(accessoryName: AccessoryName, constructor: AccessoryPluginConstructor): void;
|
|
215
|
+
registerAccessory(pluginIdentifier: PluginIdentifier, accessoryName: AccessoryName, constructor: AccessoryPluginConstructor): void;
|
|
216
|
+
registerPlatform(platformName: PlatformName, constructor: PlatformPluginConstructor): void;
|
|
217
|
+
registerPlatform(pluginIdentifier: PluginIdentifier, platformName: PlatformName, constructor: PlatformPluginConstructor): void;
|
|
218
|
+
publishCameraAccessories(pluginIdentifier: PluginIdentifier, accessories: PlatformAccessory[]): void;
|
|
219
|
+
publishExternalAccessories(pluginIdentifier: PluginIdentifier, accessories: PlatformAccessory[]): void;
|
|
220
|
+
registerPlatformAccessories(pluginIdentifier: PluginIdentifier, platformName: PlatformName, accessories: PlatformAccessory[]): void;
|
|
221
|
+
updatePlatformAccessories(accessories: PlatformAccessory[]): void;
|
|
222
|
+
unregisterPlatformAccessories(pluginIdentifier: PluginIdentifier, platformName: PlatformName, accessories: PlatformAccessory[]): void;
|
|
223
|
+
publishMatterAccessories(pluginIdentifier: PluginIdentifier, accessories: PlatformAccessory[]): void;
|
|
224
|
+
unpublishMatterAccessories(pluginIdentifier: PluginIdentifier, accessories: PlatformAccessory[]): void;
|
|
225
|
+
}
|
|
226
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAErD,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACzE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAO,SAAS,MAAM,YAAY,CAAA;AAIlC,OAAO,EACL,8BAA8B,EAC9B,gCAAgC,EAChC,yBAAyB,EACzB,wBAAwB,EACxB,cAAc,EACd,iBAAiB,EAClB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAE1D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAKhC,MAAM,MAAM,GAAG,GAAG,OAAO,SAAS,CAAA;AAClC,MAAM,MAAM,cAAc,GAAG,OAAO,SAAS,CAAC,WAAW,CAAA;AAEzD,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG,gBAAgB,CAAA;AAC5D,MAAM,MAAM,UAAU,GAAG,MAAM,CAAA;AAC/B,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAA;AACrC,MAAM,MAAM,aAAa,GAAG,MAAM,CAAA;AAClC,MAAM,MAAM,YAAY,GAAG,MAAM,CAAA;AAEjC,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAA;AACxC,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAA;AAGvC,0BAAkB,UAAU;IAC1B,SAAS,cAAc;IACvB,QAAQ,aAAa;CACtB;AAED;;;GAGG;AACH,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E,gBAAgB,EAAE,WAAW,EAAE,iBAAiB,EAAE,GAAG,IAAI;IAgBpG,0BAA0B,CAAC,gBAAgB,EAAE,gBAAgB,EAAE,WAAW,EAAE,iBAAiB,EAAE,GAAG,IAAI;CAavG"}
|
package/dist/api.js
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { EventEmitter } from 'node:events';
|
|
2
|
+
import hapNodeJs from 'hap-nodejs';
|
|
3
|
+
import semver from 'semver';
|
|
4
|
+
import { Logger } from './logger.js';
|
|
5
|
+
import { getMatterClustersForHAPService, getMatterDeviceTypeForHAPService, HAPToMatterClusterMapping, HAPToMatterDeviceMapping, MatterClusters, MatterDeviceTypes, } from './matterTypes.js';
|
|
6
|
+
import { PlatformAccessory } from './platformAccessory.js';
|
|
7
|
+
import { PluginManager } from './pluginManager.js';
|
|
8
|
+
import { User } from './user.js';
|
|
9
|
+
import getVersion from './version.js';
|
|
10
|
+
const log = Logger.internal;
|
|
11
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
12
|
+
export var PluginType;
|
|
13
|
+
(function (PluginType) {
|
|
14
|
+
PluginType["ACCESSORY"] = "accessory";
|
|
15
|
+
PluginType["PLATFORM"] = "platform";
|
|
16
|
+
})(PluginType || (PluginType = {}));
|
|
17
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
18
|
+
export var APIEvent;
|
|
19
|
+
(function (APIEvent) {
|
|
20
|
+
/**
|
|
21
|
+
* Event is fired once homebridge has finished with booting up and initializing all components and plugins.
|
|
22
|
+
* When this event is fired it is possible that the Bridge accessory isn't published yet, if homebridge still needs
|
|
23
|
+
* to wait for some {@see StaticPlatformPlugin | StaticPlatformPlugins} to finish accessory creation.
|
|
24
|
+
*/
|
|
25
|
+
APIEvent["DID_FINISH_LAUNCHING"] = "didFinishLaunching";
|
|
26
|
+
/**
|
|
27
|
+
* This event is fired when homebridge gets shutdown. This could be a regular shutdown or an unexpected crash.
|
|
28
|
+
* At this stage all Accessories are already unpublished and all PlatformAccessories are already saved to disk!
|
|
29
|
+
*/
|
|
30
|
+
APIEvent["SHUTDOWN"] = "shutdown";
|
|
31
|
+
})(APIEvent || (APIEvent = {}));
|
|
32
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
33
|
+
export var InternalAPIEvent;
|
|
34
|
+
(function (InternalAPIEvent) {
|
|
35
|
+
InternalAPIEvent["REGISTER_ACCESSORY"] = "registerAccessory";
|
|
36
|
+
InternalAPIEvent["REGISTER_PLATFORM"] = "registerPlatform";
|
|
37
|
+
InternalAPIEvent["PUBLISH_EXTERNAL_ACCESSORIES"] = "publishExternalAccessories";
|
|
38
|
+
InternalAPIEvent["REGISTER_PLATFORM_ACCESSORIES"] = "registerPlatformAccessories";
|
|
39
|
+
InternalAPIEvent["UPDATE_PLATFORM_ACCESSORIES"] = "updatePlatformAccessories";
|
|
40
|
+
InternalAPIEvent["UNREGISTER_PLATFORM_ACCESSORIES"] = "unregisterPlatformAccessories";
|
|
41
|
+
// Matter support
|
|
42
|
+
InternalAPIEvent["PUBLISH_MATTER_ACCESSORIES"] = "publishMatterAccessories";
|
|
43
|
+
InternalAPIEvent["UNPUBLISH_MATTER_ACCESSORIES"] = "unpublishMatterAccessories";
|
|
44
|
+
})(InternalAPIEvent || (InternalAPIEvent = {}));
|
|
45
|
+
// eslint-disable-next-line ts/no-unsafe-declaration-merging
|
|
46
|
+
export class HomebridgeAPI extends EventEmitter {
|
|
47
|
+
version = 2.7; // homebridge API version
|
|
48
|
+
serverVersion = getVersion(); // homebridge node module version
|
|
49
|
+
// ------------------ LEGACY EXPORTS FOR PRE TYPESCRIPT ------------------
|
|
50
|
+
user = User;
|
|
51
|
+
hap = hapNodeJs;
|
|
52
|
+
hapLegacyTypes = hapNodeJs.LegacyTypes; // used for older accessories/platforms
|
|
53
|
+
platformAccessory = PlatformAccessory;
|
|
54
|
+
// ------------------------------------------------------------------------
|
|
55
|
+
// ------------------ MATTER EXPORTS ------------------
|
|
56
|
+
matter = {
|
|
57
|
+
clusters: MatterClusters,
|
|
58
|
+
deviceTypes: MatterDeviceTypes,
|
|
59
|
+
hapToMatterClusterMapping: HAPToMatterClusterMapping,
|
|
60
|
+
hapToMatterDeviceMapping: HAPToMatterDeviceMapping,
|
|
61
|
+
getMatterDeviceTypeForHAPService,
|
|
62
|
+
getMatterClustersForHAPService,
|
|
63
|
+
};
|
|
64
|
+
// ------------------------------------------------------------------------
|
|
65
|
+
constructor() {
|
|
66
|
+
super();
|
|
67
|
+
}
|
|
68
|
+
versionGreaterOrEqual(version) {
|
|
69
|
+
return semver.gte(this.serverVersion, version);
|
|
70
|
+
}
|
|
71
|
+
static isDynamicPlatformPlugin(platformPlugin) {
|
|
72
|
+
return 'configureAccessory' in platformPlugin;
|
|
73
|
+
}
|
|
74
|
+
static isStaticPlatformPlugin(platformPlugin) {
|
|
75
|
+
return 'accessories' in platformPlugin;
|
|
76
|
+
}
|
|
77
|
+
signalFinished() {
|
|
78
|
+
this.emit("didFinishLaunching" /* APIEvent.DID_FINISH_LAUNCHING */);
|
|
79
|
+
}
|
|
80
|
+
signalShutdown() {
|
|
81
|
+
this.emit("shutdown" /* APIEvent.SHUTDOWN */);
|
|
82
|
+
}
|
|
83
|
+
registerAccessory(pluginIdentifier, accessoryName, constructor) {
|
|
84
|
+
if (typeof accessoryName === 'function') {
|
|
85
|
+
constructor = accessoryName;
|
|
86
|
+
accessoryName = pluginIdentifier;
|
|
87
|
+
this.emit("registerAccessory" /* InternalAPIEvent.REGISTER_ACCESSORY */, accessoryName, constructor);
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
this.emit("registerAccessory" /* InternalAPIEvent.REGISTER_ACCESSORY */, accessoryName, constructor, pluginIdentifier);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
registerPlatform(pluginIdentifier, platformName, constructor) {
|
|
94
|
+
if (typeof platformName === 'function') {
|
|
95
|
+
constructor = platformName;
|
|
96
|
+
platformName = pluginIdentifier;
|
|
97
|
+
this.emit("registerPlatform" /* InternalAPIEvent.REGISTER_PLATFORM */, platformName, constructor);
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
this.emit("registerPlatform" /* InternalAPIEvent.REGISTER_PLATFORM */, platformName, constructor, pluginIdentifier);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
publishCameraAccessories(pluginIdentifier, accessories) {
|
|
104
|
+
this.publishExternalAccessories(pluginIdentifier, accessories);
|
|
105
|
+
}
|
|
106
|
+
publishExternalAccessories(pluginIdentifier, accessories) {
|
|
107
|
+
if (!PluginManager.isQualifiedPluginIdentifier(pluginIdentifier)) {
|
|
108
|
+
log.info(`One of your plugins incorrectly registered an external accessory using the platform name (${pluginIdentifier}) and not the plugin identifier. Please report this to the developer!`);
|
|
109
|
+
}
|
|
110
|
+
accessories.forEach((accessory) => {
|
|
111
|
+
// noinspection SuspiciousTypeOfGuard
|
|
112
|
+
if (!(accessory instanceof PlatformAccessory)) {
|
|
113
|
+
throw new TypeError(`${pluginIdentifier} attempt to register an accessory that isn't PlatformAccessory!`);
|
|
114
|
+
}
|
|
115
|
+
accessory._associatedPlugin = pluginIdentifier;
|
|
116
|
+
});
|
|
117
|
+
this.emit("publishExternalAccessories" /* InternalAPIEvent.PUBLISH_EXTERNAL_ACCESSORIES */, accessories);
|
|
118
|
+
}
|
|
119
|
+
registerPlatformAccessories(pluginIdentifier, platformName, accessories) {
|
|
120
|
+
accessories.forEach((accessory) => {
|
|
121
|
+
// noinspection SuspiciousTypeOfGuard
|
|
122
|
+
if (!(accessory instanceof PlatformAccessory)) {
|
|
123
|
+
throw new TypeError(`${pluginIdentifier} - ${platformName} attempt to register an accessory that isn't PlatformAccessory!`);
|
|
124
|
+
}
|
|
125
|
+
accessory._associatedPlugin = pluginIdentifier;
|
|
126
|
+
accessory._associatedPlatform = platformName;
|
|
127
|
+
});
|
|
128
|
+
this.emit("registerPlatformAccessories" /* InternalAPIEvent.REGISTER_PLATFORM_ACCESSORIES */, accessories);
|
|
129
|
+
}
|
|
130
|
+
updatePlatformAccessories(accessories) {
|
|
131
|
+
this.emit("updatePlatformAccessories" /* InternalAPIEvent.UPDATE_PLATFORM_ACCESSORIES */, accessories);
|
|
132
|
+
}
|
|
133
|
+
unregisterPlatformAccessories(pluginIdentifier, platformName, accessories) {
|
|
134
|
+
accessories.forEach((accessory) => {
|
|
135
|
+
// noinspection SuspiciousTypeOfGuard
|
|
136
|
+
if (!(accessory instanceof PlatformAccessory)) {
|
|
137
|
+
throw new TypeError(`${pluginIdentifier} - ${platformName} attempt to unregister an accessory that isn't PlatformAccessory!`);
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
this.emit("unregisterPlatformAccessories" /* InternalAPIEvent.UNREGISTER_PLATFORM_ACCESSORIES */, accessories);
|
|
141
|
+
}
|
|
142
|
+
publishMatterAccessories(pluginIdentifier, accessories) {
|
|
143
|
+
if (!PluginManager.isQualifiedPluginIdentifier(pluginIdentifier)) {
|
|
144
|
+
log.info(`One of your plugins incorrectly registered a Matter accessory using the platform name (${pluginIdentifier}) and not the plugin identifier. Please report this to the developer!`);
|
|
145
|
+
}
|
|
146
|
+
accessories.forEach((accessory) => {
|
|
147
|
+
if (!(accessory instanceof PlatformAccessory)) {
|
|
148
|
+
throw new TypeError(`${pluginIdentifier} attempt to register a Matter accessory that isn't PlatformAccessory!`);
|
|
149
|
+
}
|
|
150
|
+
accessory._associatedPlugin = pluginIdentifier;
|
|
151
|
+
});
|
|
152
|
+
this.emit("publishMatterAccessories" /* InternalAPIEvent.PUBLISH_MATTER_ACCESSORIES */, accessories);
|
|
153
|
+
}
|
|
154
|
+
unpublishMatterAccessories(pluginIdentifier, accessories) {
|
|
155
|
+
if (!PluginManager.isQualifiedPluginIdentifier(pluginIdentifier)) {
|
|
156
|
+
log.info(`One of your plugins incorrectly unregistered a Matter accessory using the platform name (${pluginIdentifier}) and not the plugin identifier. Please report this to the developer!`);
|
|
157
|
+
}
|
|
158
|
+
accessories.forEach((accessory) => {
|
|
159
|
+
if (!(accessory instanceof PlatformAccessory)) {
|
|
160
|
+
throw new TypeError(`${pluginIdentifier} attempt to unregister a Matter accessory that isn't PlatformAccessory!`);
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
this.emit("unpublishMatterAccessories" /* InternalAPIEvent.UNPUBLISH_MATTER_ACCESSORIES */, accessories);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
//# sourceMappingURL=api.js.map
|
package/dist/api.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAO,SAAS,MAAM,YAAY,CAAA;AAClC,OAAO,MAAM,MAAM,QAAQ,CAAA;AAE3B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EACL,8BAA8B,EAC9B,gCAAgC,EAChC,yBAAyB,EACzB,wBAAwB,EACxB,cAAc,EACd,iBAAiB,GAClB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,UAAU,MAAM,cAAc,CAAA;AAErC,MAAM,GAAG,GAAG,MAAM,CAAC,QAAQ,CAAA;AAc3B,gDAAgD;AAChD,MAAM,CAAN,IAAkB,UAGjB;AAHD,WAAkB,UAAU;IAC1B,qCAAuB,CAAA;IACvB,mCAAqB,CAAA;AACvB,CAAC,EAHiB,UAAU,KAAV,UAAU,QAG3B;AAmGD,gDAAgD;AAChD,MAAM,CAAN,IAAkB,QAajB;AAbD,WAAkB,QAAQ;IACxB;;;;OAIG;IACH,uDAA2C,CAAA;IAE3C;;;OAGG;IACH,iCAAqB,CAAA;AACvB,CAAC,EAbiB,QAAQ,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EAAE,CAAC;YACjE,GAAG,CAAC,IAAI,CAAC,0FAA0F,gBAAgB,uEAAuE,CAAC,CAAA;QAC7L,CAAC;QAED,WAAW,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE;YAChC,IAAI,CAAC,CAAC,SAAS,YAAY,iBAAiB,CAAC,EAAE,CAAC;gBAC9C,MAAM,IAAI,SAAS,CAAC,GAAG,gBAAgB,uEAAuE,CAAC,CAAA;YACjH,CAAC;YAED,SAAS,CAAC,iBAAiB,GAAG,gBAAgB,CAAA;QAChD,CAAC,CAAC,CAAA;QAEF,IAAI,CAAC,IAAI,+EAA8C,WAAW,CAAC,CAAA;IACrE,CAAC;IAED,0BAA0B,CAAC,gBAAkC,EAAE,WAAgC;QAC7F,IAAI,CAAC,aAAa,CAAC,2BAA2B,CAAC,gBAAgB,CAAC,EAAE,CAAC;YACjE,GAAG,CAAC,IAAI,CAAC,4FAA4F,gBAAgB,uEAAuE,CAAC,CAAA;QAC/L,CAAC;QAED,WAAW,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE;YAChC,IAAI,CAAC,CAAC,SAAS,YAAY,iBAAiB,CAAC,EAAE,CAAC;gBAC9C,MAAM,IAAI,SAAS,CAAC,GAAG,gBAAgB,yEAAyE,CAAC,CAAA;YACnH,CAAC;QACH,CAAC,CAAC,CAAA;QAEF,IAAI,CAAC,IAAI,mFAAgD,WAAW,CAAC,CAAA;IACvE,CAAC;CACF"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import type { CharacteristicWarning, InterfaceName, IPAddress, MacAddress, MDNSAdvertiser } from 'hap-nodejs';
|
|
2
|
+
import type { AccessoryIdentifier, AccessoryName, AccessoryPlugin, HomebridgeAPI, PlatformIdentifier, PlatformName, PluginIdentifier, StaticPlatformPlugin } from './api.js';
|
|
3
|
+
import type { ExternalPortsConfiguration, ExternalPortService } from './externalPortService.js';
|
|
4
|
+
import type { Logging } from './logger.js';
|
|
5
|
+
import type { Plugin } from './plugin.js';
|
|
6
|
+
import type { HomebridgeOptions } from './server.js';
|
|
7
|
+
import { Accessory, Bridge } from 'hap-nodejs';
|
|
8
|
+
import { PlatformAccessory } from './platformAccessory.js';
|
|
9
|
+
import { PluginManager } from './pluginManager.js';
|
|
10
|
+
export interface BridgeConfiguration {
|
|
11
|
+
name: string;
|
|
12
|
+
username: MacAddress;
|
|
13
|
+
pin: string;
|
|
14
|
+
advertiser?: MDNSAdvertiser;
|
|
15
|
+
port?: number;
|
|
16
|
+
bind?: (InterfaceName | IPAddress) | (InterfaceName | IPAddress)[];
|
|
17
|
+
setupID?: string[4];
|
|
18
|
+
manufacturer?: string;
|
|
19
|
+
model?: string;
|
|
20
|
+
disableIpc?: boolean;
|
|
21
|
+
firmwareRevision?: string;
|
|
22
|
+
serialNumber?: string;
|
|
23
|
+
debugModeEnabled?: boolean;
|
|
24
|
+
env?: {
|
|
25
|
+
DEBUG?: string;
|
|
26
|
+
NODE_OPTIONS?: string;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export interface AccessoryConfig extends Record<string, any> {
|
|
30
|
+
accessory: AccessoryName | AccessoryIdentifier;
|
|
31
|
+
name: string;
|
|
32
|
+
uuid_base?: string;
|
|
33
|
+
_bridge?: BridgeConfiguration;
|
|
34
|
+
}
|
|
35
|
+
export interface PlatformConfig extends Record<string, any> {
|
|
36
|
+
platform: PlatformName | PlatformIdentifier;
|
|
37
|
+
name?: string;
|
|
38
|
+
_bridge?: BridgeConfiguration;
|
|
39
|
+
}
|
|
40
|
+
export interface HomebridgeConfig {
|
|
41
|
+
bridge: BridgeConfiguration;
|
|
42
|
+
/**
|
|
43
|
+
* Optional Matter protocol configuration
|
|
44
|
+
*/
|
|
45
|
+
matter?: {
|
|
46
|
+
enabled?: boolean;
|
|
47
|
+
port?: number;
|
|
48
|
+
discriminator?: number;
|
|
49
|
+
passcode?: number;
|
|
50
|
+
vendorId?: number;
|
|
51
|
+
productId?: number;
|
|
52
|
+
deviceName?: string;
|
|
53
|
+
deviceType?: number;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* @deprecated
|
|
57
|
+
*/
|
|
58
|
+
mdns?: any;
|
|
59
|
+
accessories: AccessoryConfig[];
|
|
60
|
+
platforms: PlatformConfig[];
|
|
61
|
+
plugins?: PluginIdentifier[];
|
|
62
|
+
/**
|
|
63
|
+
* Array of disabled plugins.
|
|
64
|
+
* Unlike the plugins[] config which prevents plugins from being initialised at all, disabled plugins still have their alias loaded, so
|
|
65
|
+
* we can match config blocks of disabled plugins and show an appropriate message in the logs.
|
|
66
|
+
*/
|
|
67
|
+
disabledPlugins?: PluginIdentifier[];
|
|
68
|
+
ports?: ExternalPortsConfiguration;
|
|
69
|
+
}
|
|
70
|
+
export interface BridgeOptions extends HomebridgeOptions {
|
|
71
|
+
cachedAccessoriesDir: string;
|
|
72
|
+
cachedAccessoriesItemName: string;
|
|
73
|
+
}
|
|
74
|
+
export interface CharacteristicWarningOpts {
|
|
75
|
+
ignoreSlow?: boolean;
|
|
76
|
+
}
|
|
77
|
+
export declare class BridgeService {
|
|
78
|
+
private api;
|
|
79
|
+
private pluginManager;
|
|
80
|
+
private externalPortService;
|
|
81
|
+
private bridgeOptions;
|
|
82
|
+
private bridgeConfig;
|
|
83
|
+
private config;
|
|
84
|
+
bridge: Bridge;
|
|
85
|
+
private storageService;
|
|
86
|
+
private readonly allowInsecureAccess;
|
|
87
|
+
private cachedPlatformAccessories;
|
|
88
|
+
private cachedAccessoriesFileLoaded;
|
|
89
|
+
private readonly publishedExternalAccessories;
|
|
90
|
+
constructor(api: HomebridgeAPI, pluginManager: PluginManager, externalPortService: ExternalPortService, bridgeOptions: BridgeOptions, bridgeConfig: BridgeConfiguration, config: HomebridgeConfig);
|
|
91
|
+
static printCharacteristicWriteWarning(plugin: Plugin, accessory: Accessory, opts: CharacteristicWarningOpts, warning: CharacteristicWarning): void;
|
|
92
|
+
publishBridge(): void;
|
|
93
|
+
/**
|
|
94
|
+
* Attempt to load the cached accessories from disk.
|
|
95
|
+
*/
|
|
96
|
+
loadCachedPlatformAccessoriesFromDisk(): Promise<void>;
|
|
97
|
+
/**
|
|
98
|
+
* Return the name of the backup cache file
|
|
99
|
+
*/
|
|
100
|
+
private get backupCacheFileName();
|
|
101
|
+
/**
|
|
102
|
+
* Create a backup of the cached file
|
|
103
|
+
* This is used if we ever have trouble reading the main cache file
|
|
104
|
+
*/
|
|
105
|
+
private createCachedAccessoriesBackup;
|
|
106
|
+
/**
|
|
107
|
+
* Restore a cached accessories backup
|
|
108
|
+
* This is used if the main cache file has a JSON syntax error / is corrupted
|
|
109
|
+
*/
|
|
110
|
+
private restoreCachedAccessoriesBackup;
|
|
111
|
+
restoreCachedPlatformAccessories(): void;
|
|
112
|
+
/**
|
|
113
|
+
* Save the cached accessories back to disk.
|
|
114
|
+
*/
|
|
115
|
+
saveCachedPlatformAccessoriesOnDisk(): void;
|
|
116
|
+
handleRegisterPlatformAccessories(accessories: PlatformAccessory[]): void;
|
|
117
|
+
handleUpdatePlatformAccessories(accessories: PlatformAccessory[]): void;
|
|
118
|
+
handleUnregisterPlatformAccessories(accessories: PlatformAccessory[]): void;
|
|
119
|
+
handlePublishExternalAccessories(accessories: PlatformAccessory[]): Promise<void>;
|
|
120
|
+
createHAPAccessory(plugin: Plugin, accessoryInstance: AccessoryPlugin, displayName: string, accessoryType: AccessoryName | AccessoryIdentifier, uuidBase?: string): Accessory | undefined;
|
|
121
|
+
loadPlatformAccessories(plugin: Plugin, platformInstance: StaticPlatformPlugin, platformType: PlatformName | PlatformIdentifier, logger: Logging): Promise<void>;
|
|
122
|
+
teardown(): void;
|
|
123
|
+
private static strippingPinCode;
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=bridgeService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bridgeService.d.ts","sourceRoot":"","sources":["../src/bridgeService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,a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