mirror of https://github.com/home-assistant/core
Don't combine old and new value on scene update (#49248)
This commit is contained in:
parent
1527b9cad7
commit
9e7d83b2d5
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue