Append to a config file
files_append_to_config_fileAppend raw text to an existing Home Assistant config file, matching list indentation, with optional YAML validation. For automations, use automations_set_automation_config.
Instructions
Append text to the end of an existing config file.
Resolves relative_path via _safe_path, reads its current text,
appends content after a newline, YAML-checks the combined text only
when validate_yaml=True and the extension is .yaml/.yml, then writes
the combined text back.
Use when: adding raw YAML/JSON/txt lines that already match the file's
existing list indentation.
Not for: automations — use automations_set_automation_config, which
edits by config id instead of a raw text append.
Returns: dict {"success": True, "path": ...} on success, or
{"success": False, "error": ...} when validate_yaml=True and the
combined text fails to parse.
Errors: raises FileNotFoundError when the file does not exist, and
raises PermissionError (from _safe_path) for a path outside the
config directory, a disallowed extension, or secrets.yaml/.storage.
Limits: validate_yaml defaults to False, so an invalid append is
written without warning unless explicitly checked.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| content | Yes | Text appended after a newline to the file's existing content. | |
| relative_path | Yes | Path to an existing file relative to the HA config directory (HA_CONFIG_PATH), e.g. 'automations.yaml'. Must use an allowed extension (.yaml/.yml/.json/.txt) and not touch secrets.yaml or .storage/. | |
| validate_yaml | No | If True and the extension is .yaml/.yml, the combined text (existing content plus the appended `content`) is YAML-checked before writing. Defaults to False, so an invalid append is written without warning unless set True. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||