Use common strings in Nest config flow (#41597)

This commit is contained in:
Christian Bilevits 2020-10-11 14:47:30 +02:00 committed by GitHub
parent ef448f1549
commit 1c4512bc40
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 15 deletions

View file

@ -66,10 +66,10 @@ class NestFlowHandler(config_entries.ConfigFlow):
flows = self.hass.data.get(DATA_FLOW_IMPL, {})
if self.hass.config_entries.async_entries(DOMAIN):
return self.async_abort(reason="already_setup")
return self.async_abort(reason="single_instance_allowed")
if not flows:
return self.async_abort(reason="no_flows")
return self.async_abort(reason="missing_configuration")
if len(flows) == 1:
self.flow_impl = list(flows)[0]
@ -106,7 +106,7 @@ class NestFlowHandler(config_entries.ConfigFlow):
except asyncio.TimeoutError:
errors["code"] = "timeout"
except CodeInvalid:
errors["code"] = "invalid_code"
errors["code"] = "invalid_pin"
except NestAuthError:
errors["code"] = "unknown"
except Exception: # pylint: disable=broad-except
@ -132,7 +132,7 @@ class NestFlowHandler(config_entries.ConfigFlow):
async def async_step_import(self, info):
"""Import existing auth from Nest."""
if self.hass.config_entries.async_entries(DOMAIN):
return self.async_abort(reason="already_setup")
return self.async_abort(reason="single_instance_allowed")
config_path = info["nest_conf_path"]