Handle more Life360 errors in config flow & bump package to 4.1.1 (#25930)
parent
002f74c76b
commit
bd8461b899
|
@ -10,7 +10,8 @@
|
||||||
"error": {
|
"error": {
|
||||||
"invalid_credentials": "Invalid credentials",
|
"invalid_credentials": "Invalid credentials",
|
||||||
"invalid_username": "Invalid username",
|
"invalid_username": "Invalid username",
|
||||||
"user_already_configured": "Account has already been configured"
|
"user_already_configured": "Account has already been configured",
|
||||||
|
"unexpected": "Unexpected error communicating with Life360 server"
|
||||||
},
|
},
|
||||||
"step": {
|
"step": {
|
||||||
"user": {
|
"user": {
|
||||||
|
@ -24,4 +25,4 @@
|
||||||
},
|
},
|
||||||
"title": "Life360"
|
"title": "Life360"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from life360 import LoginError
|
from life360 import Life360Error, LoginError
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant import config_entries
|
from homeassistant import config_entries
|
||||||
|
@ -54,6 +54,11 @@ class Life360ConfigFlow(config_entries.ConfigFlow):
|
||||||
errors[CONF_USERNAME] = "invalid_username"
|
errors[CONF_USERNAME] = "invalid_username"
|
||||||
except LoginError:
|
except LoginError:
|
||||||
errors["base"] = "invalid_credentials"
|
errors["base"] = "invalid_credentials"
|
||||||
|
except Life360Error as error:
|
||||||
|
_LOGGER.error(
|
||||||
|
"Unexpected error communicating with Life360 server: %s", error
|
||||||
|
)
|
||||||
|
errors["base"] = "unexpected"
|
||||||
else:
|
else:
|
||||||
if self._username in self.configured_usernames:
|
if self._username in self.configured_usernames:
|
||||||
errors["base"] = "user_already_configured"
|
errors["base"] = "user_already_configured"
|
||||||
|
@ -88,6 +93,11 @@ class Life360ConfigFlow(config_entries.ConfigFlow):
|
||||||
except LoginError:
|
except LoginError:
|
||||||
_LOGGER.error("Invalid credentials for %s", username)
|
_LOGGER.error("Invalid credentials for %s", username)
|
||||||
return self.async_abort(reason="invalid_credentials")
|
return self.async_abort(reason="invalid_credentials")
|
||||||
|
except Life360Error as error:
|
||||||
|
_LOGGER.error(
|
||||||
|
"Unexpected error communicating with Life360 server: %s", error
|
||||||
|
)
|
||||||
|
return self.async_abort(reason="unexpected")
|
||||||
return self.async_create_entry(
|
return self.async_create_entry(
|
||||||
title="{} (from configuration)".format(username),
|
title="{} (from configuration)".format(username),
|
||||||
data={
|
data={
|
||||||
|
|
|
@ -8,6 +8,6 @@
|
||||||
"@pnbruckner"
|
"@pnbruckner"
|
||||||
],
|
],
|
||||||
"requirements": [
|
"requirements": [
|
||||||
"life360==4.0.1"
|
"life360==4.1.1"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,8 @@
|
||||||
"error": {
|
"error": {
|
||||||
"invalid_username": "Invalid username",
|
"invalid_username": "Invalid username",
|
||||||
"invalid_credentials": "Invalid credentials",
|
"invalid_credentials": "Invalid credentials",
|
||||||
"user_already_configured": "Account has already been configured"
|
"user_already_configured": "Account has already been configured",
|
||||||
|
"unexpected": "Unexpected error communicating with Life360 server"
|
||||||
},
|
},
|
||||||
"create_entry": {
|
"create_entry": {
|
||||||
"default": "To set advanced options, see [Life360 documentation]({docs_url})."
|
"default": "To set advanced options, see [Life360 documentation]({docs_url})."
|
||||||
|
|
|
@ -723,7 +723,7 @@ librouteros==2.3.0
|
||||||
libsoundtouch==0.7.2
|
libsoundtouch==0.7.2
|
||||||
|
|
||||||
# homeassistant.components.life360
|
# homeassistant.components.life360
|
||||||
life360==4.0.1
|
life360==4.1.1
|
||||||
|
|
||||||
# homeassistant.components.lifx_legacy
|
# homeassistant.components.lifx_legacy
|
||||||
liffylights==0.9.4
|
liffylights==0.9.4
|
||||||
|
|
Loading…
Reference in New Issue