ha-lovelace
Dashboards, their stored view/card config, and custom resources. All WebSocket.
Prerequisite: ../ha-shared/SKILL.md.
Mental model
- A dashboard is a container (sidebar entry). Storage-mode dashboards are editable via the API; YAML-mode ones are read-only here.
- Each dashboard has a config (the
viewsarray of cards). The default dashboard is addressed by omitting--dashboard(null url_path); named ones by theirurl_path. - Resources are extra JS/CSS modules loaded into the frontend.
Dashboards
hass-cli lovelace dashboard list
hass-cli lovelace dashboard create --data '{"url_path":"ops-room","title":"Ops Room"}'
hass-cli lovelace dashboard update <dashboard_id> --data '{"show_in_sidebar":false}'
hass-cli lovelace dashboard delete <dashboard_id>
url_pathMUST contain a hyphen (e.g.ops-room). The returnedid(e.g.ops_room) is whatupdate/deletetake, while--dashboardfor config takes theurl_path.
Read / write a dashboard config
The config is the whole views tree. Round-trip it as YAML for editing:
# Export current config (default dashboard) to a file
hass-cli lovelace config get -o yaml > dashboard.yaml
# Export a named dashboard
hass-cli lovelace config get --dashboard ops-room -o yaml > ops.yaml
# Edit, then save it back
hass-cli lovelace config save --dashboard ops-room --file ops.yaml
# Revert to auto-generated
hass-cli lovelace config delete --dashboard ops-room
Minimal config file:
views:
- title: Home
cards:
- type: markdown
content: Hello from hass-cli
config geton a default storage dashboard that was never edited may error with "config not found" — it's still auto-generated. Save a config first, or create a dedicated dashboard.
Add a card (typical agent flow)
lovelace config get --dashboard <path> -o yaml > d.yaml- Append a card under the right view's
cards:list. lovelace config save --dashboard <path> --file d.yaml
Discover valid entity_ids with hass-cli state list first.
Resources
hass-cli lovelace resource list
hass-cli lovelace resource create --data '{"res_type":"module","url":"/local/my-card.js"}'
hass-cli lovelace resource update <resource_id> --data '{"url":"/local/my-card-v2.js"}'
hass-cli lovelace resource delete <resource_id>
res_type is one of module|js|css|html.