From d35c4f8d823869812dabb00529efbe59bbd3248d Mon Sep 17 00:00:00 2001 From: shbatm Date: Fri, 13 Jan 2023 12:48:44 -0600 Subject: [PATCH] Deprecate YAML configuration for ISY994 (#85797) --- homeassistant/components/isy994/__init__.py | 58 ++++++++++++------- homeassistant/components/isy994/strings.json | 4 ++ .../components/isy994/translations/en.json | 6 +- 3 files changed, 45 insertions(+), 23 deletions(-) diff --git a/homeassistant/components/isy994/__init__.py b/homeassistant/components/isy994/__init__.py index 30aa5c90edd..c9e4f6ed16e 100644 --- a/homeassistant/components/isy994/__init__.py +++ b/homeassistant/components/isy994/__init__.py @@ -24,6 +24,7 @@ from homeassistant.helpers import aiohttp_client, config_validation as cv import homeassistant.helpers.device_registry as dr from homeassistant.helpers.device_registry import DeviceEntryType from homeassistant.helpers.entity import DeviceInfo +from homeassistant.helpers.issue_registry import IssueSeverity, async_create_issue from homeassistant.helpers.typing import ConfigType from .const import ( @@ -54,28 +55,31 @@ from .services import async_setup_services, async_unload_services from .util import _async_cleanup_registry_entries CONFIG_SCHEMA = vol.Schema( - { - DOMAIN: vol.Schema( - { - vol.Required(CONF_HOST): cv.url, - vol.Required(CONF_USERNAME): cv.string, - vol.Required(CONF_PASSWORD): cv.string, - vol.Optional(CONF_TLS_VER): vol.Coerce(float), - vol.Optional( - CONF_IGNORE_STRING, default=DEFAULT_IGNORE_STRING - ): cv.string, - vol.Optional( - CONF_SENSOR_STRING, default=DEFAULT_SENSOR_STRING - ): cv.string, - vol.Optional( - CONF_VAR_SENSOR_STRING, default=DEFAULT_VAR_SENSOR_STRING - ): cv.string, - vol.Required( - CONF_RESTORE_LIGHT_STATE, default=DEFAULT_RESTORE_LIGHT_STATE - ): bool, - } - ) - }, + vol.All( + cv.deprecated(DOMAIN), + { + DOMAIN: vol.Schema( + { + vol.Required(CONF_HOST): cv.url, + vol.Required(CONF_USERNAME): cv.string, + vol.Required(CONF_PASSWORD): cv.string, + vol.Optional(CONF_TLS_VER): vol.Coerce(float), + vol.Optional( + CONF_IGNORE_STRING, default=DEFAULT_IGNORE_STRING + ): cv.string, + vol.Optional( + CONF_SENSOR_STRING, default=DEFAULT_SENSOR_STRING + ): cv.string, + vol.Optional( + CONF_VAR_SENSOR_STRING, default=DEFAULT_VAR_SENSOR_STRING + ): cv.string, + vol.Required( + CONF_RESTORE_LIGHT_STATE, default=DEFAULT_RESTORE_LIGHT_STATE + ): bool, + }, + ) + }, + ), extra=vol.ALLOW_EXTRA, ) @@ -88,6 +92,16 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: if not isy_config: return True + async_create_issue( + hass, + DOMAIN, + "deprecated_yaml", + breaks_in_ha_version="2023.5.0", + is_fixable=False, + severity=IssueSeverity.WARNING, + translation_key="deprecated_yaml", + ) + # Only import if we haven't before. config_entry = _async_find_matching_config_entry(hass) if not config_entry: diff --git a/homeassistant/components/isy994/strings.json b/homeassistant/components/isy994/strings.json index 6382e20e2fb..69852394890 100644 --- a/homeassistant/components/isy994/strings.json +++ b/homeassistant/components/isy994/strings.json @@ -62,6 +62,10 @@ "confirm": { "title": "The {deprecated_service} service will be removed", "description": "Update any automations or scripts that use this service to instead use the `{alternate_service}` service with a target entity ID of `{alternate_target}`." + }, + "deprecated_yaml": { + "title": "The ISY/IoX YAML configuration is being removed", + "description": "Configuring Universal Devices ISY/IoX using YAML is being removed.\n\nYour existing YAML configuration has been imported into the UI automatically.\n\nRemove the `isy994` YAML configuration from your configuration.yaml file and restart Home Assistant to fix this issue." } } } diff --git a/homeassistant/components/isy994/translations/en.json b/homeassistant/components/isy994/translations/en.json index 5f4a78b3475..b607c6ad202 100644 --- a/homeassistant/components/isy994/translations/en.json +++ b/homeassistant/components/isy994/translations/en.json @@ -43,6 +43,10 @@ } }, "title": "The {deprecated_service} service will be removed" + }, + "deprecated_yaml": { + "title": "The ISY/IoX YAML configuration is being removed", + "description": "Configuring Universal Devices ISY/IoX using YAML is being removed.\n\nYour existing YAML configuration has been imported into the UI automatically.\n\nRemove the `isy994` YAML configuration from your configuration.yaml file and restart Home Assistant to fix this issue." } }, "options": { @@ -67,4 +71,4 @@ "websocket_status": "Event Socket Status" } } -} \ No newline at end of file +}