26 lines
708 B
TypeScript
26 lines
708 B
TypeScript
import {Connection, HassConfig, HassEntities, HassServices, MessageBase} from "home-assistant-js-websocket";
|
|
|
|
export interface HomeAssistant {
|
|
connection: Connection;
|
|
connected: boolean;
|
|
states: HassEntities;
|
|
services: HassServices;
|
|
config: HassConfig;
|
|
|
|
callService: (
|
|
domain: string,
|
|
service: string,
|
|
serviceData?: { [key: string]: any }
|
|
) => Promise<void>;
|
|
callApi: <T>(
|
|
method: "GET" | "POST" | "PUT" | "DELETE",
|
|
path: string,
|
|
parameters?: { [key: string]: any }
|
|
) => Promise<T>;
|
|
fetchWithAuth: (
|
|
path: string,
|
|
init?: { [key: string]: any }
|
|
) => Promise<Response>;
|
|
sendWS: (msg: MessageBase) => void;
|
|
callWS: <T>(msg: MessageBase) => Promise<T>;
|
|
} |