π Bug fix
Fixes #82 β automations.yaml corruption when creating/editing an automation.
create_automation rewrote the entire automations.yaml with a plain yaml.dump, which (because allow_unicode defaults to off) mangled every accented character into \uXXXX escape sequences β corrupting not just the new automation but existing, unrelated ones too, and taking no backup.
What's fixed
- Unicode preserved β no more
\uXXXX; accented aliases/descriptions stay readable. - Existing automations untouched β key order preserved, no reordering/escaping of unrelated entries.
- Backup before every write β
automations.yaml.bakgives a rollback path. - Round-trip validation + atomic write (temp file +
fsync+os.replace, preserving file permissions) so a bad write can never leave a corrupted file. - Single-mapping
trigger/actionis now normalized instead of being dropped.
Verified end-to-end with Home Assistant's own YAML loader. See #83 for details.