import { HomeAssistant } from './../home-assistant'; import type { Connection } from 'home-assistant-js-websocket'; export interface Lovelace { config: LovelaceConfig; rawConfig: LovelaceRawConfig; editMode: boolean; urlPath: string | null; mode: 'generated' | 'yaml' | 'storage'; locale: any; enableFullEditMode: () => void; setEditMode: (editMode: boolean) => void; saveConfig: (newConfig: LovelaceRawConfig) => Promise; deleteConfig: () => Promise; showToast: (params: any) => void; } export interface LovelaceCardEditor extends LovelaceGenericElementEditor { setConfig(config: LovelaceCardConfig): void; } export interface LovelaceGenericElementEditor extends HTMLElement { hass?: HomeAssistant; lovelace?: LovelaceConfig; context?: C; setConfig(config: any): void; focusYamlEditor?: () => void; } export interface LovelaceDashboardBaseConfig { } export interface LovelaceCard extends HTMLElement { hass?: HomeAssistant; isPanel?: boolean; preview?: boolean; layout?: string; getCardSize(): number | Promise; getLayoutOptions?(): LovelaceLayoutOptions; setConfig(config: LovelaceCardConfig): void; } export interface LovelaceConfig extends LovelaceDashboardBaseConfig { background?: string; views: LovelaceViewRawConfig[]; } export interface LovelaceDashboardStrategyConfig extends LovelaceDashboardBaseConfig { strategy: LovelaceStrategyConfig; } export interface LegacyLovelaceConfig extends LovelaceConfig { resources?: LovelaceResource[]; } export type LovelaceRawConfig = LovelaceConfig | LovelaceDashboardStrategyConfig; export declare function isStrategyDashboard(config: LovelaceRawConfig): config is LovelaceDashboardStrategyConfig; export declare const fetchConfig: (conn: Connection, urlPath: string | null, force: boolean) => Promise; export declare const saveConfig: (hass: HomeAssistant, urlPath: string | null, config: LovelaceRawConfig) => Promise; export declare const deleteConfig: (hass: HomeAssistant, urlPath: string | null) => Promise; export interface ShowViewConfig { user?: string; } interface LovelaceViewBackgroundConfig { image?: string; } export interface LovelaceBaseViewConfig { index?: number; title?: string; path?: string; icon?: string; theme?: string; panel?: boolean; background?: string | LovelaceViewBackgroundConfig; visible?: boolean | ShowViewConfig[]; subview?: boolean; back_path?: string; max_columns?: number; } export interface LovelaceViewConfig extends LovelaceBaseViewConfig { type?: string; badges?: Array; cards?: LovelaceCardConfig[]; sections?: LovelaceSectionRawConfig[]; } export interface LovelaceStrategyViewConfig extends LovelaceBaseViewConfig { strategy: LovelaceStrategyConfig; } export type LovelaceViewRawConfig = LovelaceViewConfig | LovelaceStrategyViewConfig; export declare function isStrategyView(view: LovelaceViewRawConfig): view is LovelaceStrategyViewConfig; export interface LovelaceBaseSectionConfig { visibility?: Condition[]; column_span?: number; row_span?: number; /** * @deprecated Use heading card instead. */ title?: string; } export interface LovelaceSectionConfig extends LovelaceBaseSectionConfig { type?: string; cards?: LovelaceCardConfig[]; } export interface LovelaceStrategySectionConfig extends LovelaceBaseSectionConfig { strategy: LovelaceStrategyConfig; } export type LovelaceSectionRawConfig = LovelaceSectionConfig | LovelaceStrategySectionConfig; export declare function isStrategySection(section: LovelaceSectionRawConfig): section is LovelaceStrategySectionConfig; export interface LovelaceStrategyConfig { type: string; [key: string]: any; } export interface LovelaceBadgeConfig { type: string; [key: string]: any; visibility?: Condition[]; } export declare const ensureBadgeConfig: (config: Partial | string) => LovelaceBadgeConfig; export interface LovelaceCardConfig { index?: number; view_index?: number; view_layout?: any; layout_options?: LovelaceLayoutOptions; type: string; [key: string]: any; visibility?: Condition[]; } export type LovelaceLayoutOptions = { grid_columns?: number | 'full'; grid_rows?: number | 'auto'; grid_max_columns?: number; grid_min_columns?: number; grid_min_rows?: number; grid_max_rows?: number; }; export interface LovelaceGridOptions { columns?: number | 'full'; rows?: number | 'auto'; max_columns?: number; min_columns?: number; min_rows?: number; max_rows?: number; } export type Condition = NumericStateCondition | StateCondition | ScreenCondition | UserCondition | OrCondition | AndCondition; export interface LegacyCondition { entity?: string; state?: string | string[]; state_not?: string | string[]; } interface BaseCondition { condition: string; } export interface NumericStateCondition extends BaseCondition { condition: 'numeric_state'; entity?: string; below?: string | number; above?: string | number; } export interface StateCondition extends BaseCondition { condition: 'state'; entity?: string; state?: string | string[]; state_not?: string | string[]; } export interface ScreenCondition extends BaseCondition { condition: 'screen'; media_query?: string; } export interface UserCondition extends BaseCondition { condition: 'user'; users?: string[]; } export interface OrCondition extends BaseCondition { condition: 'or'; conditions?: Condition[]; } export interface AndCondition extends BaseCondition { condition: 'and'; conditions?: Condition[]; } export type LovelaceResource = { id: string; type: 'css' | 'js' | 'module' | 'html'; url: string; }; export type LovelaceResourcesMutableParams = { res_type: LovelaceResource['type']; url: string; }; export declare const fetchResources: (conn: Connection) => Promise; export declare const createResource: (hass: HomeAssistant, values: LovelaceResourcesMutableParams) => Promise; export declare const updateResource: (hass: HomeAssistant, id: string, updates: Partial) => Promise; export declare const deleteResource: (hass: HomeAssistant, id: string) => Promise; export interface ConfigChangedEvent { config: any; } declare global { interface HASSDomEvents { 'config-changed': ConfigChangedEvent; 'hass-more-info': { entityId: string | undefined; }; } } export {};