mirror of
https://github.com/Matysh/houseplan-card
synced 2026-10-01 12:18:51 +00:00
- floors wizard: spaces from the HA floor registry, step-by-step with mandatory plan upload per floor, skip support, auto-markup after the last one - icon rules as data (settings.icon_rules) + in-card editor with live test, invalid-regex guard, bilingual defaults, device_class fallback chain - tap_action (card) + per-device override; security model: card-wide toggle only for light/switch/fan/humidifier, explicit override for covers, never lock/alarm; 600ms long-press always opens the info card - i18n dictionaries → src/i18n/*.json (+parity tests); light-theme badge fixes - frontend tests 15→28
85 lines
2.1 KiB
TypeScript
85 lines
2.1 KiB
TypeScript
/** Shared types of the House Plan card. */
|
|
|
|
export interface RoomCfg {
|
|
id?: string;
|
|
name: string;
|
|
area: string | null;
|
|
x?: number;
|
|
y?: number;
|
|
w?: number;
|
|
h?: number;
|
|
poly?: number[][]; // polygon in render units (model) / normalized (config)
|
|
}
|
|
|
|
export interface SpaceModel {
|
|
id: string;
|
|
title: string;
|
|
vb: number[]; // render units
|
|
bg: { href: string; x: number; y: number; w: number; h: number } | null;
|
|
rooms: RoomCfg[]; // render units
|
|
}
|
|
|
|
export interface PdfRef {
|
|
name: string;
|
|
url: string;
|
|
}
|
|
|
|
/** Config marker: edits/augments an auto-discovered device OR describes a manual/virtual icon. */
|
|
export interface Marker {
|
|
id: string;
|
|
binding: string; // 'device:<id>' | 'entity:<eid>' | 'virtual'
|
|
space?: string | null;
|
|
area?: string | null;
|
|
hidden?: boolean;
|
|
name?: string | null;
|
|
icon?: string | null;
|
|
model?: string | null;
|
|
link?: string | null;
|
|
description?: string | null;
|
|
pdfs?: PdfRef[];
|
|
tap_action?: string | null; // per-device override: 'info' | 'more-info' | 'toggle'
|
|
}
|
|
|
|
export interface ServerConfig {
|
|
spaces: any[];
|
|
markers: Marker[];
|
|
settings: {
|
|
exclude_integrations?: string[];
|
|
group_lights?: boolean;
|
|
show_all?: boolean;
|
|
icon_rules?: { pattern: string; icon: string }[];
|
|
};
|
|
}
|
|
|
|
export interface DevItem {
|
|
id: string;
|
|
name: string;
|
|
model: string;
|
|
area: string;
|
|
space: string;
|
|
icon: string;
|
|
entities: string[];
|
|
primary?: string;
|
|
temp?: number | null;
|
|
virtual?: boolean;
|
|
marker?: Marker; // linked config marker (metadata, overrides)
|
|
bindingKind?: 'device' | 'entity' | 'virtual';
|
|
bindingRef?: string; // device_id / entity_id
|
|
link?: string | null;
|
|
description?: string | null;
|
|
pdfs?: PdfRef[];
|
|
tapAction?: string | null; // from the marker override
|
|
}
|
|
|
|
export interface CardConfig {
|
|
type: string;
|
|
title?: string;
|
|
default_floor?: string;
|
|
icon_size?: number;
|
|
show_temperature?: boolean;
|
|
live_states?: boolean;
|
|
show_signal?: boolean;
|
|
language?: string; // 'en' | 'ru' | '' (auto — HA profile)
|
|
tap_action?: string; // 'info' (default) | 'more-info' | 'toggle'
|
|
}
|