diff --git a/homeassistant/components/dsmr_reader/config_flow.py b/homeassistant/components/dsmr_reader/config_flow.py index 2f08894d125..44ff6663654 100644 --- a/homeassistant/components/dsmr_reader/config_flow.py +++ b/homeassistant/components/dsmr_reader/config_flow.py @@ -2,7 +2,6 @@ from __future__ import annotations from collections.abc import Awaitable -import logging from typing import Any from homeassistant.core import HomeAssistant @@ -11,8 +10,6 @@ from homeassistant.helpers.config_entry_flow import DiscoveryFlowHandler from .const import DOMAIN -_LOGGER = logging.getLogger(__name__) - async def _async_has_devices(_: HomeAssistant) -> bool: """MQTT is set as dependency, so that should be sufficient.""" diff --git a/homeassistant/components/dsmr_reader/sensor.py b/homeassistant/components/dsmr_reader/sensor.py index 72e24c52724..28dc0abb2df 100644 --- a/homeassistant/components/dsmr_reader/sensor.py +++ b/homeassistant/components/dsmr_reader/sensor.py @@ -3,42 +3,14 @@ from __future__ import annotations from homeassistant.components import mqtt from homeassistant.components.sensor import SensorEntity -from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry +from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.entity_platform import AddEntitiesCallback -from homeassistant.helpers.issue_registry import IssueSeverity, async_create_issue -from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType from homeassistant.util import slugify -from .const import DOMAIN from .definitions import SENSORS, DSMRReaderSensorEntityDescription -async def async_setup_platform( - hass: HomeAssistant, - config: ConfigType, - async_add_entities: AddEntitiesCallback, - discovery_info: DiscoveryInfoType | None = None, -) -> None: - """Set up DSMR Reader sensors via configuration.yaml and show deprecation warning.""" - async_create_issue( - hass, - DOMAIN, - "deprecated_yaml", - breaks_in_ha_version="2022.12.0", - is_fixable=False, - severity=IssueSeverity.WARNING, - translation_key="deprecated_yaml", - ) - hass.async_create_task( - hass.config_entries.flow.async_init( - DOMAIN, - context={"source": SOURCE_IMPORT}, - data=config, - ) - ) - - async def async_setup_entry( _: HomeAssistant, config_entry: ConfigEntry, diff --git a/homeassistant/components/dsmr_reader/strings.json b/homeassistant/components/dsmr_reader/strings.json index 17e28cca884..73c4ac04402 100644 --- a/homeassistant/components/dsmr_reader/strings.json +++ b/homeassistant/components/dsmr_reader/strings.json @@ -8,11 +8,5 @@ "description": "Make sure to configure the 'split topic' data sources in DSMR Reader." } } - }, - "issues": { - "deprecated_yaml": { - "title": "The DSMR Reader configuration is being removed", - "description": "Configuring DSMR Reader using YAML is being removed.\n\nYour existing YAML configuration has been imported into the UI automatically.\n\nRemove the DSMR Reader YAML configuration from your configuration.yaml file and restart Home Assistant to fix this issue." - } } } diff --git a/tests/components/dsmr_reader/test_config_flow.py b/tests/components/dsmr_reader/test_config_flow.py index edf5518e07b..42d18d866a9 100644 --- a/tests/components/dsmr_reader/test_config_flow.py +++ b/tests/components/dsmr_reader/test_config_flow.py @@ -1,27 +1,10 @@ """Tests for the config flow.""" from homeassistant.components.dsmr_reader.const import DOMAIN -from homeassistant.config_entries import SOURCE_IMPORT, SOURCE_USER +from homeassistant.config_entries import SOURCE_USER from homeassistant.core import HomeAssistant from homeassistant.data_entry_flow import FlowResultType -async def test_import_step(hass: HomeAssistant) -> None: - """Test the import step.""" - result = await hass.config_entries.flow.async_init( - DOMAIN, - context={"source": SOURCE_IMPORT}, - ) - assert result["type"] == FlowResultType.CREATE_ENTRY - assert result["title"] == "DSMR Reader" - - second_result = await hass.config_entries.flow.async_init( - DOMAIN, - context={"source": SOURCE_IMPORT}, - ) - assert second_result["type"] == FlowResultType.ABORT - assert second_result["reason"] == "single_instance_allowed" - - async def test_user_step(hass: HomeAssistant) -> None: """Test the user step call.""" result = await hass.config_entries.flow.async_init(