On the left: how I wrote it; on the right: GUI’s “rewrite”.
Do I need to explain more?
I know… not possible with current implementation blah blah → then maybe there are other ways/libs that parse/write YAML a bit more intelligently?
On the left: how I wrote it; on the right: GUI’s “rewrite”.
Do I need to explain more?
I know… not possible with current implementation blah blah → then maybe there are other ways/libs that parse/write YAML a bit more intelligently?
It’s annoying isnt it?
The sad truth is that the way the YAML processing works in Python (HA’s language) it does not preserve the formatting when serializing the config back to text.
It’s not python doing it.
Theres multiple threads out here with people complaining about comments getting stripped that explains what’s happening.
In short you’re not saving yaml it’s stored as JSON and it simply doesn’t store the comments. Therefore everything is condensed down, stored as JSON and ‘represented’ as yaml when you want to edit it. If you want yaml formatting etc you have to swith to yaml mode. On yor dashboards so it’s jot stored in the dB.
That doesn’t happen to me.
Oh wait, I don’t put manually written descriptions in the UI.
Aside from the snark, because I know you were expecting something from somebody, did you try enclosing in " the regular double-quote character, any different? If you add the description using the gui (shishk-a-bob menu-rename-description), any changes? That one places your text into the same double-quote character.
Just trying to see if anything improves for you.
This is likely because you specified that the the carriage returns should be stripped by using >
, use |
instead.
Have a play with the demo here: https://yaml-multiline.info/
Though as Nathan mentioned, the conversion yaml → json → yaml may affect this.
The json conversion explains it, but it doesn’t make it any less annoying.
Not only is my nice neat, readable formatting removed, so are comments (and there are many good reasons for using either descriptive comments or just temporarily commenting out code whilst developing).
Also while developing, if you get some templating stuff just slightly wrong, your carefully crafted expression will be replaced with something along the lines of “[Object] Object | null”.
Arggghhhh!
Every single thing I type into the UI i need to copy paste into notepad first to save me time having to recraft an expression that just needed a small syntax fix.