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
122 lines (121 loc) • 5.76 kB
TypeScript
import { RetryOptions } from '../types/retry-options';
import { tplinkTapoConnectWrapperType } from '../types/wrapper-types';
export { tplinkTapoConnectWrapperType, TapoDeviceControlInterface, TapoProtocol, TapoDeviceKey, TapoVideoImage, TapoVideo, TapoVideoPageItem, TapoVideoList } from '../types/wrapper-types';
/**
* Main wrapper class for TP-Link Tapo device operations
* Provides a simplified interface for device control with proper error handling and retry logic
*
* @export
* @class tplinkTapoConnectWrapper
*/
export declare class tplinkTapoConnectWrapper {
readonly currentWorkingDirectory: string;
private static _instance;
/**
* Get singleton instance
*
* @static
* @returns {tplinkTapoConnectWrapper}
* @memberof tplinkTapoConnectWrapper
*/
static getInstance(): tplinkTapoConnectWrapper;
/**
* Creates an instance of tplinkTapoConnectWrapper.
* @memberof tplinkTapoConnectWrapper
*/
constructor();
/**
* Clear all cached clients and their devices
*/
clearCache(): void;
/**
* Get device information including energy usage data for supported devices
* The method will automatically detect the device type and retrieve basic device information
* Energy usage data is included automatically for supported devices (P110, P115, etc.)
*
* @param {string} _email - Tapo account email
* @param {string} _password - Tapo account password
* @param {string} _targetIp - Device IP address
* @param {RetryOptions} _retryOptions - Optional retry configuration
* @returns {Promise< tplinkTapoConnectWrapperType.tapoConnectResults >} - Contains device information and energy usage (if supported)
* @memberof tplinkTapoConnectWrapper
*/
getTapoDeviceInfo(_email: string, _password: string, _targetIp: string, _retryOptions?: RetryOptions): Promise<tplinkTapoConnectWrapperType.tapoConnectResults>;
/**
* Get energy usage information for devices that support energy monitoring
* First checks if the device supports energy monitoring, then retrieves energy data
*
* @deprecated Use getTapoDeviceInfo() instead, which now includes energy usage data for supported devices
* @param {string} _email - Tapo account email
* @param {string} _password - Tapo account password
* @param {string} _targetIp - Device IP address
* @param {RetryOptions} _retryOptions - Optional retry configuration
* @return {*} {Promise<tplinkTapoConnectWrapperType.tapoConnectResults>}
* @memberof tplinkTapoConnectWrapper
*/
getTapoEnergyUsage(_email: string, _password: string, _targetIp: string, _retryOptions?: RetryOptions): Promise<tplinkTapoConnectWrapperType.tapoConnectResults>;
/**
* Turn device on
*
* @param {string} _email - Tapo account email
* @param {string} _password - Tapo account password
* @param {string} _targetIp - Device IP address
* @param {RetryOptions} _retryOptions - Optional retry configuration
* @returns {Promise< tplinkTapoConnectWrapperType.tapoConnectResults >}
* @memberof tplinkTapoConnectWrapper
*/
setTapoTurnOn(_email: string, _password: string, _targetIp: string, _retryOptions?: RetryOptions): Promise<tplinkTapoConnectWrapperType.tapoConnectResults>;
/**
* Turn device off
*
* @param {string} _email - Tapo account email
* @param {string} _password - Tapo account password
* @param {string} _targetIp - Device IP address
* @param {RetryOptions} _retryOptions - Optional retry configuration
* @returns {Promise< tplinkTapoConnectWrapperType.tapoConnectResults >}
* @memberof tplinkTapoConnectWrapper
*/
setTapoTurnOff(_email: string, _password: string, _targetIp: string, _retryOptions?: RetryOptions): Promise<tplinkTapoConnectWrapperType.tapoConnectResults>;
/**
* Set device brightness
*
* @param {string} _email - Tapo account email
* @param {string} _password - Tapo account password
* @param {string} _targetIp - Device IP address
* @param {number} _brightness - Brightness level (1-100)
* @param {RetryOptions} _retryOptions - Optional retry configuration
* @returns {Promise< tplinkTapoConnectWrapperType.tapoConnectResults >}
* @memberof tplinkTapoConnectWrapper
*/
setTapoBrightness(_email: string, _password: string, _targetIp: string, _brightness: number, _retryOptions?: RetryOptions): Promise<tplinkTapoConnectWrapperType.tapoConnectResults>;
/**
* Set color using named color
*
* @param {string} _email - Tapo account email
* @param {string} _password - Tapo account password
* @param {string} _targetIp - Device IP address
* @param {string} _colour - Named color (red, green, blue, etc.)
* @param {RetryOptions} _retryOptions - Optional retry configuration
* @returns {Promise< tplinkTapoConnectWrapperType.tapoConnectResults >}
* @memberof tplinkTapoConnectWrapper
*/
setTapoColour(_email: string, _password: string, _targetIp: string, _colour: string, _retryOptions?: RetryOptions): Promise<tplinkTapoConnectWrapperType.tapoConnectResults>;
/**
* Batch operations with smart delays to prevent KLAP -1012 errors
* Migrated from Enhanced Wrapper for consistency
*/
executeBatch(operations: Array<{
operation: () => Promise<tplinkTapoConnectWrapperType.tapoConnectResults>;
name: string;
delayAfter?: number;
}>, options?: {
defaultDelay?: number;
retryOptions?: RetryOptions;
}): Promise<Array<{
name: string;
success: boolean;
data?: any;
error?: Error;
duration?: number;
}>>;
}