mirror of
https://github.com/home-assistant/core.git
synced 2025-07-13 16:27:08 +00:00
Use dataclass properties in tradfri discovery (#60592)
Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
parent
58661fa636
commit
ae9320b616
@ -97,13 +97,11 @@ class FlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
) -> FlowResult:
|
) -> FlowResult:
|
||||||
"""Handle homekit discovery."""
|
"""Handle homekit discovery."""
|
||||||
await self.async_set_unique_id(
|
await self.async_set_unique_id(
|
||||||
discovery_info[zeroconf.ATTR_PROPERTIES][zeroconf.ATTR_PROPERTIES_ID]
|
discovery_info.properties[zeroconf.ATTR_PROPERTIES_ID]
|
||||||
)
|
|
||||||
self._abort_if_unique_id_configured(
|
|
||||||
{CONF_HOST: discovery_info[zeroconf.ATTR_HOST]}
|
|
||||||
)
|
)
|
||||||
|
self._abort_if_unique_id_configured({CONF_HOST: discovery_info.host})
|
||||||
|
|
||||||
host = discovery_info[zeroconf.ATTR_HOST]
|
host = discovery_info.host
|
||||||
|
|
||||||
for entry in self._async_current_entries():
|
for entry in self._async_current_entries():
|
||||||
if entry.data.get(CONF_HOST) != host:
|
if entry.data.get(CONF_HOST) != host:
|
||||||
@ -113,9 +111,7 @@ class FlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
if not entry.unique_id:
|
if not entry.unique_id:
|
||||||
self.hass.config_entries.async_update_entry(
|
self.hass.config_entries.async_update_entry(
|
||||||
entry,
|
entry,
|
||||||
unique_id=discovery_info[zeroconf.ATTR_PROPERTIES][
|
unique_id=discovery_info.properties[zeroconf.ATTR_PROPERTIES_ID],
|
||||||
zeroconf.ATTR_PROPERTIES_ID
|
|
||||||
],
|
|
||||||
)
|
)
|
||||||
|
|
||||||
return self.async_abort(reason="already_configured")
|
return self.async_abort(reason="already_configured")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user