Skip to content

MSD Card

Under Construction

The MSD card and its documentation are under active development. This system was the original basis for LCARdS and is under refactoring to fit better with the rest of the system. Features and stability should improve over time.

custom:lcards-msd

Master Systems Display — a zoomable SVG canvas on which you position any Home Assistant card as an overlay. Lines (routes) connect anchors across the canvas. Supports rules-based automation of both overlay styles and base SVG filters.


Quick Start

yaml
type: custom:lcards-msd-card
msd:
  base_svg:
    source: builtin:ncc-1701-a-blue
  anchors:
    bridge: [520, 380]
    engineering: [620, 520]
  overlays:
    - id: bridge-status
      type: control
      anchor: bridge
      size: [180, 80]
      card:
        type: custom:lcards-button
        entity: light.bridge
        preset: lozenge
    - id: engineering-line
      type: line
      route: auto
      from: bridge
      to: engineering

Top-Level Options

OptionTypeDescription
typestringcustom:lcards-msd (required)
msdobjectFull MSD configuration (required)
idstringCard ID for rule targeting
tagslistTags for rule targeting
ruleslistRules for dynamic overlay styling — see Rules Engine
data_sourcesobjectdata source definitions — see Data Sources

msd Object

OptionTypeDescription
base_svgobjectSVG source and filters (required)
view_boxstring / array"auto" or [minX, minY, width, height]
anchorsobjectNamed [x, y] anchor points for overlay placement
overlayslistControl and line overlays — see below
routingobjectGlobal line routing settings
debugobjectDebug visualisation options

base_svg Object

FieldTypeDescription
sourcestringSVG source — builtin:<name>, /local/path.svg, or none
filter_presetstringNamed filter preset — see table below
filterslistAdditional CSS/SVG filters — see Base SVG Filters

Filter Presets

Filter presets apply a CSS filter combination to the base SVG to shift the visual weight, letting overlays stand out:

PresetOpacityEffect
dimmed0.5Moderate de-emphasis, brightness 0.8
subtle0.6Gentle — slight blur + 20% desaturate
backdrop0.3Heavy dimming, 3 px blur, brightness 0.6
faded0.4Washed-out — 50% desaturate, contrast 0.7
red-alert1.0Brightened with +10° hue rotation — a deliberate shift that warms the SVG palette slightly; combine with rules-based card colour changes for a full alert look
monochrome0.6Full greyscale, contrast 0.8
noneRemove all filters
yaml
base_svg:
  source: builtin:ncc-1701-a-blue
  filter_preset: dimmed

Rules can change filter_preset dynamically — see the rules example below.


anchors Object

Named points used for overlay placement and line routing. Values are [x, y] in SVG user units (matching the SVG viewBox). Percentages are also accepted.

yaml
anchors:
  bridge: [520, 380]
  engineering: [620, 520]
  sickbay: ["40%", "55%"]   # Percentage of viewBox dimensions

Overlay Types

Control Overlay

Embeds any HA card at a position on the canvas.

FieldTypeDescription
idstringOverlay ID — required; used for rule targeting
typestringcontrol
anchorstringAnchor name to centre on
positionarrayExplicit [x, y] position (overrides anchor)
sizearray[width, height] in px
cardobjectAny HA card config
visiblebooleanShow/hide overlay (true by default)
z_indexnumberStacking order (higher = in front)
tagslistTags for rule targeting
yaml
- id: engine-status
  type: control
  anchor: engineering
  size: [200, 90]
  z_index: 10
  card:
    type: custom:lcards-button
    entity: sensor.warp_core_status
    preset: lozenge

Line Overlay

Routes a line between two anchors on the canvas.

FieldTypeDescription
idstringLine ID (required)
typestringline
fromstringSource anchor name
tostringTarget anchor name
routestringRouting algorithm — see table below
waypointslistIntermediate [x, y] points or anchor names
route_hintstringInitial segment direction: xy (horizontal first) or yx
corner_stylestringmiter, round, or bevel
corner_radiusnumberRadius for round corners in px
route_channelslistChannel IDs this line routes through
clearancenumberMin clearance around obstacles in px

Routing Algorithms

route valueDescription
autoSystem decides (recommended)
directStraight line
manhattanL-shaped (single bend)
smartIntelligent multi-bend pathfinding
gridA* on pixel grid
manualExplicit waypoints list
yaml
- id: power-line
  type: line
  from: engineering
  to: bridge
  route: manhattan
  route_hint: yx
  corner_style: round
  corner_radius: 6

routing Object

Global defaults that apply to all lines unless overridden per-line:

FieldTypeDefaultDescription
default_modestringmanhattanDefault routing mode
clearancenumber0Global obstacle clearance in px
auto_upgrade_simple_linesbooleantrueAuto-upgrade to smart routing when needed

debug Object

Visualisation aids — useful while building your layout:

FieldTypeDefaultDescription
enabledbooleanfalseEnable debug overlays
show_anchorsbooleanfalseShow anchor points as circles
show_gridbooleanfalseShow routing grid
show_routingbooleanfalseShow line routing paths
yaml
debug:
  enabled: true
  show_anchors: true

Rules Engine Integration

The MSD card integrates with the global Rules Engine to dynamically restyle overlays and change the base SVG filter:

yaml
rules:
  - id: warp-alert
    when:
      entity: sensor.warp_core_temp
      above: 95
    apply:
      base_svg:
        filter_preset: red-alert
        transition: 500          # Crossfade in ms
      overlays:
        engine-status:
          style:
            color: "var(--lcards-alert-red)"
      animations:
        - overlay: engine-status
          preset: pulse
          loop: true

See Rules Engine for the full condition and apply reference.


Annotated Example

An MSD card with three anchors, a control overlay, a line, and a rule that changes the base SVG filter on alert:

yaml
type: custom:lcards-msd-card
msd:
  base_svg:
    source: builtin:ncc-1701-a-blue
    filter_preset: dimmed

  anchors:
    bridge: [520, 380]
    engineering: [620, 520]
    sickbay: [410, 460]

  overlays:
    - id: bridge-card
      type: control
      anchor: bridge
      size: [180, 80]
      tags: [status-displays]
      card:
        type: custom:lcards-button
        entity: sensor.bridge_status
        preset: lozenge
        text:
          name:
            content: Bridge
        tap_action:
          action: more-info

    - id: power-line
      type: line
      from: engineering
      to: bridge
      route: manhattan
      route_hint: yx
      corner_style: round
      corner_radius: 6

  routing:
    default_mode: manhattan
    clearance: 10

  debug:
    enabled: false
    show_anchors: false

rules:
  - id: reactor-alert
    when:
      entity: sensor.reactor_temp
      above: 90
    apply:
      base_svg:
        filter_preset: red-alert
        transition: 500
      overlays:
        bridge-card:
          style:
            color: "var(--lcards-alert-red)"
      animations:
        - tag: status-displays
          preset: pulse
          loop: true