Use dataclass properties in brother discovery (#60601)

Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
epenet 2021-11-30 10:07:58 +01:00 committed by GitHub
parent b996f624db
commit 0bb44c042c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -84,13 +84,13 @@ class BrotherConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
) -> FlowResult: ) -> FlowResult:
"""Handle zeroconf discovery.""" """Handle zeroconf discovery."""
# Hostname is format: brother.local. # Hostname is format: brother.local.
self.host = discovery_info[zeroconf.ATTR_HOSTNAME].rstrip(".") self.host = discovery_info.hostname.rstrip(".")
# Do not probe the device if the host is already configured # Do not probe the device if the host is already configured
self._async_abort_entries_match({CONF_HOST: self.host}) self._async_abort_entries_match({CONF_HOST: self.host})
snmp_engine = get_snmp_engine(self.hass) snmp_engine = get_snmp_engine(self.hass)
model = discovery_info[zeroconf.ATTR_PROPERTIES].get("product") model = discovery_info.properties.get("product")
try: try:
self.brother = Brother(self.host, snmp_engine=snmp_engine, model=model) self.brother = Brother(self.host, snmp_engine=snmp_engine, model=model)