mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Add name to services (#46905)
This commit is contained in:
parent
75e04f3a71
commit
c8ffac20b9
@ -1,7 +1,10 @@
|
|||||||
# Describes the format for available light services
|
# Describes the format for available light services
|
||||||
|
|
||||||
turn_on:
|
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:
|
target:
|
||||||
fields:
|
fields:
|
||||||
transition:
|
transition:
|
||||||
@ -311,7 +314,8 @@ turn_on:
|
|||||||
text:
|
text:
|
||||||
|
|
||||||
turn_off:
|
turn_off:
|
||||||
description: Turn a light off
|
name: Turn off lights
|
||||||
|
description: Turns off one or more lights.
|
||||||
target:
|
target:
|
||||||
fields:
|
fields:
|
||||||
transition:
|
transition:
|
||||||
@ -340,7 +344,10 @@ turn_off:
|
|||||||
- short
|
- short
|
||||||
|
|
||||||
toggle:
|
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:
|
target:
|
||||||
fields:
|
fields:
|
||||||
transition:
|
transition:
|
||||||
|
@ -449,6 +449,7 @@ async def async_get_all_descriptions(
|
|||||||
# positives for things like scripts, that register as a service
|
# positives for things like scripts, that register as a service
|
||||||
|
|
||||||
description = {
|
description = {
|
||||||
|
"name": yaml_description.get("name", ""),
|
||||||
"description": yaml_description.get("description", ""),
|
"description": yaml_description.get("description", ""),
|
||||||
"fields": yaml_description.get("fields", {}),
|
"fields": yaml_description.get("fields", {}),
|
||||||
}
|
}
|
||||||
@ -472,8 +473,9 @@ def async_set_service_schema(
|
|||||||
hass.data.setdefault(SERVICE_DESCRIPTION_CACHE, {})
|
hass.data.setdefault(SERVICE_DESCRIPTION_CACHE, {})
|
||||||
|
|
||||||
description = {
|
description = {
|
||||||
"description": schema.get("description") or "",
|
"name": schema.get("name", ""),
|
||||||
"fields": schema.get("fields") or {},
|
"description": schema.get("description", ""),
|
||||||
|
"fields": schema.get("fields", {}),
|
||||||
}
|
}
|
||||||
|
|
||||||
hass.data[SERVICE_DESCRIPTION_CACHE][f"{domain}.{service}"] = description
|
hass.data[SERVICE_DESCRIPTION_CACHE][f"{domain}.{service}"] = description
|
||||||
|
@ -37,6 +37,7 @@ FIELD_SCHEMA = vol.Schema(
|
|||||||
SERVICE_SCHEMA = vol.Schema(
|
SERVICE_SCHEMA = vol.Schema(
|
||||||
{
|
{
|
||||||
vol.Required("description"): str,
|
vol.Required("description"): str,
|
||||||
|
vol.Optional("name"): str,
|
||||||
vol.Optional("target"): vol.Any(
|
vol.Optional("target"): vol.Any(
|
||||||
selector.TargetSelector.CONFIG_SCHEMA, None # pylint: disable=no-member
|
selector.TargetSelector.CONFIG_SCHEMA, None # pylint: disable=no-member
|
||||||
),
|
),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user