Fix Nut resources option migration (#59020)

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
pull/59078/head
ollo69 2021-11-04 14:26:17 +01:00 committed by GitHub
parent f578eee81d
commit ea6504dfa2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -39,8 +39,11 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
# strip out the stale options CONF_RESOURCES # strip out the stale options CONF_RESOURCES
if CONF_RESOURCES in entry.options: 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} 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 config = entry.data
host = config[CONF_HOST] host = config[CONF_HOST]