UNPKG

homebridge-tsvesync

Version:

Homebridge plugin for VeSync devices including Levoit air purifiers, humidifiers, and Etekcity smart outlets

98 lines 3.19 kB
import { API, DynamicPlatformPlugin, Logger, PlatformAccessory, Service, Characteristic } from 'homebridge'; import { PlatformConfig as TSVESyncPlatformConfig } from './types/device.types'; /** * HomebridgePlatform * This class is the main constructor for your plugin, this is where you should * parse the user config and discover/register accessories with Homebridge. */ export declare class TSVESyncPlatform implements DynamicPlatformPlugin { readonly log: Logger; readonly config: TSVESyncPlatformConfig; readonly api: API; readonly Service: typeof Service; readonly Characteristic: typeof Characteristic; readonly accessories: PlatformAccessory[]; private readonly deviceAccessories; private readonly aqSensorAccessories; private client; private deviceUpdateInterval?; private refreshTimer?; private refreshInProgress; private scheduledExpMs; private refreshRemainingMs; private readonly updateInterval; private readonly debug; private lastLoginAttempt; private loginBackoffTime; private initializationPromise; private initializationResolver; private isInitialized; private readonly logger; private readonly sessionStore; private readonly TOKEN_EXPIRY; private lastTokenRefresh; constructor(log: Logger, config: TSVESyncPlatformConfig, api: API); /** * Check if platform is ready */ isReady(): Promise<void>; /** * Initialize the platform */ private initializePlatform; /** * This function is invoked when homebridge restores cached accessories from disk at startup. */ configureAccessory(accessory: PlatformAccessory): void; /** * Get all devices from all categories */ private getAllDevices; /** * Create a serializable device context */ private createDeviceContext; /** * Ensure client is logged in, but avoid unnecessary logins */ private ensureLogin; /** * Update device states periodically */ private updateDeviceStates; /** * Handle token updates from the library */ private onTokenChange; /** * Backward-compatible session hydration when using older tsvesync versions */ private hydrateSessionCompat; /** * Schedule a proactive token refresh before JWT expiry */ private scheduleProactiveRefreshFromToken; private chainRefreshTimer; /** * Check if a device should be excluded based on configuration */ private shouldExcludeDevice; /** * This function discovers and registers your devices as accessories */ discoverDevices(): Promise<void>; /** * Generate a consistent UUID for a device * @param device The device to generate a UUID for * @param suffix Optional suffix for accessory type (e.g., '-AQ' for air quality sensor) * @returns The generated UUID string */ private generateDeviceUUID; /** * Check if a device has air quality sensor * @param device The device to check * @returns true if device has AQ sensor */ private deviceHasAirQuality; } //# sourceMappingURL=platform.d.ts.map