Add section to dashboard view
dashboards_add_section_to_viewAdd a new section to a Home Assistant sections dashboard view, optionally at a specific position. Use it to create a card group before adding cards.
Instructions
Insert a new section into a type: sections view.
Resolves the view via _load_view, requires it to be a sections
view, defaults section_config to {"type": "grid", "cards": []}
when omitted, inserts it into that view's sections list at
position (or the end), and saves the whole dashboard back. When
expected_config_hash is given, it is checked against the dashboard's
hash right after the read and before any change.
Use when: adding a whole new section (a card group with its own grid)
to a sections view, before populating it with
dashboards_add_card_to_section. Pass expected_config_hash whenever
position came from an earlier read that might now be stale.
Returns: {status: "added", url_path, view_index, view_title, section_index, sections_in_view, config_hash} — config_hash is
re-read from HA after the save, ready to chain into the next call's
expected_config_hash.
Errors: raises ValueError when section_config["cards"] isn't a
list, or the view can't be resolved/isn't a sections view. Returns
{"error": "config_changed", "expected_config_hash", "current_config_hash", "action"} without saving when
expected_config_hash doesn't match.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| position | No | Zero-based index within the view to insert the section at. Omit to append at the end. | |
| url_path | Yes | Dashboard url_path, or a view path in the default dashboard (e.g. 'living-room'). | |
| view_index | No | Zero-based view index; needed only when url_path names a dashboard rather than a view path. | |
| section_config | No | Section body, e.g. {'cards': [{'type': 'heading', 'heading': 'Living Room'}]}. Omit for an empty grid section. | |
| 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 position is a plain index and a change since your read may insert the new section somewhere unintended. Omit to skip the check (today's behaviour). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||