From ead4f745e3d4d0f3664d3e05c53bc0b8eaaaa6da Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Wed, 1 Dec 2021 18:33:22 +0100 Subject: [PATCH] Use dataclass properties in somfy_mylink discovery (#60736) Co-authored-by: epenet --- homeassistant/components/somfy_mylink/config_flow.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/homeassistant/components/somfy_mylink/config_flow.py b/homeassistant/components/somfy_mylink/config_flow.py index 6f695d06cbe..768d12da45b 100644 --- a/homeassistant/components/somfy_mylink/config_flow.py +++ b/homeassistant/components/somfy_mylink/config_flow.py @@ -61,16 +61,14 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): async def async_step_dhcp(self, discovery_info: dhcp.DhcpServiceInfo) -> FlowResult: """Handle dhcp discovery.""" - self._async_abort_entries_match({CONF_HOST: discovery_info[dhcp.IP_ADDRESS]}) + self._async_abort_entries_match({CONF_HOST: discovery_info.ip}) - formatted_mac = format_mac(discovery_info[dhcp.MAC_ADDRESS]) + formatted_mac = format_mac(discovery_info.macaddress) await self.async_set_unique_id(format_mac(formatted_mac)) - self._abort_if_unique_id_configured( - updates={CONF_HOST: discovery_info[dhcp.IP_ADDRESS]} - ) - self.host = discovery_info[dhcp.HOSTNAME] + self._abort_if_unique_id_configured(updates={CONF_HOST: discovery_info.ip}) + self.host = discovery_info.hostname self.mac = formatted_mac - self.ip_address = discovery_info[dhcp.IP_ADDRESS] + self.ip_address = discovery_info.ip self.context["title_placeholders"] = {"ip": self.ip_address, "mac": self.mac} return await self.async_step_user()