Entities Card - modifications by an external script?

Is it possible to modify (add/remove enities) on Lovelace Entities Card by HA automation or external script ?

Whether the configuration for the lovelace card can be read from a dedicated yaml file ?