UNPKG

node-red-contrib-tplink-tapo-connect-api

Version:

This unofficial node-RED node allows connection to TP-Link Tapo devices. This project has been enhanced with AI support to enable new features. Starting with v0.50, we have added support for the KLAP protocol. To prioritize the operation of this node, we

45 lines (44 loc) 1.9 kB
import { TapoCredentials } from '../types'; import { TapoDeviceInfo } from '../types'; import { TapoDeviceType } from '../types/device-types'; import { BaseDevice } from '../devices/base-device'; /** * Factory class for creating appropriate Tapo device instances * Handles automatic device type detection and caching for optimal performance */ export declare class DeviceFactory { /** Device information cache to minimize redundant API calls */ private static genericInfoCache; /** Cache TTL in milliseconds (30 seconds) */ private static readonly CACHE_TTL; /** * Get device information using lightweight generic retriever * @param ip Device IP address * @param credentials Authentication credentials * @param useCache Whether to use cached results (default: true) * @returns Device information */ static getDeviceInfo(ip: string, credentials: TapoCredentials, useCache?: boolean): Promise<TapoDeviceInfo>; /** * Create device instance with automatic device type detection * Always detects the device type first, then creates the appropriate device instance * @param ip Device IP address * @param credentials Authentication credentials * @param methodHint Optional method hint for better type inference (fallback only) * @returns Device instance */ static createDevice(ip: string, credentials: TapoCredentials, methodHint?: string): Promise<BaseDevice>; /** * Create specific device instance based on device type * @param deviceType Specific device type * @param ip Device IP address * @param credentials Authentication credentials * @returns Device instance */ private static createSpecificDevice; /** * Clear the device info cache */ static clearDeviceInfoCache(): void; static getDeviceTypeForMethod(method: string): TapoDeviceType; }