#Comments in yaml vs frontend editor

1 messages · Page 1 of 1 (latest)

spring sinew
#

Hey, this is mainly me validating whether what I looked up in the forums is still right and correct.

But I find that when I edit new/unrelated automations or other yaml files, all my comments get discarded along with significant other formatting and syntax changes.

I try to keep my config yaml in git and manually readable, but there seems to be no way to make both approaches co-exist great, right? Or did I miss a best practice that I should follow?

steel hedge
#

I may not be 100% correct on this but I'm pretty sure comments will not be saved when using the UI to edit the YAML. It will also make formatting changes as it sees fit sometimes (which can get annoying).
With dashboards, for example, a dashboard created as YAML mode (raw code files) will retain comments and formatting, but you cannot edit them in the UI.
Take a look at Adding more dashboards with YAML particularly the section with "You can also add YAML dashboards when your main dashboard is UI configured:"

graceful scroll
#

Yeah, one of the most annoying things with HA.

steel hedge
#

I think it is because HA doesn't really use the YAML files, per se. It actually uses JSON but we (as humans) use YAML. HA converts the YAML files to JSON. JSON does not allow comments as it is intended for data only.

spring sinew
#

A few hours after I posted this, my brain stumbled on the obvious-in-hindsight solution: I've moved all the manually created automations to a different named automation section and include file.

Now automations.yaml is the UI's to handle as it pleases and I'm responsible for my own mess as always.