Update card in dashboard section
dashboards_update_card_in_sectionUpdate one existing card in a Home Assistant sections view by merging changes or replacing it, with optional config hash guard against stale edits.
Instructions
Change one existing card inside a section of a type: sections view.
Resolves the view and target card via _load_view/_require_card,
then merges card_config's keys into the existing card (merge=True,
the default) or replaces it outright (merge=False), and saves the
whole dashboard back. The previous card is only recoverable via
card_before in this call's own response — storage itself keeps no
history. With expected_config_hash, the dashboard's hash is checked
right after the read and before any change, so a stale caller can't
edit the wrong card.
Use when: tweaking or replacing one card already placed in a section.
Pass expected_config_hash when section_index/card_index came
from a read that might now be stale.
Not for: adding a new card — use
dashboards_add_card_to_section; removing one — use
dashboards_remove_card_from_section.
Returns: {status: "updated", url_path, view_index, view_title, section_index, card_index, card_before, card_after, config_hash} —
config_hash is re-read from HA after the save, for the next call's
expected_config_hash.
Errors: raises ValueError when card_config is empty, merge=False
lacks a type key, or the view/section/card can't be resolved.
Returns {"error": "config_changed", ...} without saving when
expected_config_hash doesn't match.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| merge | No | If true (default), merge card_config's keys into the existing card. If false, replace the card wholesale. | |
| url_path | Yes | Dashboard url_path, or a view path in the default dashboard (e.g. 'living-room'). | |
| card_index | Yes | Zero-based card index within the section, from dashboards_get_view_sections/inspection. | |
| view_index | No | Zero-based view index; needed only when url_path names a dashboard rather than a view path. | |
| card_config | Yes | Card fields to apply. With merge=true, a partial update (only these keys change); with merge=false, the full replacement card (needs a 'type' key). | |
| section_index | Yes | Zero-based section index, from dashboards_get_view_sections. | |
| expected_config_hash | No | Optional guard: the config_hash from a recent dashboards_get_view_sections or section-tool response. If the dashboard's current hash differs, this call returns 'config_changed' and saves nothing, since section_index/card_index are positions, not stable ids, and a change since your read may target the wrong card. Omit to skip the check (today's behaviour). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||