diff --git a/homeassistant/components/cast/config_flow.py b/homeassistant/components/cast/config_flow.py index 464283e07f3..86d85588967 100644 --- a/homeassistant/components/cast/config_flow.py +++ b/homeassistant/components/cast/config_flow.py @@ -133,7 +133,7 @@ class CastOptionsFlowHandler(config_entries.OptionsFlow): ) if not bad_cec and not bad_hosts and not bad_uuid: - updated_config = {} + updated_config = dict(current_config) updated_config[CONF_IGNORE_CEC] = ignore_cec updated_config[CONF_KNOWN_HOSTS] = known_hosts updated_config[CONF_UUID] = wanted_uuid diff --git a/tests/components/cast/test_config_flow.py b/tests/components/cast/test_config_flow.py index 064406df717..1febd9d8803 100644 --- a/tests/components/cast/test_config_flow.py +++ b/tests/components/cast/test_config_flow.py @@ -166,6 +166,7 @@ async def test_option_flow(hass, parameter_data): assert result["step_id"] == "options" data_schema = result["data_schema"].schema assert set(data_schema) == {"known_hosts"} + orig_data = dict(config_entry.data) # Reconfigure ignore_cec, known_hosts, uuid context = {"source": "user", "show_advanced_options": True} @@ -201,7 +202,12 @@ async def test_option_flow(hass, parameter_data): ) assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY assert result["data"] is None - assert config_entry.data == {"ignore_cec": [], "known_hosts": [], "uuid": []} + assert config_entry.data == { + **orig_data, + "ignore_cec": [], + "known_hosts": [], + "uuid": [], + } async def test_known_hosts(hass, castbrowser_mock, castbrowser_constructor_mock):