extra-map-card
Version:
Lovelace custom map card for Home Assistant
71 lines (70 loc) • 2.57 kB
TypeScript
import { Auth, Connection, HassConfig, HassEntities, HassEntity, HassServices, HassServiceTarget, MessageBase } from 'home-assistant-js-websocket';
import { FrontendLocaleData } from './data/frontend-local-data';
import { Themes, ThemeSettings } from './data/ws-themes';
export interface Resources {
[language: string]: Record<string, string>;
}
export interface Context {
id: string;
parent_id?: string;
user_id?: string | null;
}
export interface ServiceCallResponse {
context: Context;
response?: any;
}
export interface ServiceCallRequest {
domain: string;
service: string;
serviceData?: Record<string, any>;
target?: HassServiceTarget;
}
export interface HomeAssistant {
auth: Auth & {
external?: any;
};
connection: Connection;
connected: boolean;
states: HassEntities;
entities: {
[id: string]: any;
};
devices: {
[id: string]: any;
};
areas: {
[id: string]: any;
};
services: HassServices;
config: HassConfig;
themes: Themes;
selectedTheme: ThemeSettings | null;
panels: any;
panelUrl: string;
language: string;
selectedLanguage: string | null;
locale: FrontendLocaleData;
resources: Resources;
localize: any;
translationMetadata: any;
suspendWhenHidden: boolean;
enableShortcuts: boolean;
vibrate: boolean;
debugConnection: boolean;
dockedSidebar: 'docked' | 'always_hidden' | 'auto';
defaultPanel: string;
moreInfoEntityId: string | null;
user?: any;
userData?: any;
hassUrl(path?: any): string;
callService(domain: ServiceCallRequest['domain'], service: ServiceCallRequest['service'], serviceData?: ServiceCallRequest['serviceData'], target?: ServiceCallRequest['target'], notifyOnError?: boolean, returnResponse?: boolean): Promise<ServiceCallResponse>;
callApi<T>(method: 'GET' | 'POST' | 'PUT' | 'DELETE', path: string, parameters?: Record<string, any>, headers?: Record<string, string>): Promise<T>;
fetchWithAuth(path: string, init?: Record<string, any>): Promise<Response>;
sendWS(msg: MessageBase): void;
callWS<T>(msg: MessageBase): Promise<T>;
formatEntityState(stateObj: HassEntity, state?: string): string;
formatEntityAttributeValue(stateObj: HassEntity, attribute: string, value?: any): string;
formatEntityAttributeName(stateObj: HassEntity, attribute: string): string;
}
/** Return if a component is loaded. */
export declare const isComponentLoaded: (hass: HomeAssistant, component: string) => boolean;