From ea6504dfa2bf798a6e5d25518ce197002dc8b589 Mon Sep 17 00:00:00 2001 From: ollo69 <60491700+ollo69@users.noreply.github.com> Date: Thu, 4 Nov 2021 14:26:17 +0100 Subject: [PATCH] Fix Nut resources option migration (#59020) Co-authored-by: Martin Hjelmare --- homeassistant/components/nut/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/nut/__init__.py b/homeassistant/components/nut/__init__.py index 81dd5f91f5..f0f2777373 100644 --- a/homeassistant/components/nut/__init__.py +++ b/homeassistant/components/nut/__init__.py @@ -39,8 +39,11 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: # strip out the stale options CONF_RESOURCES if CONF_RESOURCES in entry.options: + new_data = {**entry.data, CONF_RESOURCES: entry.options[CONF_RESOURCES]} new_options = {k: v for k, v in entry.options.items() if k != CONF_RESOURCES} - hass.config_entries.async_update_entry(entry, options=new_options) + hass.config_entries.async_update_entry( + entry, data=new_data, options=new_options + ) config = entry.data host = config[CONF_HOST]