Recently while editing Lovelace yaml I noticed that when I order yaml items in specific order, after reopening editor those items are re-ordered (in a manner I don’t like).
I could accept that eventually. What I cannot accept is the fact, that commented lines disappear. Really? Do we have another “smart” application which “knows better”?
Actually it is issue. GUI editor switches into code editor on its own when it is not able to support custom code. This is OK. But damaging my work without any warning is worst practice ever application can do to a user. There is no single reason to do that this way. If they wanted to prevent manual code changes in the GUI, they could have disable this code editor at all.
Thank you for pointing to possibility of editing lovelace.yaml in file editor. but it’s often the overkill comparing to editing selected part of code in GUI editor, seeing results immediately etc.
I really don;t understand some design decisions. One day they will be re-evaluated proving lot of resources wasted and lot of users upset.
If I made an effort to order those items in the way I want, it’s damaging my work. For those who asks why I want to reorder items: I prefer to have card type at the top of card definition. Bottom is “too late”.
Removing comments is damaging my work.
Doing it without any warning is just disrespect (next to bad design)
The raw config editor is saved in json, so no comments and when it is validated and saved in to json, the next time you open the raw editor it loads all the keys back in alphabetical order.
If you believe that there should be more ‘warning’ as to how it works then submit a pull request to update the docs
No one is defending it, simply explaining to you how and why it works that way.
Personally, I don’t like having it alphabetically sorted. However, I don’t have the programming skills to do anything about it. All that I can do is make a Feature Request and hope someone who does have the required skills make it stop sorting.
I’ve learned to live with Lovelace’s YAML sorting. However, I find it unacceptable for automations so I never use the Automation Editor.
Got it. Since I’m a programmer I used to use editors too. But we live in 21th Centaury. GUI has been invented for some reasons. Source code editors provide various helpers and assistance for writing keywords or object names. What cannot be said about HA’s one.
Since I’m not using yaml mode yet: does this mode provides real time preview of edited card? Can I edit single card or I have to edit whole lovelace definition at once?
Yeah… since where the mangling everything is not a bug? AFAIK applications have been invented to help users, not otherwise.
The fact something is done by design doesn’t mean it’s good design.
Please consider to read it again then.
BTW when I wrote app should warn about loosing what user wrote, I mean it literally. Putting it to docs is better than nothing but still not enough (I believe it’s obvious why)
So why is this method even considered useful?
I could understand yaml mode as alternative for skilled HA users as extension to GUI mode. not a replacement for a cost of loosing most important part of GUI builders: preview
Well, for one you’ve already answered part of it in this thread - comments and formatting
another reason is it allows you to split your configuration up into manageable chunks using !include files and that isn’t possible with the UI editors. Everything gets put into one monolithic file. So if you do want to manually edit the raw yaml files for the configuration you made thru the UI you are going to have to wade thru your complete configuration hunting for the piece you want to edit. And remember, since there are no comments and the formatting gets jacked up then you will be looking at a wall of text too find the one thing you want.
Lastly, writing the yaml by hand isn’t really as hard as people make it out to be.
The loss of real time previews hasn’t ever been a big deal to me. I write the code, save it, refresh the lovelace UI and see the results. It takes literally seconds to do that and it’s not that burdensome for the aforementioned benefits I get from manually editing things.
I agree with @maxym. Lovelace is a GUI creator. The GUI editor in Lovelace is great for quick prototyping. After a couple of weeks, you come back to reuse the code and its is jumbled mess. It like using vi or vim for text editing.
I use the following custom card and yaml mode editing, for the best of both worlds
Yes, it’s obvious. But it’s like to give you alternative: either to walk or use bicycle which can go backwards only. It will be faster but lets say, less straight forward
Still don’t get it why such design decisions. Sometimes it seems like devs are doing everything to make things harder or against established standards. I only believe that it’s intermediate state as result of incremental development.
I need to revisit that addon. I already use yaml and cut/paste into the GUI editor so I can play in the GUI as well as maintaining YAML. Works for me but I should try that addon for simplicity.
Your opinion.
If you don’t like what the GUI editor does (I sure don’t) don’t use it. I don’t except for quick experiments but no one is forcing you to use the GUI editor (yet)