Use dataclass properties in screenlogic discovery (#60735)

Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
epenet 2021-12-01 15:52:08 +01:00 committed by GitHub
parent ecf1bc1b22
commit 00f71e5dfc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -79,13 +79,13 @@ class ScreenlogicConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
async def async_step_dhcp(self, discovery_info: dhcp.DhcpServiceInfo) -> FlowResult: async def async_step_dhcp(self, discovery_info: dhcp.DhcpServiceInfo) -> FlowResult:
"""Handle dhcp discovery.""" """Handle dhcp discovery."""
mac = _extract_mac_from_name(discovery_info[dhcp.HOSTNAME]) mac = _extract_mac_from_name(discovery_info.hostname)
await self.async_set_unique_id(mac) await self.async_set_unique_id(mac)
self._abort_if_unique_id_configured( self._abort_if_unique_id_configured(
updates={CONF_IP_ADDRESS: discovery_info[dhcp.IP_ADDRESS]} updates={CONF_IP_ADDRESS: discovery_info.ip}
) )
self.discovered_ip = discovery_info[dhcp.IP_ADDRESS] self.discovered_ip = discovery_info.ip
self.context["title_placeholders"] = {"name": discovery_info[dhcp.HOSTNAME]} self.context["title_placeholders"] = {"name": discovery_info.hostname}
return await self.async_step_gateway_entry() return await self.async_step_gateway_entry()
async def async_step_gateway_select(self, user_input=None): async def async_step_gateway_select(self, user_input=None):