From 9e7d83b2d52feacde1d7b05d141ba375513a20de Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Mon, 26 Apr 2021 23:38:30 +0200 Subject: [PATCH] Don't combine old and new value on scene update (#49248) --- homeassistant/components/config/scene.py | 4 +--- homeassistant/components/config/script.py | 10 +++++++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/config/scene.py b/homeassistant/components/config/scene.py index 19cfb7cd31a2..8507fbbe47d4 100644 --- a/homeassistant/components/config/scene.py +++ b/homeassistant/components/config/scene.py @@ -66,13 +66,11 @@ class EditSceneConfigView(EditIdBasedConfigView): # Iterate through some keys that we want to have ordered in the output updated_value = OrderedDict() for key in ("id", "name", "entities"): - if key in cur_value: - updated_value[key] = cur_value[key] if key in new_value: updated_value[key] = new_value[key] # We cover all current fields above, but just in case we start # supporting more fields in the future. - updated_value.update(cur_value) updated_value.update(new_value) + data[index] = updated_value diff --git a/homeassistant/components/config/script.py b/homeassistant/components/config/script.py index a5d1bb2037b1..73b1ee0be5c9 100644 --- a/homeassistant/components/config/script.py +++ b/homeassistant/components/config/script.py @@ -16,7 +16,7 @@ async def async_setup(hass): await hass.services.async_call(DOMAIN, SERVICE_RELOAD) hass.http.register_view( - EditKeyBasedConfigView( + EditScriptConfigView( DOMAIN, "config", SCRIPT_CONFIG_PATH, @@ -27,3 +27,11 @@ async def async_setup(hass): ) ) return True + + +class EditScriptConfigView(EditKeyBasedConfigView): + """Edit script config.""" + + def _write_value(self, hass, data, config_key, new_value): + """Set value.""" + data[config_key] = new_value