homebridge
Version:
HomeKit support for the impatient
99 lines • 4.48 kB
TypeScript
/**
* Base class for Matter bridge managers
* Contains shared logic for handling Matter accessory control and state updates
*/
import type { PluginManager } from '../pluginManager.js';
import type { InternalMatterAccessory } from './types.js';
import { MatterServer } from './server.js';
/**
* Base Matter Manager
* Provides common functionality for both main bridge and child bridge Matter managers
*/
export declare abstract class BaseMatterManager {
protected matterServer?: MatterServer;
protected readonly externalMatterServers: Map<string, MatterServer>;
protected readonly pluginManager: PluginManager;
constructor(pluginManager: PluginManager);
/**
* Whether this manager has Matter active in a form that handles plugin
* registration/update/publish events — i.e. its API event listeners are
* attached. The MatterAPIImpl guards use this so that a call made against a
* bridge with no active Matter fails fast instead of emitting an event that
* nothing handles (bridged registrations are dropped; external ones hang).
*
* The base implementation reflects the shared state — a bridge MatterServer
* has been created. Subclasses override to add their mode-specific cases
* (e.g. externalsOnly, where the bridge node never starts but external
* accessories still publish).
*/
hasActiveMatter(): boolean;
/**
* Release a Matter port previously claimed for an external accessory.
* Subclasses override to route to the right port service (the local
* allocator on the main bridge, or an IPC call on a child bridge).
* Default no-op so subclasses that don't (yet) plumb release through
* stay safe.
*/
protected releaseExternalMatterPort(uniqueId: string): void;
/**
* Get an external Matter server by accessory UUID
*
* @param uuid - Accessory UUID
* @returns Matter server instance or undefined if not found
*/
getExternalServer(uuid: string): MatterServer | undefined;
/**
* Handle Matter accessory command (triggers user handlers)
* This is for UI/external control that should invoke plugin handlers
* Checks both external servers and bridge server
*/
handleTriggerCommand(uuid: string, cluster: string, attributes: Record<string, unknown>, partId?: string): Promise<void>;
/**
* Handle Matter accessory state updates
* Checks both external servers and bridge server
*/
handleUpdateAccessoryState(uuid: string, cluster: string, attributes: Record<string, unknown>, partId?: string): Promise<void>;
/**
* Enable state monitoring on all Matter servers
*/
enableStateMonitoring(): void;
/**
* After a triggerCommand completes, read back the current cluster state
* and emit a state change notification. This ensures the UI receives
* the updated state (e.g., currentPositionLiftPercent100ths for window
* coverings) even if the behavior's own notification was not delivered.
*/
private notifyCurrentState;
/**
* Disable state monitoring on all Matter servers
*/
disableStateMonitoring(): void;
/**
* Restore cached Matter accessories (matching HAP pattern)
*/
restoreCachedAccessories(keepOrphaned: boolean): void;
/**
* Handle registration of Matter platform accessories
*/
handleRegisterPlatformAccessories(pluginIdentifier: string, platformName: string, accessories: InternalMatterAccessory[]): Promise<void>;
/**
* Handle updating Matter platform accessories in the cache
* Checks both external servers and bridge server
*/
handleUpdatePlatformAccessories(accessories: InternalMatterAccessory[]): Promise<void>;
/**
* Handle unregistration of Matter platform accessories
*/
handleUnregisterPlatformAccessories(pluginIdentifier: string, platformName: string, accessories: InternalMatterAccessory[]): Promise<void>;
/**
* Handle unregistration of external Matter accessories
* Stops dedicated servers and cleans up storage
*/
handleUnregisterExternalAccessories(accessories: InternalMatterAccessory[]): Promise<void>;
/**
* Deserialize SerializedMatterAccessory from cache to MatterAccessory for plugin use
* Converts internal cache format to the public API format plugins expect
*/
private deserializeMatterAccessory;
}
//# sourceMappingURL=BaseMatterManager.d.ts.map