diff --git a/homeassistant/components/overkiz/config_flow.py b/homeassistant/components/overkiz/config_flow.py index 520a61f27fd..599d112528a 100644 --- a/homeassistant/components/overkiz/config_flow.py +++ b/homeassistant/components/overkiz/config_flow.py @@ -9,6 +9,7 @@ from pyoverkiz.const import SUPPORTED_SERVERS from pyoverkiz.exceptions import ( BadCredentialsException, MaintenanceException, + TooManyAttemptsBannedException, TooManyRequestsException, ) from pyoverkiz.models import obfuscate_id @@ -51,7 +52,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): async with OverkizClient( username=username, password=password, server=server, session=session ) as client: - await client.login() + await client.login(register_event_listener=False) # Set first gateway id as unique id if gateways := await client.get_gateways(): @@ -78,6 +79,8 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except MaintenanceException: errors["base"] = "server_in_maintenance" + except TooManyAttemptsBannedException: + errors["base"] = "too_many_attempts" except Exception as exception: # pylint: disable=broad-except errors["base"] = "unknown" LOGGER.exception(exception) diff --git a/homeassistant/components/overkiz/manifest.json b/homeassistant/components/overkiz/manifest.json index 9ee52a113c7..bcb973e272e 100644 --- a/homeassistant/components/overkiz/manifest.json +++ b/homeassistant/components/overkiz/manifest.json @@ -4,7 +4,7 @@ "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/overkiz", "requirements": [ - "pyoverkiz==1.3.12" + "pyoverkiz==1.3.13" ], "zeroconf": [ { diff --git a/homeassistant/components/overkiz/strings.json b/homeassistant/components/overkiz/strings.json index 87487d53c66..4887a0d0f75 100644 --- a/homeassistant/components/overkiz/strings.json +++ b/homeassistant/components/overkiz/strings.json @@ -16,6 +16,7 @@ "cannot_connect": "[%key:common::config_flow::error::cannot_connect%]", "invalid_auth": "[%key:common::config_flow::error::invalid_auth%]", "server_in_maintenance": "Server is down for maintenance", + "too_many_attempts": "Too many attempts with an invalid token, temporarily banned", "too_many_requests": "Too many requests, try again later", "unknown": "[%key:common::config_flow::error::unknown%]" }, diff --git a/homeassistant/components/overkiz/translations/en.json b/homeassistant/components/overkiz/translations/en.json index c9551aa555c..9e24a9d3cb3 100644 --- a/homeassistant/components/overkiz/translations/en.json +++ b/homeassistant/components/overkiz/translations/en.json @@ -9,6 +9,7 @@ "cannot_connect": "Failed to connect", "invalid_auth": "Invalid authentication", "server_in_maintenance": "Server is down for maintenance", + "too_many_attempts": "Too many attempts with an invalid token, temporarily banned", "too_many_requests": "Too many requests, try again later", "unknown": "Unexpected error" }, diff --git a/requirements_all.txt b/requirements_all.txt index d334ddb070f..2971d138df8 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1700,7 +1700,7 @@ pyotgw==1.1b1 pyotp==2.6.0 # homeassistant.components.overkiz -pyoverkiz==1.3.12 +pyoverkiz==1.3.13 # homeassistant.components.openweathermap pyowm==3.2.0 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index bc8d89d806a..16716ff1d4b 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -1135,7 +1135,7 @@ pyotgw==1.1b1 pyotp==2.6.0 # homeassistant.components.overkiz -pyoverkiz==1.3.12 +pyoverkiz==1.3.13 # homeassistant.components.openweathermap pyowm==3.2.0 diff --git a/tests/components/overkiz/test_config_flow.py b/tests/components/overkiz/test_config_flow.py index db86a4abc5c..967d6cbb8c8 100644 --- a/tests/components/overkiz/test_config_flow.py +++ b/tests/components/overkiz/test_config_flow.py @@ -7,6 +7,7 @@ from aiohttp import ClientError from pyoverkiz.exceptions import ( BadCredentialsException, MaintenanceException, + TooManyAttemptsBannedException, TooManyRequestsException, ) import pytest @@ -86,6 +87,7 @@ async def test_form(hass: HomeAssistant) -> None: (TimeoutError, "cannot_connect"), (ClientError, "cannot_connect"), (MaintenanceException, "server_in_maintenance"), + (TooManyAttemptsBannedException, "too_many_attempts"), (Exception, "unknown"), ], )