Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions homeassistant/components/config/scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,11 @@ def _write_value(self, hass, data, config_key, new_value):
# 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
10 changes: 9 additions & 1 deletion homeassistant/components/config/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ async def hook(action, config_key):
await hass.services.async_call(DOMAIN, SERVICE_RELOAD)

hass.http.register_view(
EditKeyBasedConfigView(
EditScriptConfigView(
DOMAIN,
"config",
SCRIPT_CONFIG_PATH,
Expand All @@ -27,3 +27,11 @@ async def hook(action, config_key):
)
)
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