diff --git a/homeassistant/components/nut/config_flow.py b/homeassistant/components/nut/config_flow.py
index ae22526752d1630f3fb094278cdc09404a0e6fc0..9a8fc704886335da9588256d480477e2f4656f27 100644
--- a/homeassistant/components/nut/config_flow.py
+++ b/homeassistant/components/nut/config_flow.py
@@ -4,6 +4,7 @@ import logging
 import voluptuous as vol
 
 from homeassistant import config_entries, core, exceptions
+from homeassistant.components import zeroconf
 from homeassistant.const import (
     CONF_ALIAS,
     CONF_BASE,
@@ -14,6 +15,7 @@ from homeassistant.const import (
     CONF_USERNAME,
 )
 from homeassistant.core import callback
+from homeassistant.data_entry_flow import FlowResult
 
 from . import PyNUTData
 from .const import DEFAULT_HOST, DEFAULT_PORT, DEFAULT_SCAN_INTERVAL, DOMAIN
@@ -85,13 +87,15 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
         self.ups_list = None
         self.title = None
 
-    async def async_step_zeroconf(self, discovery_info):
+    async def async_step_zeroconf(
+        self, discovery_info: zeroconf.ZeroconfServiceInfo
+    ) -> FlowResult:
         """Prepare configuration for a discovered nut device."""
         self.discovery_info = discovery_info
         await self._async_handle_discovery_without_unique_id()
         self.context["title_placeholders"] = {
-            CONF_PORT: discovery_info.get(CONF_PORT, DEFAULT_PORT),
-            CONF_HOST: discovery_info[CONF_HOST],
+            CONF_PORT: discovery_info[zeroconf.ATTR_PORT] or DEFAULT_PORT,
+            CONF_HOST: discovery_info[zeroconf.ATTR_HOST],
         }
         return await self.async_step_user()
 
diff --git a/tests/components/nut/test_config_flow.py b/tests/components/nut/test_config_flow.py
index 8559ab50f986b5b5eb266dbf731dfd75184393b9..892d74b47136c785ce1fc53758e2e412aa94ed5a 100644
--- a/tests/components/nut/test_config_flow.py
+++ b/tests/components/nut/test_config_flow.py
@@ -5,6 +5,7 @@ from unittest.mock import patch
 from pynut2.nut2 import PyNUTError
 
 from homeassistant import config_entries, data_entry_flow, setup
+from homeassistant.components import zeroconf
 from homeassistant.components.nut.const import DOMAIN
 from homeassistant.const import (
     CONF_ALIAS,
@@ -34,7 +35,7 @@ async def test_form_zeroconf(hass):
     result = await hass.config_entries.flow.async_init(
         DOMAIN,
         context={"source": config_entries.SOURCE_ZEROCONF},
-        data={CONF_HOST: "192.168.1.5", CONF_PORT: 1234},
+        data=zeroconf.ZeroconfServiceInfo(host="192.168.1.5", port=1234),
     )
     assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
     assert result["step_id"] == "user"