@@ -178,6 +178,11 @@ async def validate_input(hass: core.HomeAssistant, data):
|
|||||||
if interface:
|
if interface:
|
||||||
interface.close()
|
interface.close()
|
||||||
|
|
||||||
|
# Indicate an error if no datapoints found as the rest of the flow
|
||||||
|
# won't work in this case
|
||||||
|
if not detected_dps:
|
||||||
|
raise EmptyDpsList
|
||||||
|
|
||||||
return dps_string_list(detected_dps)
|
return dps_string_list(detected_dps)
|
||||||
|
|
||||||
|
|
||||||
@@ -252,6 +257,8 @@ class LocaltuyaConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
errors["base"] = "cannot_connect"
|
errors["base"] = "cannot_connect"
|
||||||
except InvalidAuth:
|
except InvalidAuth:
|
||||||
errors["base"] = "invalid_auth"
|
errors["base"] = "invalid_auth"
|
||||||
|
except EmptyDpsList:
|
||||||
|
errors["base"] = "empty_dps"
|
||||||
except Exception: # pylint: disable=broad-except
|
except Exception: # pylint: disable=broad-except
|
||||||
_LOGGER.exception("Unexpected exception")
|
_LOGGER.exception("Unexpected exception")
|
||||||
errors["base"] = "unknown"
|
errors["base"] = "unknown"
|
||||||
@@ -408,3 +415,7 @@ class CannotConnect(exceptions.HomeAssistantError):
|
|||||||
|
|
||||||
class InvalidAuth(exceptions.HomeAssistantError):
|
class InvalidAuth(exceptions.HomeAssistantError):
|
||||||
"""Error to indicate there is invalid auth."""
|
"""Error to indicate there is invalid auth."""
|
||||||
|
|
||||||
|
|
||||||
|
class EmptyDpsList(exceptions.HomeAssistantError):
|
||||||
|
"""Error to indicate no datapoints found."""
|
||||||
|
@@ -9,7 +9,8 @@
|
|||||||
"unknown": "An unknown error occurred. See log for details.",
|
"unknown": "An unknown error occurred. See log for details.",
|
||||||
"entity_already_configured": "Entity with this ID has already been configured.",
|
"entity_already_configured": "Entity with this ID has already been configured.",
|
||||||
"address_in_use": "Address used for discovery is already in use. Make sure no other application is using it (TCP port 6668).",
|
"address_in_use": "Address used for discovery is already in use. Make sure no other application is using it (TCP port 6668).",
|
||||||
"discovery_failed": "Something failed when discovering devices. See log for details."
|
"discovery_failed": "Something failed when discovering devices. See log for details.",
|
||||||
|
"empty_dps": "Connection to device succeeded but no datapoints found, please try again. Create a new issue and include debug logs if problem persists."
|
||||||
},
|
},
|
||||||
"step": {
|
"step": {
|
||||||
"user": {
|
"user": {
|
||||||
|
Reference in New Issue
Block a user