homeassistant-config/custom_frontend_sources/state-card-custom-cover/src/home-assistant-interface.ts

26 lines
708 B
TypeScript
Raw Normal View History

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>;
}