diff --git a/homeassistant/components/zwave_js/config_flow.py b/homeassistant/components/zwave_js/config_flow.py index 733dad50c52..37e6b7c9320 100644 --- a/homeassistant/components/zwave_js/config_flow.py +++ b/homeassistant/components/zwave_js/config_flow.py @@ -321,8 +321,10 @@ class ConfigFlow(BaseZwaveJSFlow, config_entries.ConfigFlow, domain=DOMAIN): This step will be used when importing data during Z-Wave to Z-Wave JS migration. """ - self.network_key = data.get(CONF_NETWORK_KEY) - self.usb_path = data.get(CONF_USB_PATH) + # Note that the data comes from the zwave integration. + # So we don't use our constants here. + self.s0_legacy_key = data.get("network_key") + self.usb_path = data.get("usb_path") return await self.async_step_user() async def async_step_user( diff --git a/tests/components/zwave_js/test_config_flow.py b/tests/components/zwave_js/test_config_flow.py index 4916b4fee7e..5dcbee4c5ee 100644 --- a/tests/components/zwave_js/test_config_flow.py +++ b/tests/components/zwave_js/test_config_flow.py @@ -2422,6 +2422,14 @@ async def test_import_addon_installed( # the default input should be the imported data default_input = result["data_schema"]({}) + assert default_input == { + "usb_path": "/test/imported", + "s0_legacy_key": "imported123", + "s2_access_control_key": "", + "s2_authenticated_key": "", + "s2_unauthenticated_key": "", + } + result = await hass.config_entries.flow.async_configure( result["flow_id"], default_input ) @@ -2429,7 +2437,15 @@ async def test_import_addon_installed( assert set_addon_options.call_args == call( hass, "core_zwave_js", - {"options": {"device": "/test/imported", "network_key": "imported123"}}, + { + "options": { + "device": "/test/imported", + "s0_legacy_key": "imported123", + "s2_access_control_key": "", + "s2_authenticated_key": "", + "s2_unauthenticated_key": "", + } + }, ) assert result["type"] == "progress" @@ -2452,7 +2468,10 @@ async def test_import_addon_installed( assert result["data"] == { "url": "ws://host1:3001", "usb_path": "/test/imported", - "network_key": "imported123", + "s0_legacy_key": "imported123", + "s2_access_control_key": "", + "s2_authenticated_key": "", + "s2_unauthenticated_key": "", "use_addon": True, "integration_created_addon": False, }