Use common strings for velbus config flow (#40660)
This commit is contained in:
parent
27350f41c9
commit
30effb5c8a
3 changed files with 12 additions and 10 deletions
|
@ -37,7 +37,7 @@ class VelbusConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
try:
|
||||
controller = velbus.Controller(prt)
|
||||
except Exception: # pylint: disable=broad-except
|
||||
self._errors[CONF_PORT] = "connection_failed"
|
||||
self._errors[CONF_PORT] = "cannot_connect"
|
||||
return False
|
||||
controller.stop()
|
||||
return True
|
||||
|
@ -58,7 +58,7 @@ class VelbusConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
if self._test_connection(prt):
|
||||
return self._create_device(name, prt)
|
||||
else:
|
||||
self._errors[CONF_PORT] = "port_exists"
|
||||
self._errors[CONF_PORT] = "already_configured"
|
||||
else:
|
||||
user_input = {}
|
||||
user_input[CONF_NAME] = ""
|
||||
|
@ -82,5 +82,5 @@ class VelbusConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
if self._prt_in_configuration_exists(prt):
|
||||
# if the velbus import is already in the config
|
||||
# we should not proceed the import
|
||||
return self.async_abort(reason="port_exists")
|
||||
return self.async_abort(reason="already_configured")
|
||||
return await self.async_step_user(user_input)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue