homebridge 2.0.0-alpha.5 → 2.0.0-alpha.51
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/dist/api.d.ts +219 -3
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +79 -0
- package/dist/api.js.map +1 -1
- package/dist/bridgeService.d.ts +10 -3
- package/dist/bridgeService.d.ts.map +1 -1
- package/dist/bridgeService.js +9 -5
- package/dist/bridgeService.js.map +1 -1
- package/dist/childBridgeFork.d.ts +17 -2
- package/dist/childBridgeFork.d.ts.map +1 -1
- package/dist/childBridgeFork.js +161 -4
- package/dist/childBridgeFork.js.map +1 -1
- package/dist/childBridgeService.d.ts +21 -0
- package/dist/childBridgeService.d.ts.map +1 -1
- package/dist/childBridgeService.js +72 -25
- package/dist/childBridgeService.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +3 -2
- package/dist/cli.js.map +1 -1
- package/dist/externalPortService.js.map +1 -1
- package/dist/index.d.ts +48 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -1
- package/dist/ipcService.d.ts +20 -0
- package/dist/ipcService.d.ts.map +1 -1
- package/dist/ipcService.js.map +1 -1
- package/dist/logger.d.ts +6 -0
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +8 -0
- package/dist/logger.js.map +1 -1
- package/dist/matter/index.d.ts +51 -0
- package/dist/matter/index.d.ts.map +1 -0
- package/dist/matter/index.js +11 -0
- package/dist/matter/index.js.map +1 -0
- package/dist/matter/matterAccessoryCache.d.ts +77 -0
- package/dist/matter/matterAccessoryCache.d.ts.map +1 -0
- package/dist/matter/matterAccessoryCache.js +176 -0
- package/dist/matter/matterAccessoryCache.js.map +1 -0
- package/dist/matter/matterBehaviors.d.ts +127 -0
- package/dist/matter/matterBehaviors.d.ts.map +1 -0
- package/dist/matter/matterBehaviors.js +611 -0
- package/dist/matter/matterBehaviors.js.map +1 -0
- package/dist/matter/matterConfigValidator.d.ts +81 -0
- package/dist/matter/matterConfigValidator.d.ts.map +1 -0
- package/dist/matter/matterConfigValidator.js +240 -0
- package/dist/matter/matterConfigValidator.js.map +1 -0
- package/dist/matter/matterErrorHandler.d.ts +94 -0
- package/dist/matter/matterErrorHandler.d.ts.map +1 -0
- package/dist/matter/matterErrorHandler.js +485 -0
- package/dist/matter/matterErrorHandler.js.map +1 -0
- package/dist/matter/matterLogFormatter.d.ts +18 -0
- package/dist/matter/matterLogFormatter.d.ts.map +1 -0
- package/dist/matter/matterLogFormatter.js +128 -0
- package/dist/matter/matterLogFormatter.js.map +1 -0
- package/dist/matter/matterNetworkMonitor.d.ts +68 -0
- package/dist/matter/matterNetworkMonitor.d.ts.map +1 -0
- package/dist/matter/matterNetworkMonitor.js +250 -0
- package/dist/matter/matterNetworkMonitor.js.map +1 -0
- package/dist/matter/matterServer.d.ts +642 -0
- package/dist/matter/matterServer.d.ts.map +1 -0
- package/dist/matter/matterServer.js +1535 -0
- package/dist/matter/matterServer.js.map +1 -0
- package/dist/matter/matterSharedTypes.d.ts +165 -0
- package/dist/matter/matterSharedTypes.d.ts.map +1 -0
- package/dist/matter/matterSharedTypes.js +51 -0
- package/dist/matter/matterSharedTypes.js.map +1 -0
- package/dist/matter/matterStorage.d.ts +126 -0
- package/dist/matter/matterStorage.d.ts.map +1 -0
- package/dist/matter/matterStorage.js +419 -0
- package/dist/matter/matterStorage.js.map +1 -0
- package/dist/matter/matterTypes.d.ts +612 -0
- package/dist/matter/matterTypes.d.ts.map +1 -0
- package/dist/matter/matterTypes.js +148 -0
- package/dist/matter/matterTypes.js.map +1 -0
- package/dist/platformAccessory.d.ts +1 -0
- package/dist/platformAccessory.d.ts.map +1 -1
- package/dist/platformAccessory.js +8 -1
- package/dist/platformAccessory.js.map +1 -1
- package/dist/plugin.d.ts +0 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +9 -12
- package/dist/plugin.js.map +1 -1
- package/dist/pluginManager.d.ts.map +1 -1
- package/dist/pluginManager.js +22 -21
- package/dist/pluginManager.js.map +1 -1
- package/dist/server.d.ts +16 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +276 -8
- package/dist/server.js.map +1 -1
- package/dist/storageService.js +8 -8
- package/dist/storageService.js.map +1 -1
- package/dist/user.d.ts +1 -0
- package/dist/user.d.ts.map +1 -1
- package/dist/user.js +10 -7
- package/dist/user.js.map +1 -1
- package/dist/util/mac.d.ts.map +1 -1
- package/dist/util/mac.js +2 -2
- package/dist/util/mac.js.map +1 -1
- package/dist/version.js +2 -2
- package/dist/version.js.map +1 -1
- package/package.json +25 -26
- package/bin/homebridge +0 -19
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Matter Protocol Support for Homebridge
|
|
3
|
+
*
|
|
4
|
+
* This module provides Matter protocol support through a Plugin API,
|
|
5
|
+
* allowing plugin developers to explicitly register Matter accessories.
|
|
6
|
+
*/
|
|
7
|
+
export { MatterConfigValidator } from './matterConfigValidator.js';
|
|
8
|
+
export { MatterServer } from './matterServer.js';
|
|
9
|
+
export { HomebridgeMatterStorage, MatterStorageManager } from './matterStorage.js';
|
|
10
|
+
export { clusterNames, clusters, devices, deviceTypes, MatterCommissioningError, MatterDeviceError, MatterError, MatterErrorType, MatterNetworkError, MatterStorageError, } from './matterTypes.js';
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/matter/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAWH,OAAO,EAAqC,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AACrG,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAClF,OAAO,EACL,YAAY,EACZ,QAAQ,EACR,OAAO,EACP,WAAW,EAMX,wBAAwB,EAExB,iBAAiB,EACjB,WAAW,EAEX,eAAe,EACf,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Matter Accessory Cache
|
|
3
|
+
*
|
|
4
|
+
* Handles persistence of Matter accessories across Homebridge restarts.
|
|
5
|
+
* Similar to HAP's cached accessories, but designed for Matter's simpler API.
|
|
6
|
+
*/
|
|
7
|
+
import type { InternalMatterAccessory } from './matterTypes.js';
|
|
8
|
+
/**
|
|
9
|
+
* Serializable Matter accessory (excludes functions and runtime state)
|
|
10
|
+
*/
|
|
11
|
+
export interface SerializedMatterAccessory {
|
|
12
|
+
plugin: string;
|
|
13
|
+
platform: string;
|
|
14
|
+
uuid: string;
|
|
15
|
+
displayName: string;
|
|
16
|
+
deviceType: {
|
|
17
|
+
name?: string;
|
|
18
|
+
code?: number;
|
|
19
|
+
};
|
|
20
|
+
serialNumber: string;
|
|
21
|
+
manufacturer: string;
|
|
22
|
+
model: string;
|
|
23
|
+
firmwareRevision?: string;
|
|
24
|
+
hardwareRevision?: string;
|
|
25
|
+
softwareVersion?: string;
|
|
26
|
+
context?: Record<string, any>;
|
|
27
|
+
clusters: {
|
|
28
|
+
[clusterName: string]: {
|
|
29
|
+
[attributeName: string]: any;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Matter Accessory Cache Manager
|
|
35
|
+
*/
|
|
36
|
+
export declare class MatterAccessoryCache {
|
|
37
|
+
private readonly cacheFilePath;
|
|
38
|
+
private cachedAccessories;
|
|
39
|
+
private cacheLoaded;
|
|
40
|
+
private saveQueue;
|
|
41
|
+
private directoryEnsured;
|
|
42
|
+
constructor(storagePath: string, bridgeId: string);
|
|
43
|
+
/**
|
|
44
|
+
* Load cached accessories from disk
|
|
45
|
+
*/
|
|
46
|
+
load(): Promise<Map<string, SerializedMatterAccessory>>;
|
|
47
|
+
/**
|
|
48
|
+
* Save accessories to cache (serialized to prevent concurrent write conflicts)
|
|
49
|
+
* Uses a queue pattern to ensure saves are truly serialized even when called concurrently
|
|
50
|
+
*/
|
|
51
|
+
save(accessories: Map<string, InternalMatterAccessory>): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Internal save implementation
|
|
54
|
+
*/
|
|
55
|
+
private performSave;
|
|
56
|
+
/**
|
|
57
|
+
* Get cached accessory by UUID
|
|
58
|
+
*/
|
|
59
|
+
getCached(uuid: string): SerializedMatterAccessory | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* Check if an accessory is cached
|
|
62
|
+
*/
|
|
63
|
+
hasCached(uuid: string): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Remove an accessory from cache
|
|
66
|
+
*/
|
|
67
|
+
removeCached(uuid: string): void;
|
|
68
|
+
/**
|
|
69
|
+
* Get all cached accessories
|
|
70
|
+
*/
|
|
71
|
+
getAllCached(): Map<string, SerializedMatterAccessory>;
|
|
72
|
+
/**
|
|
73
|
+
* Serialize a Matter accessory for storage
|
|
74
|
+
*/
|
|
75
|
+
private serializeAccessory;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=matterAccessoryCache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"matterAccessoryCache.d.ts","sourceRoot":"","sources":["../../src/matter/matterAccessoryCache.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAA;AAU/D;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE;QACV,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,IAAI,CAAC,EA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}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Matter Accessory Cache
|
|
3
|
+
*
|
|
4
|
+
* Handles persistence of Matter accessories across Homebridge restarts.
|
|
5
|
+
* Similar to HAP's cached accessories, but designed for Matter's simpler API.
|
|
6
|
+
*/
|
|
7
|
+
import * as path from 'node:path';
|
|
8
|
+
import fs from 'fs-extra';
|
|
9
|
+
import { Logger } from '../logger.js';
|
|
10
|
+
const log = Logger.withPrefix('Matter/Accessories');
|
|
11
|
+
/**
|
|
12
|
+
* Matter Accessory Cache Manager
|
|
13
|
+
*/
|
|
14
|
+
export class MatterAccessoryCache {
|
|
15
|
+
cacheFilePath;
|
|
16
|
+
cachedAccessories = new Map();
|
|
17
|
+
cacheLoaded = false;
|
|
18
|
+
saveQueue = Promise.resolve();
|
|
19
|
+
directoryEnsured = false;
|
|
20
|
+
constructor(storagePath, bridgeId) {
|
|
21
|
+
this.cacheFilePath = path.join(storagePath, bridgeId, 'accessories.json');
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Load cached accessories from disk
|
|
25
|
+
*/
|
|
26
|
+
async load() {
|
|
27
|
+
if (this.cacheLoaded) {
|
|
28
|
+
return this.cachedAccessories;
|
|
29
|
+
}
|
|
30
|
+
try {
|
|
31
|
+
// Ensure cache file exists
|
|
32
|
+
if (!await fs.pathExists(this.cacheFilePath)) {
|
|
33
|
+
log.info('No cached Matter accessories found (first run)');
|
|
34
|
+
this.cacheLoaded = true;
|
|
35
|
+
return this.cachedAccessories;
|
|
36
|
+
}
|
|
37
|
+
// Read and parse cache file
|
|
38
|
+
const cacheData = await fs.readJson(this.cacheFilePath);
|
|
39
|
+
if (!Array.isArray(cacheData)) {
|
|
40
|
+
log.warn('Invalid Matter accessory cache format, deleting corrupted file');
|
|
41
|
+
await fs.remove(this.cacheFilePath);
|
|
42
|
+
this.cacheLoaded = true;
|
|
43
|
+
return this.cachedAccessories;
|
|
44
|
+
}
|
|
45
|
+
// Load accessories into map
|
|
46
|
+
for (const serialized of cacheData) {
|
|
47
|
+
if (serialized.uuid) {
|
|
48
|
+
this.cachedAccessories.set(serialized.uuid, serialized);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
log.info(`Loaded ${this.cachedAccessories.size} cached Matter accessories`);
|
|
52
|
+
this.cacheLoaded = true;
|
|
53
|
+
// Directory must exist if we successfully loaded the cache file
|
|
54
|
+
this.directoryEnsured = true;
|
|
55
|
+
return this.cachedAccessories;
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
// If JSON parsing failed (corrupted file), delete it and start fresh
|
|
59
|
+
log.error(`Failed to load Matter accessory cache: ${this.cacheFilePath}: ${error.message}`);
|
|
60
|
+
log.warn('Deleting corrupted cache file and starting fresh');
|
|
61
|
+
try {
|
|
62
|
+
await fs.remove(this.cacheFilePath);
|
|
63
|
+
}
|
|
64
|
+
catch (removeError) {
|
|
65
|
+
log.debug('Could not delete corrupted cache file:', removeError);
|
|
66
|
+
}
|
|
67
|
+
this.cacheLoaded = true;
|
|
68
|
+
return this.cachedAccessories;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Save accessories to cache (serialized to prevent concurrent write conflicts)
|
|
73
|
+
* Uses a queue pattern to ensure saves are truly serialized even when called concurrently
|
|
74
|
+
*/
|
|
75
|
+
async save(accessories) {
|
|
76
|
+
// Chain this save to the end of the queue
|
|
77
|
+
// This ensures all saves run sequentially without race conditions
|
|
78
|
+
this.saveQueue = this.saveQueue.then(() => this.performSave(accessories));
|
|
79
|
+
// Wait for this save to complete
|
|
80
|
+
await this.saveQueue;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Internal save implementation
|
|
84
|
+
*/
|
|
85
|
+
async performSave(accessories) {
|
|
86
|
+
const tempFilePath = `${this.cacheFilePath}.tmp`;
|
|
87
|
+
try {
|
|
88
|
+
// Serialize accessories (strip out functions)
|
|
89
|
+
const serialized = [];
|
|
90
|
+
for (const accessory of accessories.values()) {
|
|
91
|
+
serialized.push(this.serializeAccessory(accessory));
|
|
92
|
+
}
|
|
93
|
+
// Ensure directory exists (only check once, not on every save)
|
|
94
|
+
if (!this.directoryEnsured) {
|
|
95
|
+
const directory = path.dirname(this.cacheFilePath);
|
|
96
|
+
await fs.ensureDir(directory);
|
|
97
|
+
// Verify directory was created successfully
|
|
98
|
+
const dirExists = await fs.pathExists(directory);
|
|
99
|
+
if (!dirExists) {
|
|
100
|
+
throw new Error(`Failed to create cache directory: ${directory}`);
|
|
101
|
+
}
|
|
102
|
+
this.directoryEnsured = true;
|
|
103
|
+
log.debug(`Cache directory ensured: ${directory}`);
|
|
104
|
+
}
|
|
105
|
+
// Write to temporary file first (atomic write pattern to prevent corruption)
|
|
106
|
+
await fs.writeJson(tempFilePath, serialized, { spaces: 2 });
|
|
107
|
+
// Atomically move temp file to final location
|
|
108
|
+
// Use move instead of rename for better cross-device compatibility
|
|
109
|
+
await fs.move(tempFilePath, this.cacheFilePath, { overwrite: true });
|
|
110
|
+
log.debug(`Saved ${serialized.length} Matter accessories to cache`);
|
|
111
|
+
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
log.error(`Failed to save Matter accessory cache: ${error.message}`);
|
|
114
|
+
// Clean up temp file if it exists
|
|
115
|
+
try {
|
|
116
|
+
if (await fs.pathExists(tempFilePath)) {
|
|
117
|
+
await fs.remove(tempFilePath);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
catch (cleanupError) {
|
|
121
|
+
log.debug('Could not clean up temporary cache file:', cleanupError);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Get cached accessory by UUID
|
|
127
|
+
*/
|
|
128
|
+
getCached(uuid) {
|
|
129
|
+
return this.cachedAccessories.get(uuid);
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Check if an accessory is cached
|
|
133
|
+
*/
|
|
134
|
+
hasCached(uuid) {
|
|
135
|
+
return this.cachedAccessories.has(uuid);
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Remove an accessory from cache
|
|
139
|
+
*/
|
|
140
|
+
removeCached(uuid) {
|
|
141
|
+
this.cachedAccessories.delete(uuid);
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Get all cached accessories
|
|
145
|
+
*/
|
|
146
|
+
getAllCached() {
|
|
147
|
+
return new Map(this.cachedAccessories);
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Serialize a Matter accessory for storage
|
|
151
|
+
*/
|
|
152
|
+
serializeAccessory(accessory) {
|
|
153
|
+
// Extract device type information
|
|
154
|
+
const deviceType = accessory.deviceType;
|
|
155
|
+
const deviceTypeInfo = {
|
|
156
|
+
name: deviceType?.name,
|
|
157
|
+
code: deviceType?.code,
|
|
158
|
+
};
|
|
159
|
+
return {
|
|
160
|
+
plugin: accessory._associatedPlugin || '',
|
|
161
|
+
platform: accessory._associatedPlatform || '',
|
|
162
|
+
uuid: accessory.uuid,
|
|
163
|
+
displayName: accessory.displayName,
|
|
164
|
+
deviceType: deviceTypeInfo,
|
|
165
|
+
serialNumber: accessory.serialNumber,
|
|
166
|
+
manufacturer: accessory.manufacturer,
|
|
167
|
+
model: accessory.model,
|
|
168
|
+
firmwareRevision: accessory.firmwareRevision,
|
|
169
|
+
hardwareRevision: accessory.hardwareRevision,
|
|
170
|
+
softwareVersion: accessory.softwareVersion,
|
|
171
|
+
context: accessory.context,
|
|
172
|
+
clusters: structuredClone(accessory.clusters),
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
//# sourceMappingURL=matterAccessoryCache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"matterAccessoryCache.js","sourceRoot":"","sources":["../../src/matter/matterAccessoryCache.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AAE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;YAC7C,IAAI,EAAE,SAAS,CAAC,IAAI;YACpB,WAAW,EAAE,SAAS,CAAC,WAAW;YAClC,UAAU,EAAE,cAAc;YAC1B,YAAY,EAAE,SAAS,CAAC,YAAY;YACpC,YAAY,EAAE,SAAS,CAAC,YAAY;YACpC,KAAK,EAAE,SAAS,CAAC,KAAK;YACtB,gBAAgB,EAAE,SAAS,CAAC,gBAAgB;YAC5C,gBAAgB,EAAE,SAAS,CAAC,gBAAgB;YAC5C,eAAe,EAAE,SAAS,CAAC,eAAe;YAC1C,OAAO,EAAE,SAAS,CAAC,OAAO;YAC1B,QAAQ,EAAE,eAAe,CAAC,SAAS,CAAC,QAAQ,CAAC;SAC9C,CAAA;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom Matter Behavior Classes for Homebridge
|
|
3
|
+
*
|
|
4
|
+
* These custom behaviors extend the base Matter.js behaviors and override
|
|
5
|
+
* command methods to allow plugins to inject custom handlers.
|
|
6
|
+
*
|
|
7
|
+
* Note: Only clusters with user-triggered commands need custom behaviors.
|
|
8
|
+
* Read-only clusters (like sensors) don't need custom behaviors since
|
|
9
|
+
* they only report state, they don't receive commands.
|
|
10
|
+
*/
|
|
11
|
+
import type { MatterCommandHandler } from './matterTypes.js';
|
|
12
|
+
import { ColorControlServer, DoorLockServer, IdentifyServer, LevelControlServer, OnOffServer, ThermostatServer, WindowCoveringServer } from '@matter/main/behaviors';
|
|
13
|
+
/**
|
|
14
|
+
* Set the accessories map reference for cache syncing
|
|
15
|
+
*/
|
|
16
|
+
export declare function setAccessoriesMap(map: Map<string, any>): void;
|
|
17
|
+
/**
|
|
18
|
+
* Register a handler for a specific endpoint/cluster/command
|
|
19
|
+
*
|
|
20
|
+
* @param endpointId - Unique endpoint identifier (typically the accessory UUID)
|
|
21
|
+
* @param clusterName - Name of the Matter cluster (e.g., 'onOff', 'levelControl')
|
|
22
|
+
* @param commandName - Name of the command method (e.g., 'on', 'off', 'moveToLevel')
|
|
23
|
+
* @param handler - Callback function to execute when the command is received
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* registerHandler('my-light-uuid', 'onOff', 'on', async () => {
|
|
28
|
+
* console.log('Light turned on!')
|
|
29
|
+
* })
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare function registerHandler(endpointId: string, clusterName: string, commandName: string, handler: MatterCommandHandler): void;
|
|
33
|
+
/**
|
|
34
|
+
* Custom OnOff Server that calls plugin handlers
|
|
35
|
+
*/
|
|
36
|
+
export declare class HomebridgeOnOffServer extends OnOffServer {
|
|
37
|
+
on(): any;
|
|
38
|
+
off(): any;
|
|
39
|
+
toggle(): any;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Custom LevelControl Server that calls plugin handlers
|
|
43
|
+
*/
|
|
44
|
+
export declare class HomebridgeLevelControlServer extends LevelControlServer {
|
|
45
|
+
moveToLevel(request: any): any;
|
|
46
|
+
moveToLevelWithOnOff(request: any): any;
|
|
47
|
+
move(request: any): any;
|
|
48
|
+
step(request: any): any;
|
|
49
|
+
stop(request: any): any;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Custom WindowCovering Server that calls plugin handlers
|
|
53
|
+
*/
|
|
54
|
+
export declare class HomebridgeWindowCoveringServer extends WindowCoveringServer {
|
|
55
|
+
upOrOpen(): any;
|
|
56
|
+
downOrClose(): any;
|
|
57
|
+
stopMotion(): any;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Custom DoorLock Server that calls plugin handlers
|
|
61
|
+
*/
|
|
62
|
+
export declare class HomebridgeDoorLockServer extends DoorLockServer {
|
|
63
|
+
lockDoor(): any;
|
|
64
|
+
unlockDoor(): any;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Custom Thermostat Server that calls plugin handlers
|
|
68
|
+
*/
|
|
69
|
+
export declare class HomebridgeThermostatServer extends ThermostatServer {
|
|
70
|
+
setpointRaiseLower(request: any): any;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Custom Identify Server that calls plugin handlers
|
|
74
|
+
*/
|
|
75
|
+
export declare class HomebridgeIdentifyServer extends IdentifyServer {
|
|
76
|
+
identify(request: any): any;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Custom ColorControl Server that calls plugin handlers
|
|
80
|
+
*
|
|
81
|
+
* ColorControl handles color changes for lights (hue, saturation, XY color, color temperature).
|
|
82
|
+
* Plugin developers can override these *Logic methods to handle color changes in their hardware.
|
|
83
|
+
*
|
|
84
|
+
* Features (Xy, ColorTemperature, HueSaturation) are added by the device type, not this behavior.
|
|
85
|
+
* This ensures each device only gets the features it needs.
|
|
86
|
+
*/
|
|
87
|
+
export declare class HomebridgeColorControlServer extends ColorControlServer {
|
|
88
|
+
/**
|
|
89
|
+
* Called when color temperature is changed
|
|
90
|
+
* @param targetMireds - Target color temperature in mireds (micro reciprocal degrees)
|
|
91
|
+
* @param transitionTime - Transition time in seconds (0 = as fast as possible)
|
|
92
|
+
*/
|
|
93
|
+
moveToColorTemperatureLogic(targetMireds: number, transitionTime: number): any;
|
|
94
|
+
/**
|
|
95
|
+
* Called when hue and saturation are changed together
|
|
96
|
+
* @param targetHue - Target hue value (0-254 for normal hue, 0-65535 for enhanced hue)
|
|
97
|
+
* @param targetSaturation - Target saturation value (0-254)
|
|
98
|
+
* @param transitionTime - Transition time in seconds (0 = as fast as possible)
|
|
99
|
+
*/
|
|
100
|
+
moveToHueAndSaturationLogic(targetHue: number, targetSaturation: number, transitionTime: number): any;
|
|
101
|
+
/**
|
|
102
|
+
* Called when XY color coordinates are changed
|
|
103
|
+
* @param targetX - Target X value (0-65535 representing 0.0-1.0 in CIE color space)
|
|
104
|
+
* @param targetY - Target Y value (0-65535 representing 0.0-1.0 in CIE color space)
|
|
105
|
+
* @param transitionTime - Transition time in seconds (0 = as fast as possible)
|
|
106
|
+
*/
|
|
107
|
+
moveToColorLogic(targetX: number, targetY: number, transitionTime: number): any;
|
|
108
|
+
/**
|
|
109
|
+
* Called when hue is changed individually
|
|
110
|
+
* @param targetHue - Target hue value
|
|
111
|
+
* @param direction - Direction to move (shortest, longest, up, down)
|
|
112
|
+
* @param transitionTime - Transition time in seconds
|
|
113
|
+
* @param isEnhancedHue - Whether this is enhanced hue (16-bit) or normal hue (8-bit)
|
|
114
|
+
*/
|
|
115
|
+
moveToHueLogic(targetHue: number, direction: any, transitionTime: number, isEnhancedHue?: boolean): any;
|
|
116
|
+
/**
|
|
117
|
+
* Called when saturation is changed individually
|
|
118
|
+
* @param targetSaturation - Target saturation value (0-254)
|
|
119
|
+
* @param transitionTime - Transition time in seconds
|
|
120
|
+
*/
|
|
121
|
+
moveToSaturationLogic(targetSaturation: number, transitionTime: number): any;
|
|
122
|
+
/**
|
|
123
|
+
* Called when all color movement should be stopped
|
|
124
|
+
*/
|
|
125
|
+
stopAllColorMovement(): any;
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=matterBehaviors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"matterBehaviors.d.ts","sourceRoot":"","sources":["../../src/matter/matterBehaviors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAE5D,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,WAAW,EACX,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,wBAAwB,CAAA;AAkB/B;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,QAEtD;AA4BD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,CAC7B,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,oBA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