Is it possible to remotely edit a lovelace card via the configuration YAML?

I would like to dynamically update the contents of a lovelace card.

Is there a way to remotely (programatically, ideally via the API but I did not find anything relevant) edit the YAML file to add/remove some entries?

EDIT: I found that .storage/lovelace actually holds the configuration of the frontend. Can I directly edit this file?

EDIT 2: a direct edition of the file does not propagate to the fronted (even after reloading the page). HA probably needs to be told to take the change into consideration (?)

EDIT 3: The closest I got to editing the file is to switch to YAML mode for lovelace ( and edit the YAML file. Not the best solution but if there is nothing ready for remote interaction (via the API) it will do.

What specifically are you trying to accomplish? You might be able to do it with an existing or custom card.

I have an entity-filter card with 80 entities which are dynamically created in Home Assistant by an external script (via the API).

I would like this script to also update the card (in addition to creating the entity and setting its state) instead of having to manually update it myself.

Ah gotcha. I’m not sure how to help with that, sorry. Someone else might have some advice.

You are not supposed to edit this file while the system is running.

I found a way to edit the YAML by switching to YAML mode for lovelace:

This is not perfect as it will require some acrobatics when editing it via a program (ideally that could have been been an API functionality) but that’s the closest I can get, probably.

Visual Studio Code or Atom/Sublime/Notepad++/etc all work very well.

@flamingm0e Sorry, by “program” I mean code (Python, node, …) which will access the file remotely (via ssh, then parse it, then push back to HA) like I mentioned in my question.