@homebridge-plugins/homebridge-august
Version:
The August plugin allows you to access your August & Yale device(s) from HomeKit.
93 lines • 4.64 kB
TypeScript
import type { MatterAccessory, MatterAPI, PlatformAccessory } from 'homebridge';
import type { device, devicesConfig } from './settings.js';
import { AugustPlatform } from './Platform.HAP.js';
/**
* AugustMatterPlatform
* Extends AugustPlatform to register August locks as Matter DoorLock accessories
* instead of HAP accessories. Used when Homebridge Matter support is available,
* enabled, and not disabled by the `disableMatter` config option.
*/
export declare class AugustMatterPlatform extends AugustPlatform {
readonly matterAccessories: Map<string, MatterAccessory>;
private readonly pendingHapCleanup;
private readonly matterPubNubUnsubscribes;
private readonly matterPollingSubscriptions;
/**
* Called when homebridge restores cached HAP accessories from disk at startup.
* HAP accessories are staged here and removed only after Matter registration
* succeeds for the same lock, so that if Matter init fails the user is not
* left with zero accessories.
*/
configureAccessory(accessory: PlatformAccessory): Promise<void>;
/**
* Called when homebridge restores cached Matter accessories from disk at startup.
* Stores the restored accessory so we can update it later during device discovery.
*/
configureMatterAccessory(accessory: MatterAccessory): void;
/**
* Run device discovery, then sweep any staged HAP accessories that were not
* handled during discovery.
*
* The normal deferred-cleanup flow removes a staged HAP accessory when Lock()
* is called for its UUID and Matter registration succeeds. But if a lock has
* been removed from the user's August account entirely, Lock() is never
* called for its UUID — leaving the staged HAP accessory registered with
* Homebridge indefinitely and the pendingHapCleanup map growing on every
* restart.
*
* After discoverDevices() finishes, any remaining entries in
* pendingHapCleanup correspond to locks no longer in the account, so it is
* safe to unregister them.
*/
discoverDevices(): Promise<void>;
private sweepUnhandledHapAccessories;
/**
* Register an August lock as a Matter DoorLock accessory.
* Overrides the HAP-based Lock() method from AugustPlatform.
*/
protected Lock(device: device & devicesConfig): Promise<void>;
/**
* Subscribe to August real-time lock events and update the Matter DoorLock state.
* Captures the unsubscribe function returned by August.subscribe() to allow proper
* cleanup on lock removal (equivalent of the fix in lock.ts / PR #206 for HAP).
*/
private subscribeAugustMatter;
/**
* Map an August lock state (from details() or a PubNub event) to a Matter
* DoorLock.LockState enum value.
*
* If both `locked` and `unlocked` are set simultaneously (unexpected), we
* treat the lock as Locked (fail-safe). If neither is set, we report
* NotFullyLocked, which is the correct Matter state for "position unknown".
*/
private mapLockState;
/**
* Fetch the current lock status from the August API and update the Matter DoorLock state.
*
* Routed through the platform's ConnectivityManager: failures are
* classified and the state machine handles retry/backoff/probe-driven
* recovery. No manual session-refresh-and-retry block is needed here
* — when the network is down, execute() returns undefined and the
* next poll cycle will skip until the manager confirms recovery.
*/
fetchAndUpdateMatterLockState(device: device & devicesConfig, uuid: string, matterApi: MatterAPI): Promise<void>;
/**
* Poll the August API for lock status at the configured refresh rate and update the Matter
* DoorLock state. Uses `timer(0, ...)` for an immediate first fetch (accurate initial state)
* and `exhaustMap` to prevent overlapping concurrent requests.
*
* Idempotent: disposes any previous polling subscription for the same UUID
* before starting a new one. The subscription is tracked in
* matterPollingSubscriptions so it can be disposed on lock removal — otherwise
* the timer keeps firing forever even after the accessory is gone.
*/
private startMatterStatusPolling;
/**
* Release all resources associated with a given Matter lock UUID:
* the registered Matter accessory, the PubNub subscription, and the
* RxJS polling subscription. Safe to call when some or all of these
* do not exist.
*/
private tearDownMatterLock;
}
//# sourceMappingURL=platform.matter.d.ts.map