Where to find the Lovelace UI Yaml file?

I want to edit and copy my Lovelace UI yaml file

I know that in the GUI you can switch to yaml mode but the editor is very basic and I would prefer to use an editor like Visual Studio. I would also like to be able to backup my UI before proceeding to deep changes.

I have search all over the place to find where the lovelace yaml is saved in HA system file but I could not find it (at least not it the directories available through Samba).
Does someone knows where to find it, how to edit it from outside the gui, and how to save it before major changes?

It’s stored in a different format in a file which should not be edited manually while Home Assistant is running and will cause it to fail to start in case of any tiny mistake.

It is really not recommended to edit it in any other way than what is provided.
It is included in the system backup, so I recommend you use that if needed.

For editing; either copy the yaml from the raw editor to your editor of choice, or switch to a full yaml configuration: https://www.home-assistant.io/dashboards/dashboards/#using-yaml-for-the-default-dashboard

2 Likes

Thanks for the explanation.
The current UI mechanism is nice because you can do most of the things graphically but as I mentioned, it would be nice to be able to save and restore the UI.

Yesterday I was trying to update my UI on the small screen of my phone and I have ended up with my main view tab deleted (I do not remember exactly what I have done precisely)! Unfortunately, there is no easy way to recover the missing view. From a backup there is no specific switch to restore ONLY the UI. You have to restore everything in HA to get the UI back and this means you lose all the recorded long-term statistics between the time of the backup and the time of the restore.

To get around this problem I had to restore my backup on a dummy system copy the full yaml content of the dashboard and paste it on my main system. By doing that I have been able to restore the UI without losing the long-term stat but it is not easy to do.

It would be nice when you are in the “edit configuration” (with yaml file) to be able to save and restore the content from a file. This would allow to backup/restore a known working configuration file. From now on I will backup “manually” (cut and paste in VS) the content of my current UI on a regular basis.