Deprecate YAML configuration for ISY994 (#85797)

This commit is contained in:
shbatm 2023-01-13 12:48:44 -06:00 committed by GitHub
parent 8dadbe45fa
commit d35c4f8d82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 45 additions and 23 deletions

View File

@ -24,6 +24,7 @@ from homeassistant.helpers import aiohttp_client, config_validation as cv
import homeassistant.helpers.device_registry as dr import homeassistant.helpers.device_registry as dr
from homeassistant.helpers.device_registry import DeviceEntryType from homeassistant.helpers.device_registry import DeviceEntryType
from homeassistant.helpers.entity import DeviceInfo from homeassistant.helpers.entity import DeviceInfo
from homeassistant.helpers.issue_registry import IssueSeverity, async_create_issue
from homeassistant.helpers.typing import ConfigType from homeassistant.helpers.typing import ConfigType
from .const import ( from .const import (
@ -54,28 +55,31 @@ from .services import async_setup_services, async_unload_services
from .util import _async_cleanup_registry_entries from .util import _async_cleanup_registry_entries
CONFIG_SCHEMA = vol.Schema( CONFIG_SCHEMA = vol.Schema(
{ vol.All(
DOMAIN: vol.Schema( cv.deprecated(DOMAIN),
{ {
vol.Required(CONF_HOST): cv.url, DOMAIN: vol.Schema(
vol.Required(CONF_USERNAME): cv.string, {
vol.Required(CONF_PASSWORD): cv.string, vol.Required(CONF_HOST): cv.url,
vol.Optional(CONF_TLS_VER): vol.Coerce(float), vol.Required(CONF_USERNAME): cv.string,
vol.Optional( vol.Required(CONF_PASSWORD): cv.string,
CONF_IGNORE_STRING, default=DEFAULT_IGNORE_STRING vol.Optional(CONF_TLS_VER): vol.Coerce(float),
): cv.string, vol.Optional(
vol.Optional( CONF_IGNORE_STRING, default=DEFAULT_IGNORE_STRING
CONF_SENSOR_STRING, default=DEFAULT_SENSOR_STRING ): cv.string,
): cv.string, vol.Optional(
vol.Optional( CONF_SENSOR_STRING, default=DEFAULT_SENSOR_STRING
CONF_VAR_SENSOR_STRING, default=DEFAULT_VAR_SENSOR_STRING ): cv.string,
): cv.string, vol.Optional(
vol.Required( CONF_VAR_SENSOR_STRING, default=DEFAULT_VAR_SENSOR_STRING
CONF_RESTORE_LIGHT_STATE, default=DEFAULT_RESTORE_LIGHT_STATE ): cv.string,
): bool, vol.Required(
} CONF_RESTORE_LIGHT_STATE, default=DEFAULT_RESTORE_LIGHT_STATE
) ): bool,
}, },
)
},
),
extra=vol.ALLOW_EXTRA, extra=vol.ALLOW_EXTRA,
) )
@ -88,6 +92,16 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
if not isy_config: if not isy_config:
return True 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. # Only import if we haven't before.
config_entry = _async_find_matching_config_entry(hass) config_entry = _async_find_matching_config_entry(hass)
if not config_entry: if not config_entry:

View File

@ -62,6 +62,10 @@
"confirm": { "confirm": {
"title": "The {deprecated_service} service will be removed", "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}`." "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."
} }
} }
} }

View File

@ -43,6 +43,10 @@
} }
}, },
"title": "The {deprecated_service} service will be removed" "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": { "options": {
@ -67,4 +71,4 @@
"websocket_status": "Event Socket Status" "websocket_status": "Event Socket Status"
} }
} }
} }