Use dataclass properties in gogogate2 discovery (#60607)

Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
epenet 2021-11-30 17:15:23 +01:00 committed by GitHub
parent f444dd6d86
commit 97c04d2e67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -40,16 +40,16 @@ class Gogogate2FlowHandler(ConfigFlow, domain=DOMAIN):
) -> data_entry_flow.FlowResult: ) -> data_entry_flow.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]
) )
return await self._async_discovery_handler(discovery_info[zeroconf.ATTR_HOST]) return await self._async_discovery_handler(discovery_info.host)
async def async_step_dhcp( async def async_step_dhcp(
self, discovery_info: dhcp.DhcpServiceInfo self, discovery_info: dhcp.DhcpServiceInfo
) -> data_entry_flow.FlowResult: ) -> data_entry_flow.FlowResult:
"""Handle dhcp discovery.""" """Handle dhcp discovery."""
await self.async_set_unique_id(discovery_info[dhcp.MAC_ADDRESS]) await self.async_set_unique_id(discovery_info.macaddress)
return await self._async_discovery_handler(discovery_info[dhcp.IP_ADDRESS]) return await self._async_discovery_handler(discovery_info.ip)
async def _async_discovery_handler(self, ip_address): async def _async_discovery_handler(self, ip_address):
"""Start the user flow from any discovery.""" """Start the user flow from any discovery."""