Skip to content

Commit

Permalink
Use common strings in life360 config flow (home-assistant#42375)
Browse files Browse the repository at this point in the history
* Use common strings for life360 config flow

* Address feedback comments

* Keep two space indentation

* Fix indentation hopefully
  • Loading branch information
springstan authored Oct 28, 2020
1 parent 989ab50 commit 4e28ae8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions homeassistant/components/life360/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ async def async_step_user(self, user_input=None):
_LOGGER.error(
"Unexpected error communicating with Life360 server: %s", error
)
errors["base"] = "unexpected"
errors["base"] = "unknown"
else:
if self._username in self.configured_usernames:
errors["base"] = "user_already_configured"
errors["base"] = "already_configured"
else:
return self.async_create_entry(
title=self._username,
Expand Down Expand Up @@ -99,7 +99,7 @@ async def async_step_import(self, user_input):
_LOGGER.error(
"Unexpected error communicating with Life360 server: %s", error
)
return self.async_abort(reason="unexpected")
return self.async_abort(reason="unknown")
return self.async_create_entry(
title=f"{username} (from configuration)",
data={
Expand Down
6 changes: 3 additions & 3 deletions homeassistant/components/life360/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
"error": {
"invalid_username": "Invalid username",
"invalid_auth": "[%key:common::config_flow::error::invalid_auth%]",
"user_already_configured": "[%key:common::config_flow::abort::already_configured_account%]",
"unexpected": "Unexpected error communicating with Life360 server"
"already_configured": "[%key:common::config_flow::abort::already_configured_account%]",
"unknown": "[%key:common::config_flow::error::unknown%]"
},
"create_entry": {
"default": "To set advanced options, see [Life360 documentation]({docs_url})."
},
"abort": {
"invalid_auth": "[%key:common::config_flow::error::invalid_auth%]",
"user_already_configured": "[%key:common::config_flow::abort::already_configured_account%]"
"unknown": "[%key:common::config_flow::error::unknown%]"
}
}
}

0 comments on commit 4e28ae8

Please sign in to comment.