mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 00:37:13 +00:00
Remove config flow option to set mydevolo URL (#132821)
This commit is contained in:
parent
13a37da917
commit
ea12a7c9a7
@ -18,7 +18,7 @@ from homeassistant.core import Event, HomeAssistant
|
||||
from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady
|
||||
from homeassistant.helpers.device_registry import DeviceEntry
|
||||
|
||||
from .const import CONF_MYDEVOLO, DEFAULT_MYDEVOLO, GATEWAY_SERIAL_PATTERN, PLATFORMS
|
||||
from .const import GATEWAY_SERIAL_PATTERN, PLATFORMS
|
||||
|
||||
type DevoloHomeControlConfigEntry = ConfigEntry[list[HomeControl]]
|
||||
|
||||
@ -102,5 +102,4 @@ def configure_mydevolo(conf: dict[str, Any] | MappingProxyType[str, Any]) -> Myd
|
||||
mydevolo = Mydevolo()
|
||||
mydevolo.user = conf[CONF_USERNAME]
|
||||
mydevolo.password = conf[CONF_PASSWORD]
|
||||
mydevolo.url = conf.get(CONF_MYDEVOLO, DEFAULT_MYDEVOLO)
|
||||
return mydevolo
|
||||
|
@ -18,7 +18,7 @@ from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
|
||||
from homeassistant.core import callback
|
||||
|
||||
from . import configure_mydevolo
|
||||
from .const import CONF_MYDEVOLO, DEFAULT_MYDEVOLO, DOMAIN, SUPPORTED_MODEL_TYPES
|
||||
from .const import DOMAIN, SUPPORTED_MODEL_TYPES
|
||||
from .exceptions import CredentialsInvalid, UuidChanged
|
||||
|
||||
|
||||
@ -35,14 +35,11 @@ class DevoloHomeControlFlowHandler(ConfigFlow, domain=DOMAIN):
|
||||
vol.Required(CONF_USERNAME): str,
|
||||
vol.Required(CONF_PASSWORD): str,
|
||||
}
|
||||
self._url = DEFAULT_MYDEVOLO
|
||||
|
||||
async def async_step_user(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> ConfigFlowResult:
|
||||
"""Handle a flow initiated by the user."""
|
||||
if self.show_advanced_options:
|
||||
self.data_schema[vol.Required(CONF_MYDEVOLO, default=self._url)] = str
|
||||
if user_input is None:
|
||||
return self._show_form(step_id="user")
|
||||
try:
|
||||
@ -78,7 +75,6 @@ class DevoloHomeControlFlowHandler(ConfigFlow, domain=DOMAIN):
|
||||
) -> ConfigFlowResult:
|
||||
"""Handle reauthentication."""
|
||||
self._reauth_entry = self._get_reauth_entry()
|
||||
self._url = entry_data[CONF_MYDEVOLO]
|
||||
self.data_schema = {
|
||||
vol.Required(CONF_USERNAME, default=entry_data[CONF_USERNAME]): str,
|
||||
vol.Required(CONF_PASSWORD): str,
|
||||
@ -104,7 +100,6 @@ class DevoloHomeControlFlowHandler(ConfigFlow, domain=DOMAIN):
|
||||
|
||||
async def _connect_mydevolo(self, user_input: dict[str, Any]) -> ConfigFlowResult:
|
||||
"""Connect to mydevolo."""
|
||||
user_input[CONF_MYDEVOLO] = user_input.get(CONF_MYDEVOLO, self._url)
|
||||
mydevolo = configure_mydevolo(conf=user_input)
|
||||
credentials_valid = await self.hass.async_add_executor_job(
|
||||
mydevolo.credentials_valid
|
||||
@ -121,7 +116,6 @@ class DevoloHomeControlFlowHandler(ConfigFlow, domain=DOMAIN):
|
||||
data={
|
||||
CONF_PASSWORD: mydevolo.password,
|
||||
CONF_USERNAME: mydevolo.user,
|
||||
CONF_MYDEVOLO: mydevolo.url,
|
||||
},
|
||||
)
|
||||
|
||||
|
@ -5,7 +5,6 @@ import re
|
||||
from homeassistant.const import Platform
|
||||
|
||||
DOMAIN = "devolo_home_control"
|
||||
DEFAULT_MYDEVOLO = "https://www.mydevolo.com"
|
||||
PLATFORMS = [
|
||||
Platform.BINARY_SENSOR,
|
||||
Platform.CLIMATE,
|
||||
@ -15,6 +14,5 @@ PLATFORMS = [
|
||||
Platform.SIREN,
|
||||
Platform.SWITCH,
|
||||
]
|
||||
CONF_MYDEVOLO = "mydevolo_url"
|
||||
GATEWAY_SERIAL_PATTERN = re.compile(r"\d{16}")
|
||||
SUPPORTED_MODEL_TYPES = ["2600", "2601"]
|
||||
|
@ -11,7 +11,6 @@ def configure_integration(hass: HomeAssistant) -> MockConfigEntry:
|
||||
config = {
|
||||
"username": "test-username",
|
||||
"password": "test-password",
|
||||
"mydevolo_url": "https://test_mydevolo_url.test",
|
||||
}
|
||||
entry = MockConfigEntry(
|
||||
domain=DOMAIN, data=config, entry_id="123456", unique_id="123456"
|
||||
|
@ -33,7 +33,6 @@
|
||||
]),
|
||||
'entry': dict({
|
||||
'data': dict({
|
||||
'mydevolo_url': 'https://test_mydevolo_url.test',
|
||||
'password': '**REDACTED**',
|
||||
'username': '**REDACTED**',
|
||||
}),
|
||||
|
@ -5,7 +5,7 @@ from unittest.mock import patch
|
||||
import pytest
|
||||
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.components.devolo_home_control.const import DEFAULT_MYDEVOLO, DOMAIN
|
||||
from homeassistant.components.devolo_home_control.const import DOMAIN
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import FlowResult, FlowResultType
|
||||
|
||||
@ -90,7 +90,6 @@ async def test_form_advanced_options(hass: HomeAssistant) -> None:
|
||||
{
|
||||
"username": "test-username",
|
||||
"password": "test-password",
|
||||
"mydevolo_url": "https://test_mydevolo_url.test",
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
@ -100,7 +99,6 @@ async def test_form_advanced_options(hass: HomeAssistant) -> None:
|
||||
assert result2["data"] == {
|
||||
"username": "test-username",
|
||||
"password": "test-password",
|
||||
"mydevolo_url": "https://test_mydevolo_url.test",
|
||||
}
|
||||
|
||||
assert len(mock_setup_entry.mock_calls) == 1
|
||||
@ -170,7 +168,6 @@ async def test_form_reauth(hass: HomeAssistant) -> None:
|
||||
data={
|
||||
"username": "test-username",
|
||||
"password": "test-password",
|
||||
"mydevolo_url": "https://test_mydevolo_url.test",
|
||||
},
|
||||
)
|
||||
mock_config.add_to_hass(hass)
|
||||
@ -207,7 +204,6 @@ async def test_form_invalid_credentials_reauth(hass: HomeAssistant) -> None:
|
||||
data={
|
||||
"username": "test-username",
|
||||
"password": "test-password",
|
||||
"mydevolo_url": "https://test_mydevolo_url.test",
|
||||
},
|
||||
)
|
||||
mock_config.add_to_hass(hass)
|
||||
@ -229,7 +225,6 @@ async def test_form_uuid_change_reauth(hass: HomeAssistant) -> None:
|
||||
data={
|
||||
"username": "test-username",
|
||||
"password": "test-password",
|
||||
"mydevolo_url": "https://test_mydevolo_url.test",
|
||||
},
|
||||
)
|
||||
mock_config.add_to_hass(hass)
|
||||
@ -281,7 +276,6 @@ async def _setup(hass: HomeAssistant, result: FlowResult) -> None:
|
||||
assert result2["data"] == {
|
||||
"username": "test-username",
|
||||
"password": "test-password",
|
||||
"mydevolo_url": DEFAULT_MYDEVOLO,
|
||||
}
|
||||
|
||||
assert len(mock_setup_entry.mock_calls) == 1
|
||||
|
Loading…
x
Reference in New Issue
Block a user