mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
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 period
This commit is contained in:
parent
04b680d9d0
commit
1e6babe796
@ -105,16 +105,19 @@ OPTIONAL_SERVICE_HANDLERS = {
|
|||||||
SERVICE_DLNA_DMR: ('media_player', 'dlna_dmr'),
|
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_IGNORE = 'ignore'
|
||||||
CONF_ENABLE = 'enable'
|
CONF_ENABLE = 'enable'
|
||||||
|
|
||||||
CONFIG_SCHEMA = vol.Schema({
|
CONFIG_SCHEMA = vol.Schema({
|
||||||
vol.Optional(DOMAIN): vol.Schema({
|
vol.Optional(DOMAIN): vol.Schema({
|
||||||
vol.Optional(CONF_IGNORE, default=[]):
|
vol.Optional(CONF_IGNORE, default=[]):
|
||||||
vol.All(cv.ensure_list, [
|
vol.All(cv.ensure_list, [vol.In(DEFAULT_ENABLED)]),
|
||||||
vol.In(list(CONFIG_ENTRY_HANDLERS) + list(SERVICE_HANDLERS))]),
|
|
||||||
vol.Optional(CONF_ENABLE, default=[]):
|
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)
|
}, extra=vol.ALLOW_EXTRA)
|
||||||
|
|
||||||
@ -140,6 +143,14 @@ async def async_setup(hass, config):
|
|||||||
ignored_platforms = []
|
ignored_platforms = []
|
||||||
enabled_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):
|
async def new_service_found(service, info):
|
||||||
"""Handle a new service if one is found."""
|
"""Handle a new service if one is found."""
|
||||||
if service in ignored_platforms:
|
if service in ignored_platforms:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user