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
57 lines (56 loc) • 1.5 kB
TypeScript
import { TapoCredentials, TapoApiRequest } from '../types';
/**
* Unified protocol manager similar to Rust tapo's TapoProtocol
* This addresses the core issue of distributed session management
*/
export declare class UnifiedTapoProtocol {
private auth;
private klapAuth;
private activeProtocol;
private lastRequestTime;
private minRequestInterval;
constructor(ip: string, credentials: TapoCredentials);
/**
* Initialize connection with automatic protocol detection
*/
connect(): Promise<void>;
/**
* Execute request with automatic session management (like Rust implementation)
*/
executeRequest<T>(request: TapoApiRequest): Promise<T>;
/**
* Send request using current active protocol
*/
private sendWithCurrentProtocol;
/**
* Refresh session for current protocol
*/
private refreshCurrentSession;
/**
* Try switching to alternative protocol and execute request
*/
private trySwitchProtocol;
/**
* Check if error indicates session issues
*/
private isSessionError;
/**
* Check if currently connected
*/
isConnected(): boolean;
/**
* Clear all sessions
*/
disconnect(): Promise<void>;
/**
* Get current active protocol
*/
getActiveProtocol(): string | null;
/**
* Get detailed protocol information
*/
getProtocolInfo(): {
protocol: string | null;
version?: string;
};
}