Explicitly define all methods in ConfigFlow (#49341)

This commit is contained in:
Ruslan Sayfutdinov 2021-04-17 11:42:31 +01:00 committed by GitHub
parent 189511724a
commit 7a9385d857
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 88 additions and 59 deletions

View file

@ -146,21 +146,21 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
step_id="credentials", data_schema=schema, errors=errors
)
async def async_step_zeroconf(self, zeroconf_info):
async def async_step_zeroconf(self, discovery_info):
"""Handle zeroconf discovery."""
try:
self.info = info = await self._async_get_info(zeroconf_info["host"])
self.info = info = await self._async_get_info(discovery_info["host"])
except HTTP_CONNECT_ERRORS:
return self.async_abort(reason="cannot_connect")
except aioshelly.FirmwareUnsupported:
return self.async_abort(reason="unsupported_firmware")
await self.async_set_unique_id(info["mac"])
self._abort_if_unique_id_configured({CONF_HOST: zeroconf_info["host"]})
self.host = zeroconf_info["host"]
self._abort_if_unique_id_configured({CONF_HOST: discovery_info["host"]})
self.host = discovery_info["host"]
self.context["title_placeholders"] = {
"name": zeroconf_info.get("name", "").split(".")[0]
"name": discovery_info.get("name", "").split(".")[0]
}
if info["auth"]: