Background and Anchors
The drawing an MSD is built on, and the named points on it that overlays and lines use. The overlays themselves have their own pages: Control Overlay, Line Overlay and Shape Overlay.
msd
Everything the display shows lives under the card's msd key: the blueprint, the view box, the anchors, the overlays and how lines are routed. The other top-level keys (id, rules, sizing) are on the overview.
- An
msdneeds a blueprint (base_svg.source) or aview_box. Aview_boxwith no blueprint is a blank canvas. - Every position, size and distance under
msdis in the drawing's own units (its view box), not pixels, so the whole display scales with the card.
type: custom:lcards-msd-card
grid_options:
columns: full
rows: 5
msd:
# the blueprint, and the part of it to show
base_svg:
source: builtin:ncc-1701-a-blue
view_box: [180, 270, 1600, 720]
# a card on the drawing, and a line from it to the bridge marker (br)
overlays:
- id: bridge-ctl
type: control
attachment: top-left
position: [190, 278]
size: [340, 96]
card:
type: custom:lcards-button
preset: lozenge
entity: input_boolean.lcards_test_lights
text:
name:
content: BRIDGE
show: true
font_size: 30
- id: bridge-line
type: line
anchor: bridge-ctl
attach_to: br
route: auto
corner_style: round
style:
color: var(--lcards-gray-medium-light)
width: 3| Key | Type | Default | Description |
|---|---|---|---|
msd.base_svg | object | - | The blueprint: see base_svg. Not needed for a blank canvas |
msd.view_box | auto / list | auto | The part of the drawing shown, [min_x, min_y, width, height]: see view_box |
msd.anchors | object | - | Your own named points: see anchors |
msd.overlays | list | - | The controls, lines and shapes: see Overlay types |
msd.routing | object | - | Card-wide line routing settings: see Line Routing |
msd.channels | object | - | Named corridors that guide lines: see Line Routing |
msd.animations | list | - | One animation for a group of overlays: see msd.animations |
msd.background_animation | list / object | - | An animated canvas behind the drawing: see background_animation |
msd.triggers_update | string | - | all: every control gets every Home Assistant update. Slower; prefer triggers_update on the one control that needs it (Control Overlay) |
base_svg
The blueprint the display is drawn on: a built-in ship, your own SVG file, or none. Its markers and outline also give you anchors to attach lines to without placing any yourself.
sourcetakesbuiltin:<name>(see Built-in blueprints), a file in your/config/wwwfolder as/local/<file>.svg, a fullhttps://URL (the site must allow it), or an SVG from the Home Assistant media library asmedia-source://....- In the MSD Studio's Base SVG tab, Asset library lists the built-in blueprints, Custom path takes a
/local/path or a URL, and Browse Home Assistant media picks an SVG from the media library (it lists only SVG files). render_visual: falsehides the blueprint but still reads its anchors: use it with an animated or image background and anchors placed on that instead.
type: custom:lcards-msd-card
grid_options:
columns: full
rows: 6
msd:
base_svg:
source: builtin:ncc-1701-kelvin| Key | Type | Default | Description |
|---|---|---|---|
base_svg.source | string | required | builtin:<name>, /local/<file>.svg, an https:// URL, media-source://..., or none for a blank canvas |
base_svg.filters | list | - | Dim, blur or tint the blueprint: see Base SVG Filters |
base_svg.render_visual | boolean | true | false: don't draw the blueprint, only read its anchors and view box |
base_svg.harvest_landmarks | boolean | true | Work out anchors from the blueprint's outline: see Automatic anchors |
base_svg.harvest_svg_elements | boolean | true | Use the blueprint's own named markers as anchors: see Automatic anchors |
base_svg.animations | list | - | Animations on parts of the blueprint, by id or class: see base_svg.animations |
Built-in blueprints
The blueprints that come with LCARdS, for source: builtin:<name>. The MSD Studio's Asset library lists the same ones.
| Source | Blueprint |
|---|---|
builtin:ncc-1701-a | USS Enterprise NCC-1701-A (Constitution class refit), the master systems display |
builtin:ncc-1701-a-blue | The same ship in blue, with markers for the bridge (br), warp core (wc) and shuttle bay (sb) |
builtin:ncc-1701-kelvin | USS Enterprise NCC-1701 of the Kelvin timeline films |
builtin:galaxy-class-lineart | A Galaxy class starship from the side in line art, drawn in your theme's colour, with anchors for its main parts: bridge, saucer, neck, engineering, warp_core, impulse, shuttle_bay, deflector, torpedo, nacelle, bussard, pylon |
builtin:enterprise-d-shuttlecraft15-anomaly | Shuttlecraft 15, a type-6 shuttle of the Enterprise-D, with anomaly markers |
- The line-art Galaxy class suits a labelled schematic: its lines take your theme's colour, and labels join its parts by anchor name (
attach_to: warp_core). The MSD Studio's Quick label tool snaps to them. - Its outline comes from the Galaxy class model the Astrometrics card shows; the decks, the warp core and the nacelle coils are drawn inside it.
# The line-art Galaxy class with two labels joined to its parts by name
type: custom:lcards-msd-card
grid_options:
columns: full
rows: 5
msd:
base_svg:
source: builtin:galaxy-class-lineart
overlays:
- id: lbl_1
type: control
attachment: right
position: [430, 90]
size: [354, 75.4]
card:
type: custom:lcards-button
preset: text-only
min_height: 0
text:
label:
content: MAIN BRIDGE
show: true
position: center-right
font_size: 52
color: theme:colors.ui.secondary
- id: ln_1
type: line
anchor: lbl_1
anchor_side: right
anchor_gap: 24
attach_to: bridge
attach_side: center
route: manhattan
corner_radius: 40
style:
color: var(--lcars-card-top-color, var(--lcards-gray-medium))
width: 10
- id: lbl_2
type: control
attachment: right
position: [760, 640]
size: [302, 75.4]
card:
type: custom:lcards-button
preset: text-only
min_height: 0
text:
label:
content: WARP CORE
show: true
position: center-right
font_size: 52
color: theme:colors.ui.secondary
- id: ln_2
type: line
anchor: lbl_2
anchor_side: right
anchor_gap: 24
attach_to: warp_core
attach_side: center
route: manhattan
corner_radius: 40
style:
color: var(--lcars-card-top-color, var(--lcards-gray-medium))
width: 10view_box
Which part of the drawing the card shows, and the coordinates every position on it uses. By default it is the blueprint's own view box, so the whole drawing fits the card.
- Give
[min_x, min_y, width, height]to show only part of the blueprint: the card crops to it and keeps its shape (width to height). - Overlay positions stay in the blueprint's coordinates whatever the view box: cropping moves the window, not the overlays.
- In the MSD Studio, the Base SVG tab's ViewBox section switches between Auto-detect from SVG and a custom view box.
# Only the ship's middle, cropped from the 1920 by 1200 blueprint
type: custom:lcards-msd-card
grid_options:
columns: full
rows: 5
msd:
base_svg:
source: builtin:ncc-1701-a-blue
view_box: [180, 270, 1600, 720]More about view_box
- No view box in the SVG: with
auto, an SVG file that has noviewBoxof its own is read as[0, 0, 400, 200]. Giveview_boxfor such a file.
| Key | Type | Default | Description |
|---|---|---|---|
view_box | auto / list | auto | auto: the blueprint's own view box. Or [min_x, min_y, width, height] in the blueprint's units; required for a blank canvas |
A blank canvas
A display with no blueprint: give a view_box and draw everything with overlays. Use it for a panel of controls wired together, or a floor plan drawn from shapes.
- A
view_boxwith nobase_svgis a blank canvas;base_svg.source: nonesays the same thing and needs aview_boxtoo. - With no blueprint there are no automatic anchors: place overlays by
[x, y]or by your own anchors.
type: custom:lcards-msd-card
grid_options:
columns: full
rows: 4
msd:
view_box: [0, 0, 800, 300]
overlays:
- id: deck
type: shape
kind: rect
position: [40, 40]
size: [720, 220]
corner_style: round
corner_radius: 24
style:
color: var(--lcars-orange)
width: 3
fill: alpha(var(--lcars-orange), 0.1)
- id: lights-ctl
type: control
position: [400, 150]
size: [260, 80]
card:
type: custom:lcards-button
preset: lozenge
entity: input_boolean.lcards_test_lights
text:
name:
content: DECK LIGHTS
show: trueanchors
Your own named points on the drawing, for placing controls and for the ends of lines. A control's position, a line's anchor or attach_to, and a shape's position or points can all name an anchor instead of giving [x, y].
- Each anchor is
[x, y]in the drawing's units. Either value may be a percentage of the view box instead ("40%"), measured from its top-left corner. - An anchor you name here wins over an automatic anchor of the same name, so you can move a blueprint's marker without editing the file.
- In the MSD Studio, the Anchors tab adds anchors with Add Anchor or by clicking Place on Canvas.
type: custom:lcards-msd-card
grid_options:
columns: full
rows: 4
msd:
view_box: [0, 0, 800, 300]
anchors:
port: [150, 120]
starboard: ["80%", "40%"]
relay: ["50%", "85%"]
overlays:
# controls centred on two anchors
- id: port-ctl
type: control
position: port
size: [200, 70]
card:
type: custom:lcards-button
preset: lozenge
entity: input_boolean.lcards_test_lights
text:
name:
content: PORT
show: true
- id: starboard-ctl
type: control
position: starboard
size: [200, 70]
card:
type: custom:lcards-button
preset: lozenge
entity: input_boolean.lcards_test_doors
text:
name:
content: STARBOARD
show: true
# lines from each control to the relay anchor
- id: port-line
type: line
anchor: port-ctl
attach_to: relay
route: auto
corner_style: round
- id: starboard-line
type: line
anchor: starboard-ctl
attach_to: relay
route: auto
corner_style: round| Key | Type | Default | Description |
|---|---|---|---|
anchors.<name> | [x, y] | - | A named point in the drawing's units. Each value may be a percentage of the view box, as "40%" |
Automatic anchors
A blueprint gives you anchors of its own, so lines can attach to it before you place any: its named markers, and landmarks worked out from its outline. Both are on by default.
- Landmarks (
harvest_landmarks) come from the blueprint's silhouette:hull_center(its middle),extremity_bowandextremity_stern(the right-most and left-most points),extremity_topandextremity_bottom, and on a twin-hulled shape such as a ship with nacelles,lateral_aandlateral_b(the tips of the two hulls). - Markers (
harvest_svg_elements): every<circle>,<ellipse>,<text>and<rect>in the SVG with anidis an anchor of that name (a rectangle by its centre). The built-inncc-1701-a-bluehasbr,wcandsbthis way. - When names collide, your anchors win over markers, and markers over landmarks.
type: custom:lcards-msd-card
msd:
base_svg:
source: builtin:ncc-1701-a-blue
overlays:
- id: top-ctl
type: control
attachment: top-left
position: [60, 60]
size: [360, 100]
card:
type: custom:lcards-button
entity: input_boolean.lcards_test_lights
preset: lozenge
text:
name:
content: TOP
show: true
font_size: 30
- id: centre-ctl
type: control
attachment: top-left
position: [60, 1040]
size: [360, 100]
card:
type: custom:lcards-button
entity: input_boolean.lcards_test_toggle
preset: lozenge
text:
name:
content: CENTRE
show: true
font_size: 30
# a landmark from the outline, and one from the middle of the ship
- id: top-line
type: line
anchor: top-ctl
attach_to: extremity_top
route: auto
- id: centre-line
type: line
anchor: centre-ctl
attach_to: hull_center
route: autoMore about automatic anchors
- Facing:
extremity_bowis the right-most point, so it is the bow only on a blueprint that faces right. - Landmarks that share a spot: a landmark that lands on the same place as one before it is left out. On a ship whose nacelles reach furthest,
lateral_aandlateral_btake that spot andextremity_boworextremity_sternmay not exist. - Ids from a drawing program: marker names come from the SVG as exported, so they can be numbered (
g293) rather than meaningful. Ids that start with__ormsd-internal-are skipped. - In the MSD Studio: the Anchors tab lists both kinds read-only, as Base SVG: Computed (landmarks) and Base SVG: Harvested (markers), with a search box. Promote to User Anchor opens the Add Anchor form at that point, so you can give a
g293a proper name underanchors; Promote All does it for every entry the search matches. - Turning them off: set
harvest_landmarks: falseorharvest_svg_elements: falseto drop either kind, for example a long list of numbered markers. Turning landmarks off also saves the work of reading the outline when the card loads.
| Key | Type | Default | Description |
|---|---|---|---|
base_svg.harvest_landmarks | boolean | true | Landmarks from the blueprint's outline: hull_center, extremity_bow, extremity_stern, extremity_top, extremity_bottom, lateral_a, lateral_b |
base_svg.harvest_svg_elements | boolean | true | The blueprint's named <circle>, <ellipse>, <text> and <rect> elements, by their id |
background_animation
An animated canvas behind the drawing: a starfield, a grid, a nebula, or a still image. It is the same background the button and elbow cards use, with every preset of Background Animations.
- It draws behind the blueprint and every overlay, whatever their
z_index. - To use a picture instead of a blueprint, set
base_svg.render_visual: falseand add theimagepreset: the blueprint's anchors and view box still apply, so you can keep its markers or place your own anchors on the picture. - In the MSD Studio it is the Base SVG tab's Background Effects section; the Studio's preview doesn't draw it.
type: custom:lcards-msd-card
grid_options:
columns: full
rows: 5
msd:
base_svg:
source: builtin:ncc-1701-a-blue
view_box: [180, 270, 1600, 720]
# stars drifting behind the ship
background_animation:
- preset: starfield
config:
count: 200| Key | Type | Default | Description |
|---|---|---|---|
background_animation | list / object | - | A list of effects (preset and config), or inset and effects: see Background Animations |