Use dataclass properties in xiaomi_aqara discovery (#60636)

Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
epenet 2021-11-30 16:28:49 +01:00 committed by GitHub
parent 30bb2c82c6
commit 601ad8f71a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -150,9 +150,9 @@ class XiaomiAqaraFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
self, discovery_info: zeroconf.ZeroconfServiceInfo self, discovery_info: zeroconf.ZeroconfServiceInfo
) -> FlowResult: ) -> FlowResult:
"""Handle zeroconf discovery.""" """Handle zeroconf discovery."""
name = discovery_info[zeroconf.ATTR_NAME] name = discovery_info.name
self.host = discovery_info[zeroconf.ATTR_HOST] self.host = discovery_info.host
mac_address = discovery_info[zeroconf.ATTR_PROPERTIES].get("mac") mac_address = discovery_info.properties.get("mac")
if not name or not self.host or not mac_address: if not name or not self.host or not mac_address:
return self.async_abort(reason="not_xiaomi_aqara") return self.async_abort(reason="not_xiaomi_aqara")