@viguza/homebridge-ezviz
Version:
A short description about what your plugin does.
50 lines (49 loc) • 1.77 kB
TypeScript
import { Logging } from 'homebridge';
import { Credentials } from '../types/login.js';
import { ListDevicesResponse } from '../types/devices.js';
import { EZVIZConfig } from '../types/config.js';
/**
* EZVIZ API client for interacting with EZVIZ services
*/
export declare class EZVIZAPI {
private config;
sessionId: string | null;
private log;
constructor(config: EZVIZConfig, log?: Logging);
/**
* Generates a random string of specified length
* @param length - The length of the string to generate
* @returns Random string
*/
randomStr(length: number): string;
/**
* Authenticates with the EZVIZ API
* @returns Promise resolving to credentials or undefined if authentication fails
*/
authenticate(): Promise<Credentials | undefined>;
/**
* Gets the domain URL for the specified region
* @param id - The region ID
* @returns Promise resolving to the domain URL
*/
getDomain(id: number): Promise<string>;
/**
* Lists all devices for the authenticated user
* @returns Promise resolving to device list or undefined if failed
*/
listDevices(): Promise<ListDevicesResponse | undefined>;
/**
* Sets the state of a switch/plug
* @param serialNumber - The device serial number
* @param type - The switch type
* @param value - The value to set (true/false)
*/
setSwitchState(serialNumber: string, type: number, value: boolean): Promise<void>;
/**
* Gets the current state of a switch/plug
* @param serialNumber - The device serial number
* @param type - The switch type
* @returns Promise resolving to the switch state
*/
getSwitchState(serialNumber: string, type: number): Promise<boolean>;
}