diff --git a/homeassistant/components/plugwise/config_flow.py b/homeassistant/components/plugwise/config_flow.py index e69d92e3cd0..5b5c79ba2b8 100644 --- a/homeassistant/components/plugwise/config_flow.py +++ b/homeassistant/components/plugwise/config_flow.py @@ -3,7 +3,11 @@ from __future__ import annotations from typing import Any -from plugwise.exceptions import InvalidAuthentication, PlugwiseException +from plugwise.exceptions import ( + InvalidAuthentication, + InvalidSetupError, + PlugwiseException, +) from plugwise.smile import Smile import voluptuous as vol @@ -124,6 +128,8 @@ class PlugwiseConfigFlow(ConfigFlow, domain=DOMAIN): try: api = await validate_gw_input(self.hass, user_input) + except InvalidSetupError: + errors[CONF_BASE] = "invalid_setup" except InvalidAuthentication: errors[CONF_BASE] = "invalid_auth" except PlugwiseException: diff --git a/homeassistant/components/plugwise/strings.json b/homeassistant/components/plugwise/strings.json index e5a7ab5a6a9..dfa0ac920c7 100644 --- a/homeassistant/components/plugwise/strings.json +++ b/homeassistant/components/plugwise/strings.json @@ -32,6 +32,7 @@ "error": { "cannot_connect": "[%key:common::config_flow::error::cannot_connect%]", "invalid_auth": "[%key:common::config_flow::error::invalid_auth%]", + "invalid_setup": "Add your Adam instead of your Anna, see the Home Assistant Plugwise integration documentation for more information", "unknown": "[%key:common::config_flow::error::unknown%]" }, "abort": { diff --git a/tests/components/plugwise/test_config_flow.py b/tests/components/plugwise/test_config_flow.py index 9fdd0323518..7668d492e75 100644 --- a/tests/components/plugwise/test_config_flow.py +++ b/tests/components/plugwise/test_config_flow.py @@ -4,6 +4,7 @@ from unittest.mock import AsyncMock, MagicMock, patch from plugwise.exceptions import ( ConnectionFailedError, InvalidAuthentication, + InvalidSetupError, PlugwiseException, ) import pytest @@ -223,6 +224,7 @@ async def test_zercoconf_discovery_update_configuration(hass: HomeAssistant) -> "side_effect,reason", [ (InvalidAuthentication, "invalid_auth"), + (InvalidSetupError, "invalid_setup"), (ConnectionFailedError, "cannot_connect"), (PlugwiseException, "cannot_connect"), (RuntimeError, "unknown"),