Skip to content

Embed YAML snippet of each automation / script in its entry #44

Description

@dibi73

Idea

Currently the Automatisierungen bundle shows friendly_name / description / mode / last_triggered. NOT the actual logic. For documentation of "why does this happen" the trigger / condition / action structure is the key.

Proposed change

Per automation entry, append a fenced YAML block with the underlying configuration:

```yaml
trigger:

  • platform: time
    at: "sunset"
    condition: []
    action:
  • service: light.turn_on
    target:
    area_id: garden
    ```

Same for scripts (action sequence).

Source

UI-managed automations are stored in .storage/core.entity_registry for entity records and .storage/automations / .storage/scripts for the body. YAML-defined automations are in configuration.yaml / automations.yaml and HA exposes them via hass.data['automation'] after load.

Best path: automation.async_get_blueprint_used exposed by HA + reading the storage file directly. Both async-safe.

Files

  • extractor.py — extend AutomationSnapshot/ScriptSnapshot with yaml_body: str | None
  • renderer.py — render fenced yaml block per entry

Edge cases

  • Very long automations (200+ lines) — truncate or full? Suggest full; users can collapse in BookStack
  • Sensitive data in YAML (API keys, tokens) — automations don't usually have them, but document the risk

Acceptance

  • Each automation entry has YAML block with its config
  • Determinism preserved
  • Tests for both UI-defined + YAML-defined sources

Scope

Mittel-groß. v0.9.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions