/// // Home Assistant entity types export interface HassEntity { entity_id: string; state: string; attributes: Record; last_changed?: string; last_updated?: string; context?: { id: string; parent_id?: string; user_id?: string; }; } export interface HassState { entity_id: string; state: string; attributes: { friendly_name?: string; description?: string; [key: string]: any; }; } // Home Assistant instance types export interface HassInstance { states: HassStates; services: HassServices; connection: HassConnection; subscribeEvents: ( callback: (event: HassEvent) => void, eventType?: string, ) => Promise; unsubscribeEvents: (subscription: number) => void; } export interface HassStates { get: () => Promise; subscribe: (callback: (states: HassEntity[]) => void) => Promise; unsubscribe: (subscription: number) => void; } export interface HassServices { get: () => Promise>>; call: ( domain: string, service: string, serviceData?: Record, ) => Promise; } export interface HassConnection { socket: WebSocket; subscribeEvents: ( callback: (event: HassEvent) => void, eventType?: string, ) => Promise; unsubscribeEvents: (subscription: number) => void; } export interface HassService { name: string; description: string; target?: { entity?: { domain: string[]; }; }; fields: Record< string, { name: string; description: string; required?: boolean; example?: any; selector?: any; } >; } export interface HassEvent { event_type: string; data: Record; origin: string; time_fired: string; context: { id: string; parent_id?: string; user_id?: string; }; }