Add name to services (#46905)
parent
75e04f3a71
commit
c8ffac20b9
|
@ -1,7 +1,10 @@
|
|||
# Describes the format for available light services
|
||||
|
||||
turn_on:
|
||||
description: Turn a light on
|
||||
name: Turn on lights
|
||||
description: >
|
||||
Turn on one or more lights and adjust properties of the light, even when
|
||||
they are turned on already.
|
||||
target:
|
||||
fields:
|
||||
transition:
|
||||
|
@ -311,7 +314,8 @@ turn_on:
|
|||
text:
|
||||
|
||||
turn_off:
|
||||
description: Turn a light off
|
||||
name: Turn off lights
|
||||
description: Turns off one or more lights.
|
||||
target:
|
||||
fields:
|
||||
transition:
|
||||
|
@ -340,7 +344,10 @@ turn_off:
|
|||
- short
|
||||
|
||||
toggle:
|
||||
description: Toggles a light
|
||||
name: Toggle lights
|
||||
description: >
|
||||
Toggles one or more lights, from on to off, or, off to on, based on their
|
||||
current state.
|
||||
target:
|
||||
fields:
|
||||
transition:
|
||||
|
|
|
@ -449,6 +449,7 @@ async def async_get_all_descriptions(
|
|||
# positives for things like scripts, that register as a service
|
||||
|
||||
description = {
|
||||
"name": yaml_description.get("name", ""),
|
||||
"description": yaml_description.get("description", ""),
|
||||
"fields": yaml_description.get("fields", {}),
|
||||
}
|
||||
|
@ -472,8 +473,9 @@ def async_set_service_schema(
|
|||
hass.data.setdefault(SERVICE_DESCRIPTION_CACHE, {})
|
||||
|
||||
description = {
|
||||
"description": schema.get("description") or "",
|
||||
"fields": schema.get("fields") or {},
|
||||
"name": schema.get("name", ""),
|
||||
"description": schema.get("description", ""),
|
||||
"fields": schema.get("fields", {}),
|
||||
}
|
||||
|
||||
hass.data[SERVICE_DESCRIPTION_CACHE][f"{domain}.{service}"] = description
|
||||
|
|
|
@ -37,6 +37,7 @@ FIELD_SCHEMA = vol.Schema(
|
|||
SERVICE_SCHEMA = vol.Schema(
|
||||
{
|
||||
vol.Required("description"): str,
|
||||
vol.Optional("name"): str,
|
||||
vol.Optional("target"): vol.Any(
|
||||
selector.TargetSelector.CONFIG_SCHEMA, None # pylint: disable=no-member
|
||||
),
|
||||
|
|
Loading…
Reference in New Issue