-
Notifications
You must be signed in to change notification settings - Fork 2
Architecture
jv edited this page Jun 3, 2026
·
2 revisions
src/
main.tsx App bootstrap: applyTheme(), installHaptics()
App.tsx Top-level shell: sidebar, header, views, detail flyout
config.ts Static catalogs: HA_URL/TOKEN, scenes[], persons[]
settings.ts App settings (localStorage) + applyTheme()
types.ts Shared layout / entity types
hooks/
useHomeAssistant.ts WebSocket connection, entity state, callHA, history/forecast
useLayout.ts Loads/saves the layout (views, tiles, glance); export/import
useArtworkColor.ts Extracts a dominant color from now-playing artwork
lib/
layout.ts viewRows() and layout helpers
tileSize.ts Tile span/size logic
glance.ts At-a-glance metric catalog + computeMetric()
colorExtract.ts Canvas-based dominant-color extraction
viewTransition.ts View Transitions API wrapper (shared-element morphs)
haptics.ts navigator.vibrate + delegated press listener
entityInfo.ts Per-domain display helpers
components/ One component per surface (see Features)
styles/theme.css All styling + animations (single stylesheet)
vite-layout-plugin.ts Dev/preview middleware: GET/POST/DELETE /layout (honors LAYOUT_FILE)
layouts.json Persisted custom layout (on the add-on: /data/layouts.json)
-
useHomeAssistantopens the WS connection, subscribes to entity states, and exposesentities,connected,error,callHA(domain, service, …),getForecast, andgetHistory. -
useLayoutloads the editable layout from/layout(falls back to a default) and writes changes back via the Vite middleware tolayouts.json(or/data/layouts.jsonon the add-on). It also exposesexportLayout()/importLayout(). -
Appresolves the active view, renders its scenes + tiles, and owns theDetailPanelflyout (entity controls, camera, history, links, quick actions).
-
vite-layout-plugin.tsservesGET/POST/DELETE /layout, reading/writing a JSON file. The file path honors theLAYOUT_FILEenv var (the add-on points it at/data/layouts.json). - For Ingress, Vite uses
base: './', aBASE_URL-relative/layoutfetch, andpreview.allowedHosts: trueso assets and the persistence API work behind/api/hassio_ingress/<token>/.
- React 19.1, TypeScript ~5.8 (strict), Vite 6
-
home-assistant-js-websocketfor the HA connection -
@dnd-kit/*for drag-and-drop editing - Material Design Icons (
mdi-*classes) - Single stylesheet:
src/styles/theme.css