mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +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 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:
|
||||
|
@ -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": {
|
||||
|
@ -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"),
|
||||
|
Loading…
x
Reference in New Issue
Block a user