Why is there a GUI and YAML mode for Lovelace settings

What is the reason for Lovelace having a YAML and an GUI mode for settings.
When in GUI mode I can edit raw YAML to add elements and the YAML is translated into GUI configuration.

So why does it not update and read from the ui-lovelace.yaml file in the first place.
For me it would combine the best of both worlds: Being able to modify the UI within the Web interface and easy external modification and backup of the settings.

Each option misses the best of the other option in my opinion.

Because some people want to use YAML, and some people want to use the GUI.

It’s really just converted to JSON and saved into the .storage directory.

It just goes to a JSON file. You can back it up just like normal.

1 Like

What I don’t understand is why the GUI does not use the YAML file but a different JSON file instead.
There could be just one mode to fit both peoples needs.
For me a natural thing would be to store everything in the YAML file and the GUI editor would directly interact affect that file.
Are there usecases were it’s useful to have two config modes that don’t affect each other?
YAML and GUI don’t seem to be options that exclude each other.

Well, it doesn’t matter. If the system edits the YAML, it re-writes the whole file, and that frustrates people.

A few years back the project tried that with other things, and the fact that people’s careful ordering was lost, comments thrown away, etc, caused a lot of upset.

2 Likes

Something like this could be used to fix that. https://pypi.org/project/ruamel.yaml/

Actually looks like they do use this so I’m really not sure why they don’t allow saving to both yaml and json so we can easily edit yaml in the GUI editor instead of being locked out.

Also the reason for the json is that the frontend uses it and in Javascript JSON is preferred over yaml.

1 Like

I see that makes sense and is a valid reason.
It might also

That is also a good reason.

Thanks for answering this.

1 Like

They also automatically added ID’s and people REALLY hated that! (In addition to reordering everything). That’s when they backed out that and went to storage mode.

You can use raw mode to paste from a YAML file if you want. I edit a lovelace yaml file (with comments etc) and paste that into raw mode while still being able to try stuff in the GUI editor before editing the yaml… works for me.

1 Like

What I plan to build is an application, that automatically creates the GUI depending on external factors.
So for me it of course would be much easier if there would be only one way to edit and store the GUI :wink:

For manual editing the way you described it is perfectly fine.