Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions homeassistant/components/vesync/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ async def async_step_import(self, import_config):
async def async_step_user(self, user_input=None):
"""Handle a flow start."""
if configured_instances(self.hass):
return self.async_abort(reason="already_setup")
return self.async_abort(reason="single_instance_allowed")

if not user_input:
return self._show_form()
Expand All @@ -62,7 +62,7 @@ async def async_step_user(self, user_input=None):
manager = VeSync(self._username, self._password)
login = await self.hass.async_add_executor_job(manager.login)
if not login:
return self._show_form(errors={"base": "invalid_login"})
return self._show_form(errors={"base": "invalid_auth"})

return self.async_create_entry(
title=self._username,
Expand Down
6 changes: 3 additions & 3 deletions homeassistant/components/vesync/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
}
},
"error": {
"invalid_login": "Invalid username or password"
"invalid_auth": "[%key:common::config_flow::error::invalid_auth%]"
},
"abort": {
"already_setup": "Only one Vesync instance is allowed"
"single_instance_allowed": "[%key:common::config_flow::abort::single_instance_allowed%]"
}
}
}
}
4 changes: 2 additions & 2 deletions tests/components/vesync/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ async def test_abort_already_setup(hass):
result = await flow.async_step_user()

assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
assert result["reason"] == "already_setup"
assert result["reason"] == "single_instance_allowed"


async def test_invalid_login_error(hass):
Expand All @@ -29,7 +29,7 @@ async def test_invalid_login_error(hass):
result = await flow.async_step_user(user_input=test_dict)

assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result["errors"] == {"base": "invalid_login"}
assert result["errors"] == {"base": "invalid_auth"}


async def test_config_flow_configuration_yaml(hass):
Expand Down