Deprecate states UI options in group integration (#30831)

This commit is contained in:
Franck Nijhof 2020-01-16 18:25:39 +01:00 committed by Paulus Schoutsen
parent e1205409f3
commit 4544665749

View File

@ -73,7 +73,10 @@ def _conf_preprocess(value):
return value
GROUP_SCHEMA = vol.Schema(
GROUP_SCHEMA = vol.All(
cv.deprecated(CONF_CONTROL, invalidation_version="0.107.0"),
cv.deprecated(CONF_VIEW, invalidation_version="0.107.0"),
vol.Schema(
{
vol.Optional(CONF_ENTITIES): vol.Any(cv.entity_ids, None),
CONF_VIEW: cv.boolean,
@ -82,6 +85,7 @@ GROUP_SCHEMA = vol.Schema(
CONF_CONTROL: CONTROL_TYPES,
CONF_ALL: cv.boolean,
}
),
)
CONFIG_SCHEMA = vol.Schema(
@ -317,7 +321,11 @@ async def async_setup(hass, config):
DOMAIN,
SERVICE_SET,
locked_service_handler,
schema=vol.Schema(
schema=vol.All(
cv.deprecated(ATTR_CONTROL, invalidation_version="0.107.0"),
cv.deprecated(ATTR_VIEW, invalidation_version="0.107.0"),
cv.deprecated(ATTR_VISIBLE, invalidation_version="0.107.0"),
vol.Schema(
{
vol.Required(ATTR_OBJECT_ID): cv.slug,
vol.Optional(ATTR_NAME): cv.string,
@ -330,6 +338,7 @@ async def async_setup(hass, config):
vol.Exclusive(ATTR_ADD_ENTITIES, "entities"): cv.entity_ids,
}
),
),
)
hass.services.async_register(
@ -343,6 +352,11 @@ async def async_setup(hass, config):
"""Change visibility of a group."""
visible = service.data.get(ATTR_VISIBLE)
_LOGGER.warning(
"The group.set_visibility service has been deprecated and will"
"be removed in Home Assistant 0.107.0."
)
tasks = []
for group in await component.async_extract_from_service(
service, expand_group=False