Loosen discovery config validation to avoid breaking changes (#23625)
* Allow optional service handlers to be promoted to config flow without a breaking change * Updated wording * Remove periodpull/23670/head
parent
04b680d9d0
commit
1e6babe796
|
@ -105,16 +105,19 @@ OPTIONAL_SERVICE_HANDLERS = {
|
|||
SERVICE_DLNA_DMR: ('media_player', 'dlna_dmr'),
|
||||
}
|
||||
|
||||
DEFAULT_ENABLED = list(CONFIG_ENTRY_HANDLERS) + list(SERVICE_HANDLERS)
|
||||
DEFAULT_DISABLED = list(OPTIONAL_SERVICE_HANDLERS)
|
||||
|
||||
CONF_IGNORE = 'ignore'
|
||||
CONF_ENABLE = 'enable'
|
||||
|
||||
CONFIG_SCHEMA = vol.Schema({
|
||||
vol.Optional(DOMAIN): vol.Schema({
|
||||
vol.Optional(CONF_IGNORE, default=[]):
|
||||
vol.All(cv.ensure_list, [
|
||||
vol.In(list(CONFIG_ENTRY_HANDLERS) + list(SERVICE_HANDLERS))]),
|
||||
vol.All(cv.ensure_list, [vol.In(DEFAULT_ENABLED)]),
|
||||
vol.Optional(CONF_ENABLE, default=[]):
|
||||
vol.All(cv.ensure_list, [vol.In(OPTIONAL_SERVICE_HANDLERS)])
|
||||
vol.All(cv.ensure_list, [
|
||||
vol.In(DEFAULT_DISABLED + DEFAULT_ENABLED)]),
|
||||
}),
|
||||
}, extra=vol.ALLOW_EXTRA)
|
||||
|
||||
|
@ -140,6 +143,14 @@ async def async_setup(hass, config):
|
|||
ignored_platforms = []
|
||||
enabled_platforms = []
|
||||
|
||||
for platform in enabled_platforms:
|
||||
if platform in DEFAULT_ENABLED:
|
||||
logger.warning(
|
||||
"Please remove %s from your discovery.enable configuration "
|
||||
"as it is now enabled by default",
|
||||
platform,
|
||||
)
|
||||
|
||||
async def new_service_found(service, info):
|
||||
"""Handle a new service if one is found."""
|
||||
if service in ignored_platforms:
|
||||
|
|
Loading…
Reference in New Issue