Adjust async_step_zeroconf signature for strict typing (#59503)

Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
epenet 2021-11-15 18:05:45 +01:00 committed by GitHub
parent 5cc594682f
commit b3ffc1e183
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 85 additions and 66 deletions

View file

@ -1,12 +1,14 @@
"""Config flow for SONOS."""
from typing import cast
import soco
from homeassistant import config_entries
from homeassistant.components import zeroconf
from homeassistant.const import CONF_HOST, CONF_NAME
from homeassistant.core import HomeAssistant
from homeassistant.data_entry_flow import FlowResult
from homeassistant.helpers.config_entry_flow import DiscoveryFlowHandler
from homeassistant.helpers.typing import DiscoveryInfoType
from .const import DATA_SONOS_DISCOVERY_MANAGER, DOMAIN
from .helpers import hostname_to_uid
@ -26,7 +28,7 @@ class SonosDiscoveryFlowHandler(DiscoveryFlowHandler):
super().__init__(DOMAIN, "Sonos", _async_has_devices)
async def async_step_zeroconf(
self, discovery_info: DiscoveryInfoType
self, discovery_info: zeroconf.ZeroconfServiceInfo
) -> FlowResult:
"""Handle a flow initialized by zeroconf."""
hostname = discovery_info["hostname"]
@ -43,7 +45,7 @@ class SonosDiscoveryFlowHandler(DiscoveryFlowHandler):
discovery_manager.async_discovered_player(
"Zeroconf", properties, host, uid, boot_seqnum, model, mdns_name
)
return await self.async_step_discovery(discovery_info)
return await self.async_step_discovery(cast(dict, discovery_info))
config_entries.HANDLERS.register(DOMAIN)(SonosDiscoveryFlowHandler)