Give the opportunity to add more comments

Comments guarantee the future maintenance and life of our software.
Whilst in YAML you can add comments as you need, when you are using the simpler user interface
you are limited to one line in the automations, and no line in scripts.
The possibility to add a comment in each box of the editor (actions, conditions, etc.) would surely help to fix those errors that appear after months of service.

You can set an Alias for all actions and conditions in both scripts and automations. This is available both in the yaml and UI editor. In the UI editor by clicking the meatball menu beside the condition or action then selecting “Rename”. You can write a whole paragraph if you want.

Alias is only a partial solution.

Use case for saved comments

  • working on a script that addresses multiple entities. But I want to troubleshoot in the room I’m currently in, so I am commenting out all the remote entities and filling in my local entities. Upon saving all my remote entities are lost.

  • for adding better delination between large blocks of YAML code.

  • I’d like to leave notes to Future-Me on how this block of code works. Past-Me is lazy and doesn’t want to have to memorize everything.

Why no support for saved comments in YAML?

I realize this is a moot argument.

In my professional circle, there’s widespread dissatisfaction with the cumbersome process of manually editing YAML files. While YAML is capable of handling complex data structures, other formats like JSON, XML, or even TOML offer a more user-friendly experience.

The argument is that Home Assistant (HA) converts your YAML input into JSON, which lacks support for comments—wait, what? HA deliberately opted for manual YAML editing over JSON, without providing users the option to directly write JSON?

The situation becomes even stranger when you discover that HA then reverts the compiled JSON back to YAML for human editing. Ok if that’s the case then there should be both a YAML source and a compiled JSON version in the database or files. When a user requests an edit, they should be presented with the YAML source. Upon saving, the YAML source should be saved as-is, while the JSON version is compiled and stored.

I guarantee that the HA source code is filled with comments, and those comments are not removed from the source code when the source code is compiled or shipped.

My guess is that they figure if you can read YAML then why on earth would you need to have comments… What it’s doing is all right there, the code is the comment

Summary of request:
Implement a solution that retains the original human-provided source YAML. OnEdit HA would read the *.yaml file for presentation to the user. OnSave HA would save the *.yaml file as-is and compile/overwrite the *.json file. EZPZ.