UNPKG

homebridge-pura

Version:

Homebridge plugin for Pura smart fragrance diffusers

53 lines (52 loc) 1.77 kB
import type { API, Characteristic, DynamicPlatformPlugin, Logging, PlatformAccessory, PlatformConfig, Service } from 'homebridge'; /** * PuraPlatform * This class is the main constructor for the Pura plugin, this is where we * authenticate with Pura and discover/register accessories with Homebridge. */ export declare class PuraPlatform implements DynamicPlatformPlugin { readonly log: Logging; readonly config: PlatformConfig; readonly api: API; readonly Service: typeof Service; readonly Characteristic: typeof Characteristic; readonly accessories: Map<string, PlatformAccessory>; readonly discoveredCacheUUIDs: string[]; private readonly puraApi; private readonly puraConfig; private refreshInterval; constructor(log: Logging, config: PlatformConfig, api: API); /** * This function is invoked when homebridge restores cached accessories from disk at startup. * It should be used to set up event handlers for characteristics and update respective values. */ configureAccessory(accessory: PlatformAccessory): void; /** * Discover and register Pura devices */ discoverDevices(): Promise<void>; /** * Register a Pura device as a HomeKit accessory */ private registerDevice; /** * Register a bay as a separate accessory */ private registerBayAccessory; /** * Remove accessories that are no longer present */ private removeStaleAccessories; /** * Set up periodic refresh of device status */ private setupRefreshInterval; /** * Refresh status of all devices */ private refreshDeviceStatus; /** * Update a bay accessory with fresh device data */ private updateBayAccessory; }