UNPKG

tsvesync

Version:

A TypeScript library for interacting with VeSync smart home devices

48 lines (47 loc) 1.25 kB
/** * Base class for VeSync devices */ import { VeSync } from './vesync'; export declare abstract class VeSyncBaseDevice { protected manager: VeSync; protected config: Record<string, any>; cid: string; deviceName: string; deviceStatus: string; deviceType: string; deviceRegion: string; uuid: string; configModule: string; macId: string; deviceCategory: string; connectionStatus: string; constructor(details: Record<string, any>, manager: VeSync); /** * Return formatted device info to stdout */ display(): void; /** * Return JSON details for device */ displayJSON(): string; /** * Check API response for errors */ protected checkResponse(response: [any, number], method: string): boolean; /** * Log error with context */ protected logError(method: string, error: any): void; /** * Get device details */ abstract getDetails(): Promise<Boolean>; /** * Update device details */ update(): Promise<Boolean>; /** * Call API with proper headers */ protected callApi(endpoint: string, method: string, data?: any, headers?: Record<string, string>): Promise<[any, number]>; }