Why my lovelace config code gets fliped after I save

For example:
If I write code:

  - url: /local/tracker-card.js?v=0
    type: js
  - url: /local/mini-media-player-bundle.js?v=0.9.8
    type: module

it flips to:

  - type: module
    url: /local/mini-media-player-bundle.js?v=0.9.8
  - type: module
    url: /local/tracker-card.js?v=0 

everything gets fliped like this.

Keys are stored in alphabetical order. Annoying isn’t it?

Yes and that is the really sucky thing about the storage mode of lovelace… It’s 90% of the reason I make changes in ui-lovelace.yaml and cut/paste those to the raw editor.

Yes, and it is really annoying. Maybe they are doing it as a hat tip to our Australian friends.


I am doing the same thing: copy and pasting it but when I save, this is what happens. So I guess there is nothing I can do about it. It’s just really confusing when you go back and try to read the code.

very much so.

I guess I still don’t get why people are using the GUI mode for lovelace and using the raw editor to copy/paste code from the ui-lovelace file. If you are going to all of the trouble to manually type everything into the raw editor every time you make a change anyway then why not just use yaml mode and be done with it?

You then save a step or two of opening up a couple of windows and copying/pasting the contents from one file to the next with the added possibility of errors being introduced that operation brings. It seems you are giving up the “supposed” benefits of the GUI editor and not gaining any of the benefits of yaml mode. specifically, the GUI editor not rearranging your config and the even bigger benefit of using !include to be able to split up your config into manageable pieces.

It’s sometimes convenient to do a minor change and see it working immediately. Particularly if you’re on a mobile device.

But i can do that with yaml mode too. unless I’m missing something…which is likely…

Have you tried the GUI config? It’s totally different to editing the yaml, saving and then refreshing.

no. maybe that’s what I’m missing :wink:

I still really like the ability to split up the config to make it more easily digestible that yaml mode allows. especially if I’m making manual changes anyway.

How do you synchronize the two configs? I assume if you change something thru the GUI that change will no longer be reflected in the yaml file. Wouldn’t you need to copy the entire lovelace raw file (that sounds like the GUI has inconveniently reformatted for you) to an external editor then make your changes then copy it back into the raw editor? then save and refresh?

Not trying to be difficult. Just trying to understand the benefit of one method over another. I may be doing it wrong and need to switch! :slightly_smiling_face:

I usually only make a minor change… like change the css or something like that and then when it’s convenient I’ll manually make the same change in the YAML file. I do like the instant feedback in the GUI and in the GUI, you don’t get the whole lovelace file - just the specific card/stack you are editing… so not quite like using excludes but easy enough. (You only get the whole file in raw editor)

I never said it’s ideal but it works for me and gives me flexibility.

1 Like

Good enough!

Thanks for the info.

It sounds kind of complicated so I’ll probably stick with yaml mode for now. :grin:

1 Like

Sure. Choice is a great thing… you could try the GUI mode and editor and see first hand if you like it…

How hard is it to switch back and forth? And more importantly, what hidden .storage files is it going to create/edit for me that I’ll have to struggle with to remove if I don’t like it? You know what happens when you give “Big Brother” a little bit of control. You’re life will never be completely your own again.:cold_sweat:

It’s not that hard… just delete the yaml mode line in config yaml… it will then create te storage file. To switch back add the yaml mode again and restart…

Thanks again.

maybe if I find the time I’ll give it a go.

I hear a BINGO in the crowd. :slight_smile:

Sorry, I’m old school… from back in the day when we were called programmers rather than coders. We also used the discipline of self documented code (anyone using the variable name x was mocked)… and I am really annoyed that my self documented code (those lines that start with a # ) are discarded.

Yeah, I probably won’t really end up trying it… :wink: The key phrase there that gives it away is “if I find the time”. Fat chance of that ever happening. I can’t find the time to keep up with the stuff I need to get done let alone mucking around with things that already work well.

Still good info tho.