diff --git a/homeassistant/components/volumio/config_flow.py b/homeassistant/components/volumio/config_flow.py index 4c7a48f36c7b2..7cc58556f3e73 100644 --- a/homeassistant/components/volumio/config_flow.py +++ b/homeassistant/components/volumio/config_flow.py @@ -11,7 +11,7 @@ from homeassistant.components import zeroconf from homeassistant.config_entries import ConfigFlow, ConfigFlowResult from homeassistant.const import CONF_HOST, CONF_ID, CONF_NAME, CONF_PORT -from homeassistant.core import callback +from homeassistant.core import HomeAssistant, callback from homeassistant.exceptions import HomeAssistantError from homeassistant.helpers.aiohttp_client import async_get_clientsession @@ -25,7 +25,7 @@ ) -async def validate_input(hass, host, port): +async def validate_input(hass: HomeAssistant, host: str, port: int) -> dict[str, Any]: """Validate the user input allows us to connect.""" volumio = Volumio(host, port, async_get_clientsession(hass)) @@ -40,15 +40,13 @@ class VolumioConfigFlow(ConfigFlow, domain=DOMAIN): VERSION = 1 - def __init__(self) -> None: - """Initialize flow.""" - self._host: str | None = None - self._port: int | None = None - self._name: str | None = None - self._uuid: str | None = None + _host: str + _port: int + _name: str + _uuid: str | None @callback - def _async_get_entry(self): + def _async_get_entry(self) -> ConfigFlowResult: return self.async_create_entry( title=self._name, data={ @@ -103,7 +101,7 @@ async def async_step_zeroconf( ) -> ConfigFlowResult: """Handle zeroconf discovery.""" self._host = discovery_info.host - self._port = discovery_info.port + self._port = discovery_info.port or 3000 self._name = discovery_info.properties["volumioName"] self._uuid = discovery_info.properties["UUID"] @@ -111,7 +109,9 @@ async def async_step_zeroconf( return await self.async_step_discovery_confirm() - async def async_step_discovery_confirm(self, user_input=None): + async def async_step_discovery_confirm( + self, user_input: dict[str, Any] | None = None + ) -> ConfigFlowResult: """Handle user-confirmation of discovered node.""" if user_input is not None: try: