You are reading the development docs (2026.12.1-dev.1): features here may not be released yet.
Skip to content

Systems Architecture ​

How the pieces fit at runtime: the Python integration, the one JavaScript bundle it loads into every Home Assistant page, the core singletons on window.lcards.core, and the cards, view and strategy on a dashboard.


Runtime overview ​

  • Loading. frontend.py serves the integration folder at /lcards and registers /lcards/lcards.js with add_extra_js_url(), so the bundle loads on every Home Assistant page without a Lovelace resource. lcards.js is a small loader stub that imports the hashed main chunk (chunks/lcards-main-*.js); editors, studios, the config panel, the grid edit overlay, ApexCharts and three.js are lazy chunks. See Home Assistant Integration: Bundle and Loading.
  • Core start. src/lcards-main.js calls lcardsCore.initialize(stubHass) when the main chunk runs and defines the card elements only after it resolves; the view element and the strategy element are defined at module top level (Home Assistant's strategy resolver waits only a short time). The 30 initialization steps are listed in Core Subsystems: Initialization Order.
  • HASS. Home Assistant sets hass on each card. An LCARdSCard forwards it to window.lcards.core.ingestHass() only on its first HASS or when one of its own entities changed; the core then pushes it to its services once per microtask. While no card is registered (or a portal overlay shows content) the core polls document.querySelector('home-assistant').hass every 500 ms instead. See HASS distribution and Card Foundation: HASS flow.
  • Rules listen to their entities' state changes themselves, through the one subscription the page shares with helpers and data sources (src/core/state-change-hub.js, a subscribe_entities filtered to the entities they name), so rule entities update even when no card forwarded the change (Rules Engine).
  • Backend channel. integrationService probes lcards/info on the first HASS with a connection, then subscribes to the lcards_event push channel through lcards/subscribe (Home Assistant's own subscribe_events is admin-only for custom event types). The lcards.* actions (alert mode, reload, screen effects, sound, Borg, astrometrics) reach the browsers this way. See Integration Service and Home Assistant Services: Implementation Notes.
  • Actions. Each card has its own LCARdSActionHandler (there is no core action handler); service calls go through LCARdSCard.callService() (Action Handler).

What runs where ​

ElementClass (file under src/)BaseArchitecture page
lcards-button, lcards-elbow, lcards-sliderLCARdSButton, LCARdSElbow, LCARdSSlider (cards/)LCARdSCard (elbow and slider extend the button)Card Foundation
lcards-chartLCARdSChart (cards/lcards-chart.js, charts/)LCARdSCardCharts
lcards-data-gridLCARdSDataGrid (cards/lcards-data-grid.js, data-grid/)LCARdSCardCard Foundation
lcards-select-menuLCARdSSelectMenu (cards/lcards-select-menu.js)LCARdSCardCard Foundation
lcards-astrometrics-cardLCARdSAstrometricsCard (cards/lcards-astrometrics-card.js, core/astrometrics/)LCARdSCardAstrometrics
lcards-msd-cardLCARdSMSDCard (cards/lcards-msd.js, msd/)LCARdSCardMSD Pipeline
lcards-layout-cardLCARdSLayoutCard (cards/lcards-layout-card.js)LitElementLayout View and Layout Card
lcards-alert-overlayLCARdSAlertOverlay (cards/lcards-alert-overlay.js)LitElementScreen Effects, Portal Overlay Manager
lcards-layout-view (view type custom:lcards-layout-view)LCARdSLayoutView (views/lcards-layout-view.js)LitElementLayout View and Layout Card
ll-strategy-dashboard-lcars-shell (strategy custom:lcars-shell)LCARdSShellDashboardStrategy (strategies/lcards-shell-strategy.js)HTMLElementShell Strategy

All elements are registered in src/lcards-main.js, each behind a customElements.get() guard. The card picker entries are one guarded push of LCARdSCardClasses into window.customCards; the strategy is listed in window.customStrategies for Home Assistant's New Dashboard picker.


Core services ​

window.lcards.core is the LCARdSCore instance (src/core/lcards-core.js). It creates these services once and exposes each as a property. Each one is documented in Core Subsystems, which also has the full initialization table.

AreaServices (window.lcards.core.*)
Entities and overlayssystemsManager (entity cache, subscriptions, card and overlay registries)
DatadataSourceManager (named buffers with processors)
RulesrulesManager (one engine for every rule on the page)
ThemingthemeManager (tokens, alert modes), stylePresetManager, componentManager
AnimationanimationManager, performanceMonitor (FPS watch for canvas backgrounds)
ConfigvalidationService, configManager (merge pipeline with provenance)
Assets and packsassetManager, packManager
Helpers and soundhelperManager (LCARdS input_* helpers, alert-mode auto-switch), soundManager
ScreenscreenEffectManager, borgAssimilationManager, portalOverlayManager, connectionOverlayService
BackendintegrationService, deviceIdentityManager, scopedSettingsService

The template evaluator is not a singleton: UnifiedTemplateEvaluator is created per use (Template System). There is no actionHandler and no animationRegistry on the core: action handlers are per card, and the animation presets are a module registry (src/core/animation/presets.js).


Packs ​

Packs are plain JavaScript objects bundled with LCARdS that fill the registries at startup. There is no external or user pack loader.

  • PackManager.loadBuiltinPacks() (src/core/PackManager.js) is called once, from LCARdSCore._performInitialization(), with CORE_REQUESTED_PACK_IDS; loadBuiltinPacks() (src/core/packs/loadBuiltinPacks.js) adds the always-loaded packs, so 14 packs are registered.
  • Animation presets do not come from packs: registerBuiltinAnimationPresets() fills the preset registry in src/core/animation/presets.js.
  • The rules key is supported, but no built-in pack ships rules today.

What each pack holds and how to add one: Pack System.


Further reading ​

Released under the MIT License. | About