Fix wrong error message on adding a new HomematicIP Cloud AP (#39599)
This commit is contained in:
parent
aecd74c6af
commit
f2f68859cc
5 changed files with 8 additions and 7 deletions
|
@ -47,6 +47,9 @@ class HomematicipCloudFlowHandler(config_entries.ConfigFlow):
|
||||||
_LOGGER.info("Connection to HomematicIP Cloud established")
|
_LOGGER.info("Connection to HomematicIP Cloud established")
|
||||||
return await self.async_step_link()
|
return await self.async_step_link()
|
||||||
|
|
||||||
|
_LOGGER.info("Connection to HomematicIP Cloud failed")
|
||||||
|
errors["base"] = "invalid_sgtin_or_pin"
|
||||||
|
|
||||||
return self.async_show_form(
|
return self.async_show_form(
|
||||||
step_id="init",
|
step_id="init",
|
||||||
data_schema=vol.Schema(
|
data_schema=vol.Schema(
|
||||||
|
|
|
@ -34,7 +34,7 @@ class HomematicipAuth:
|
||||||
self.auth = await self.get_auth(
|
self.auth = await self.get_auth(
|
||||||
self.hass, self.config.get(HMIPC_HAPID), self.config.get(HMIPC_PIN)
|
self.hass, self.config.get(HMIPC_HAPID), self.config.get(HMIPC_PIN)
|
||||||
)
|
)
|
||||||
return True
|
return self.auth is not None
|
||||||
except HmipcConnectionError:
|
except HmipcConnectionError:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ class HomematicipAuth:
|
||||||
auth.pin = pin
|
auth.pin = pin
|
||||||
await auth.connectionRequest("HomeAssistant")
|
await auth.connectionRequest("HomeAssistant")
|
||||||
except HmipConnectionError:
|
except HmipConnectionError:
|
||||||
return False
|
return None
|
||||||
return auth
|
return auth
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
},
|
},
|
||||||
"error": {
|
"error": {
|
||||||
"register_failed": "Failed to register, please try again.",
|
"register_failed": "Failed to register, please try again.",
|
||||||
"invalid_pin": "Invalid PIN, please try again.",
|
"invalid_sgtin_or_pin": "Invalid SGTIN or PIN, please try again.",
|
||||||
"press_the_button": "Please press the blue button.",
|
"press_the_button": "Please press the blue button.",
|
||||||
"timeout_button": "Blue button press timeout, please try again."
|
"timeout_button": "Blue button press timeout, please try again."
|
||||||
},
|
},
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
"unknown": "Unknown error occurred."
|
"unknown": "Unknown error occurred."
|
||||||
},
|
},
|
||||||
"error": {
|
"error": {
|
||||||
"invalid_pin": "Invalid PIN, please try again.",
|
"invalid_sgtin_or_pin": "Invalid SGTIN or PIN, please try again.",
|
||||||
"press_the_button": "Please press the blue button.",
|
"press_the_button": "Please press the blue button.",
|
||||||
"register_failed": "Failed to register, please try again.",
|
"register_failed": "Failed to register, please try again.",
|
||||||
"timeout_button": "Blue button press timeout, please try again."
|
"timeout_button": "Blue button press timeout, please try again."
|
||||||
|
|
|
@ -175,9 +175,7 @@ async def test_auth_create_exception(hass, simple_mock_auth):
|
||||||
"homeassistant.components.homematicip_cloud.hap.AsyncAuth",
|
"homeassistant.components.homematicip_cloud.hap.AsyncAuth",
|
||||||
return_value=simple_mock_auth,
|
return_value=simple_mock_auth,
|
||||||
):
|
):
|
||||||
assert await hmip_auth.async_setup()
|
assert not await hmip_auth.async_setup()
|
||||||
await hass.async_block_till_done()
|
|
||||||
assert not hmip_auth.auth
|
|
||||||
|
|
||||||
with patch(
|
with patch(
|
||||||
"homeassistant.components.homematicip_cloud.hap.AsyncAuth",
|
"homeassistant.components.homematicip_cloud.hap.AsyncAuth",
|
||||||
|
|
Loading…
Add table
Reference in a new issue