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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user