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
67 lines (66 loc) • 2.68 kB
TypeScript
import { RetryOptions } from '../types/retry-options';
import { tplinkTapoConnectWrapperType } from '../types/wrapper-types';
/**
* Service class for handling individual device control operations
* Encapsulates device interaction logic with proper error handling and resource management
*/
export declare class DeviceControlService {
/** Device instance cache for session continuity */
private static deviceCache;
/** Cache TTL in milliseconds (5 minutes) */
private static readonly DEVICE_CACHE_TTL;
/** Cleanup interval for cached devices */
private static cleanupInterval;
/**
* Get or create a cached device instance for session continuity
*/
private static getOrCreateDevice;
/**
* Start cleanup timer for expired cached devices
*/
private static startCleanupTimer;
/**
* Clean up expired cached devices
*/
private static cleanupExpiredDevices;
/**
* Clear all cached devices (useful for testing or cleanup)
*/
static clearDeviceCache(): void;
/**
* Get device information including energy usage data for supported devices
*/
static getDeviceInfo(email: string, password: string, targetIp: string, retryOptions?: RetryOptions): Promise<tplinkTapoConnectWrapperType.tapoConnectResults>;
/**
* Get energy usage information for devices that support energy monitoring
*/
static getEnergyUsage(email: string, password: string, targetIp: string, retryOptions?: RetryOptions): Promise<tplinkTapoConnectWrapperType.tapoConnectResults>;
/**
* Turn device on
*/
static turnOn(email: string, password: string, targetIp: string, retryOptions?: RetryOptions): Promise<tplinkTapoConnectWrapperType.tapoConnectResults>;
/**
* Turn device off
*/
static turnOff(email: string, password: string, targetIp: string, retryOptions?: RetryOptions): Promise<tplinkTapoConnectWrapperType.tapoConnectResults>;
/**
* Set device brightness
*/
static setBrightness(email: string, password: string, targetIp: string, brightness: number, retryOptions?: RetryOptions): Promise<tplinkTapoConnectWrapperType.tapoConnectResults>;
/**
* Set device color using named color
*/
static setColor(email: string, password: string, targetIp: string, colour: string, retryOptions?: RetryOptions): Promise<tplinkTapoConnectWrapperType.tapoConnectResults>;
/**
* Execute operation with retry logic
*/
private static executeWithRetry;
/**
* Safely disconnect device
*/
private static safeDisconnect;
/**
* Check if object is empty
*/
private static isEmpty;
}