mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 21:57:51 +00:00
Prevent adding plugwise products used as secondary controllers (#68098)
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
This commit is contained in:
parent
7615f138d9
commit
66f506557f
@ -3,7 +3,11 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from plugwise.exceptions import InvalidAuthentication, PlugwiseException
|
from plugwise.exceptions import (
|
||||||
|
InvalidAuthentication,
|
||||||
|
InvalidSetupError,
|
||||||
|
PlugwiseException,
|
||||||
|
)
|
||||||
from plugwise.smile import Smile
|
from plugwise.smile import Smile
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
@ -124,6 +128,8 @@ class PlugwiseConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
api = await validate_gw_input(self.hass, user_input)
|
api = await validate_gw_input(self.hass, user_input)
|
||||||
|
except InvalidSetupError:
|
||||||
|
errors[CONF_BASE] = "invalid_setup"
|
||||||
except InvalidAuthentication:
|
except InvalidAuthentication:
|
||||||
errors[CONF_BASE] = "invalid_auth"
|
errors[CONF_BASE] = "invalid_auth"
|
||||||
except PlugwiseException:
|
except PlugwiseException:
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
"error": {
|
"error": {
|
||||||
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",
|
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",
|
||||||
"invalid_auth": "[%key:common::config_flow::error::invalid_auth%]",
|
"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%]"
|
"unknown": "[%key:common::config_flow::error::unknown%]"
|
||||||
},
|
},
|
||||||
"abort": {
|
"abort": {
|
||||||
|
@ -4,6 +4,7 @@ from unittest.mock import AsyncMock, MagicMock, patch
|
|||||||
from plugwise.exceptions import (
|
from plugwise.exceptions import (
|
||||||
ConnectionFailedError,
|
ConnectionFailedError,
|
||||||
InvalidAuthentication,
|
InvalidAuthentication,
|
||||||
|
InvalidSetupError,
|
||||||
PlugwiseException,
|
PlugwiseException,
|
||||||
)
|
)
|
||||||
import pytest
|
import pytest
|
||||||
@ -223,6 +224,7 @@ async def test_zercoconf_discovery_update_configuration(hass: HomeAssistant) ->
|
|||||||
"side_effect,reason",
|
"side_effect,reason",
|
||||||
[
|
[
|
||||||
(InvalidAuthentication, "invalid_auth"),
|
(InvalidAuthentication, "invalid_auth"),
|
||||||
|
(InvalidSetupError, "invalid_setup"),
|
||||||
(ConnectionFailedError, "cannot_connect"),
|
(ConnectionFailedError, "cannot_connect"),
|
||||||
(PlugwiseException, "cannot_connect"),
|
(PlugwiseException, "cannot_connect"),
|
||||||
(RuntimeError, "unknown"),
|
(RuntimeError, "unknown"),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user