diff --git a/homeassistant/components/touchline/climate.py b/homeassistant/components/touchline/climate.py index 196f9c9b2ddc..a12b0a6d466c 100644 --- a/homeassistant/components/touchline/climate.py +++ b/homeassistant/components/touchline/climate.py @@ -2,11 +2,9 @@ from typing import Any, NamedTuple, override -import probatio from pytouchline_extended import PyTouchline from homeassistant.components.climate import ( - PLATFORM_SCHEMA as CLIMATE_PLATFORM_SCHEMA, PRESET_AWAY, PRESET_NONE, PRESET_SLEEP, @@ -14,18 +12,11 @@ from homeassistant.components.climate import ( ClimateEntityFeature, HVACMode, ) -from homeassistant.config_entries import SOURCE_IMPORT from homeassistant.const import ATTR_TEMPERATURE, CONF_HOST, UnitOfTemperature -from homeassistant.core import DOMAIN as HOMEASSISTANT_DOMAIN, HomeAssistant -from homeassistant.data_entry_flow import FlowResultType +from homeassistant.core import HomeAssistant from homeassistant.exceptions import ConfigEntryNotReady -from homeassistant.helpers import config_validation as cv, issue_registry as ir from homeassistant.helpers.device_registry import DeviceInfo -from homeassistant.helpers.entity_platform import ( - AddConfigEntryEntitiesCallback, - AddEntitiesCallback, -) -from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType +from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback from .const import DOMAIN from .data import TouchlineConfigEntry @@ -52,10 +43,6 @@ TOUCHLINE_HA_PRESETS = { for preset, settings in PRESET_MODES.items() } -PLATFORM_SCHEMA = CLIMATE_PLATFORM_SCHEMA.extend( - {probatio.Required(CONF_HOST): cv.string} -) - async def async_setup_entry( hass: HomeAssistant, @@ -79,60 +66,6 @@ async def async_setup_entry( async_add_entities(devices) -async def async_setup_platform( - hass: HomeAssistant, - config: ConfigType, - async_add_entities: AddEntitiesCallback, - discovery_info: DiscoveryInfoType | None = None, -) -> None: - """Set up the Touchline devices from YAML. - - Touchline now uses config entries. If an entry exists in configuration.yaml, - the import flow will attempt to import it and create a config entry. - """ - - result = await hass.config_entries.flow.async_init( - DOMAIN, - context={"source": SOURCE_IMPORT}, - data={CONF_HOST: config[CONF_HOST]}, - ) - if ( - result.get("type") is FlowResultType.ABORT - and result.get("reason") != "already_configured" - ): - ir.async_create_issue( - hass, - DOMAIN, - f"deprecated_yaml_import_issue_{result.get('reason')}", - breaks_in_ha_version="2026.10.0", - is_fixable=False, - is_persistent=False, - issue_domain=DOMAIN, - severity=ir.IssueSeverity.WARNING, - translation_key=f"deprecated_yaml_import_issue_{result.get('reason')}", - translation_placeholders={ - "domain": DOMAIN, - "integration_title": "Roth Touchline", - }, - ) - return - ir.async_create_issue( - hass, - HOMEASSISTANT_DOMAIN, - f"deprecated_yaml_{DOMAIN}", - breaks_in_ha_version="2026.10.0", - is_fixable=False, - is_persistent=False, - issue_domain=DOMAIN, - severity=ir.IssueSeverity.WARNING, - translation_key="deprecated_yaml", - translation_placeholders={ - "domain": DOMAIN, - "integration_title": "Roth Touchline", - }, - ) - - class Touchline(ClimateEntity): """Representation of a Touchline device.""" diff --git a/homeassistant/components/touchline/config_flow.py b/homeassistant/components/touchline/config_flow.py index 41dc88e5c138..a85a54f9b537 100644 --- a/homeassistant/components/touchline/config_flow.py +++ b/homeassistant/components/touchline/config_flow.py @@ -85,25 +85,3 @@ class TouchlineConfigFlow(ConfigFlow, domain=DOMAIN): data_schema=STEP_USER_DATA_SCHEMA, errors=errors, ) - - async def async_step_import(self, user_input: dict[str, Any]) -> ConfigFlowResult: - """Handle import from YAML.""" - - # Abort if an entry with the same host already exists, to avoid duplicates - self._async_abort_entries_match({CONF_HOST: user_input[CONF_HOST]}) - - # Validate the user input allows us to connect - try: - unique_id = await _async_validate_input(self.hass, user_input) - except CannotConnect: - return self.async_abort(reason="cannot_connect") - except Exception: # noqa: BLE001 - return self.async_abort(reason="unknown") - - await self.async_set_unique_id(unique_id) - self._abort_if_unique_id_configured() - - return self.async_create_entry( - title=user_input[CONF_HOST], - data=user_input, - ) diff --git a/homeassistant/components/touchline/strings.json b/homeassistant/components/touchline/strings.json index c6f0726fc5de..d5d5beaec0a9 100644 --- a/homeassistant/components/touchline/strings.json +++ b/homeassistant/components/touchline/strings.json @@ -32,15 +32,5 @@ } } } - }, - "issues": { - "deprecated_yaml_import_issue_cannot_connect": { - "description": "Home Assistant could not connect to the Roth Touchline controller while importing your YAML configuration. Remove the YAML configuration for Roth Touchline from configuration.yaml and set up the integration again from the Home Assistant UI.", - "title": "Roth Touchline YAML configuration import failed" - }, - "deprecated_yaml_import_issue_unknown": { - "description": "An unknown error occurred while importing your Roth Touchline YAML configuration. Remove the YAML configuration for Roth Touchline from configuration.yaml and set up the integration again from the Home Assistant UI.", - "title": "Roth Touchline YAML configuration import issue" - } } } diff --git a/tests/components/touchline/test_config_flow.py b/tests/components/touchline/test_config_flow.py index 4e9acf4cfde7..449e6914d696 100644 --- a/tests/components/touchline/test_config_flow.py +++ b/tests/components/touchline/test_config_flow.py @@ -114,56 +114,3 @@ async def test_already_configured_by_unique_id( assert result["type"] is FlowResultType.ABORT assert result["reason"] == "already_configured" - - -async def test_import_success( - hass: HomeAssistant, mock_pytouchline: MagicMock, mock_setup_entry: MagicMock -) -> None: - """Test YAML import creates an entry.""" - result = await hass.config_entries.flow.async_init( - DOMAIN, - context={"source": config_entries.SOURCE_IMPORT}, - data=TEST_DATA, - ) - - assert result["type"] is FlowResultType.CREATE_ENTRY - assert result["title"] == TEST_HOST - assert result["data"] == TEST_DATA - assert result["result"].unique_id == TEST_UNIQUE_ID - assert len(mock_setup_entry.mock_calls) == 1 - - -async def test_import_cannot_connect( - hass: HomeAssistant, mock_pytouchline: MagicMock -) -> None: - """Test YAML import aborts when it cannot connect.""" - mock_pytouchline.get_number_of_devices.side_effect = ConnectionError - - result = await hass.config_entries.flow.async_init( - DOMAIN, - context={"source": config_entries.SOURCE_IMPORT}, - data=TEST_DATA, - ) - - assert result["type"] is FlowResultType.ABORT - assert result["reason"] == "cannot_connect" - - -async def test_import_already_configured( - hass: HomeAssistant, mock_pytouchline: MagicMock -) -> None: - """Test YAML import aborts when already configured.""" - MockConfigEntry( - domain=DOMAIN, - data={CONF_HOST: "5.6.7.8"}, - unique_id=TEST_UNIQUE_ID, - ).add_to_hass(hass) - - result = await hass.config_entries.flow.async_init( - DOMAIN, - context={"source": config_entries.SOURCE_IMPORT}, - data=TEST_DATA, - ) - - assert result["type"] is FlowResultType.ABORT - assert result["reason"] == "already_configured"