Dashboard

From markusleben/ha-nova · View interactive version

Dashboard is an AI agent skill from the GitHub repository markusleben/ha-nova. Use when listing, reading, building, redesigning, updating, or deleting Home Assistant dashboards, views, and cards (installed custom cards included), checking dashboards for broken cards, or managing Lovelace resources through HA NOVA Relay.

How to use this skill

Skill file

HA NOVA Dashboard

Scope

Writes go only to mode: storage dashboards. A yaml dashboard is read-only here: say that its config lives in a YAML file (ha-nova:yaml-config) and offer a storage copy (a new dashboard with that content).

Not in scope: energy dashboard preferences (ha-nova:energy), installing a custom card (ha-nova:hacs), screenshots through the Relay (a client's own browser may look).

Bootstrap (once per session)

Read and follow ../ha-nova/session-bootstrap.md.

Relay Contract

Dashboard content goes through typed verbs only:

Metadata, resources, and themes: reads through ha-nova relay ws --data-file <payload-file>, writes only as ha-nova plan raw items:

Never send lovelace/config/save, lovelace/dashboards/create, or lovelace/dashboards/delete by hand: the plan does. Shape: {"type":"lovelace/config/save","url_path":"<url_path>","config":{"views":[...]}} — the whole document goes under config, and whatever the draft leaves out is gone. The default dashboard is --id lovelace; the CLI omits url_path when it is not listed.

Flow

Drafts follow ../ha-nova/smallest-solution.md: the complete requested outcome in the simplest safe design, nothing speculative.

  1. Resolve: ha-nova get --dashboards; match url_path or title; ask one blocking question only if more than one still matches. mode: empty = no stored config yet (a new shell, or the auto-generated default).
  2. Inspect (existing only; a new one drafts from {} or a strategy): ha-nova get --dashboard <url_path> --config; save config to a client-private scratch file as the draft basis and keep its config_digest for --base. jq filters null-guard absent keys: (.views // [])[], never bare .views[]; same for .cards, .sections, .badges.
  3. Draft the WHOLE config (base = current, overlay = the change; unrelated views and cards stay byte-for-byte):
  1. Plan: ha-nova plan write …. Exit 3 is normal (plan.confirm natural). Exit 4: UNKNOWN_ENTITY → resolve and fix the draft; DASHBOARD_NOT_STORAGE → read-only, explain; CONFIG_ID_IN_USE on a create → first check whether an earlier apply created it (then never create another), else another url_path. Exit 2 PLAN_DRIFT → the dashboard changed since that read (an edit in the UI): read again, re-merge, plan again. Exit 5 NOT_FOUND → its candidates.
  2. Preview: the plan's diff rows verbatim in the Changes slot, plus a plain-language behavior line (write-safety → Behavior narrative) that names every removed view and card. Name each result.issues entry with new: true: a new card_type_unconfirmed card blocks the save until the user confirms it is installed; say a disabled entity plainly. Say: a dashboard editor left open in Home Assistant would write its old copy back — close it first. Close the card with the plan's say.
  3. Confirm: the CLI decides — plan.confirm none → apply; natural → show the preview and wait for the user's reply; code → follow say/next_step (window, phone, form, or chat code), never a menu.
  4. Apply: ha-nova apply --plan <id> (a plan.code: --confirm <the user's exact text> before --plan). Apply re-reads the live dashboard first, and again right before the save: exit 2 means it changed since the preview — nothing was saved; read it again, re-merge, re-preview. Exit 6 CONFIG_REJECTED: relay say, then follow next. Exit 7: unknown; never retry. SNAPSHOT_FAILED saved nothing: offer pruning the snapshot store, a full safety backup (ha-nova:backup), or proceeding without one; only after the user picks the last, apply [--confirm <code>] --plan <id> --no-snapshot (--confirm only with a plan.code).
  5. Result: verified = the read-back equals the plan (a create: also listed; a delete: no longer listed). undo or snapshot, and no way back in say: say it can be undone; offer revert for an update. A create is cleaned up through the delete flow. A deleted dashboard restores from its snapshot (../ha-nova/config-snapshots.md) by the delete result's restore (a --create with the shell's title and flags; the main lovelace dashboard: a plain write) — the dashboard_id is new.
  6. Broken-card sweep: ha-nova get --dashboards; report per dashboard each missing_entity (with its detail) and card_type_unconfirmed (no installed resource seems to provide it — missing, or loaded another way, e.g. extra_module_url). Nothing found: "No broken cards found in <n> dashboards." Fixes: one dashboard at a time, steps 2–8.
  7. Metadata update: preview the exact fields and the plan's say, confirm, then apply; only send changed metadata fields supported there: title, icon, show_in_sidebar, require_admin; do not resend url_path, mode, or unrelated config fields in the update payload. Verify through lovelace/dashboards/list.
  8. Resources: create/update previews res_type and url (third-party code in every signed-in browser, with its user's rights), delete the exact resource (resource_id); each plan asks; verify via lovelace/resources.
  9. Several changes in one dashboard are ONE draft and one plan; a card batch within one dashboard executes as ONE merged lovelace/config/save. Dashboards delete one at a time (a plan delete code binds one); resource batches follow ../ha-nova/batch-safety.md. An entity reference on an existing dashboard may join a non-destructive grouped change set ONLY as the downstream operation of a dependency-bound set (../ha-nova/grouped-change-set.md → Dependency-Bound Outputs); a dashboard-card removal may join a cross-family destructive cleanup only through its manifest (grouped-change-set.md → Cross-Family Destructive Cleanup).
  10. Verification fails: stop, report the mismatch; never retry by guessing.

Output Format

Apply ../ha-nova/output-rules.md: plain words, HA names verbatim; unless asked or names clash, no ids, "entity", modes, Relay/HA URLs, snapshots, raw JSON. Previews, deletes, and results use the Cards defined there (../ha-nova/output-cards.md).

For list/read/sweep:

Use stable localized slot labels in this order; omit empty slots, do not invent ad-hoc headings. List/read renders the Report shape; dashboard and resource inventories render the List Frame (output-cards.md).

Never dump the full dashboard config unasked.

Safety

Guardrails

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.