Lovelace fix: badges are removed from view after update (#18983)
* badges are removed from view after update * Only add badges and cards when not provided in new config
This commit is contained in:
parent
d8a7e9ded8
commit
75b855ef93
1 changed files with 4 additions and 1 deletions
|
@ -380,7 +380,10 @@ def update_view(fname: str, view_id: str, view_config, data_format:
|
|||
"View with ID: {} was not found in {}.".format(view_id, fname))
|
||||
if data_format == FORMAT_YAML:
|
||||
view_config = yaml.yaml_to_object(view_config)
|
||||
view_config['cards'] = found.get('cards', [])
|
||||
if not view_config.get('cards') and found.get('cards'):
|
||||
view_config['cards'] = found.get('cards', [])
|
||||
if not view_config.get('badges') and found.get('badges'):
|
||||
view_config['badges'] = found.get('badges', [])
|
||||
found.clear()
|
||||
found.update(view_config)
|
||||
yaml.save_yaml(fname, config)
|
||||
|
|
Loading…
Add table
Reference in a new issue