Use dataclass properties in lookin discovery (#60585)

Co-authored-by: epenet <epenet@users.noreply.github.com>
pull/60610/head
epenet 2021-11-30 10:16:06 +01:00 committed by GitHub
parent 2f79760fb4
commit 071296865b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -31,8 +31,8 @@ class LookinFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
self, discovery_info: zeroconf.ZeroconfServiceInfo self, discovery_info: zeroconf.ZeroconfServiceInfo
) -> FlowResult: ) -> FlowResult:
"""Start a discovery flow from zeroconf.""" """Start a discovery flow from zeroconf."""
uid: str = discovery_info[zeroconf.ATTR_HOSTNAME][: -len(".local.")] uid: str = discovery_info.hostname[: -len(".local.")]
host: str = discovery_info[zeroconf.ATTR_HOST] host: str = discovery_info.host
await self.async_set_unique_id(uid.upper()) await self.async_set_unique_id(uid.upper())
self._abort_if_unique_id_configured(updates={CONF_HOST: host}) self._abort_if_unique_id_configured(updates={CONF_HOST: host})