1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Add service response values to service descriptions (#95262)

This commit is contained in:
Paulus Schoutsen
2023-06-26 12:57:43 -04:00
committed by GitHub
parent fa03324bbd
commit d95c241a1a
2 changed files with 32 additions and 1 deletions

View File

@@ -31,6 +31,7 @@ from homeassistant.core import (
HomeAssistant,
ServiceCall,
ServiceResponse,
SupportsResponse,
callback,
)
from homeassistant.exceptions import (
@@ -635,6 +636,13 @@ async def async_get_all_descriptions(
if "target" in yaml_description:
description["target"] = yaml_description["target"]
if (
response := hass.services.supports_response(domain, service)
) != SupportsResponse.NONE:
description["response"] = {
"optional": response == SupportsResponse.OPTIONAL,
}
descriptions_cache[cache_key] = description
descriptions[domain][service] = description