mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 16:57:10 +00:00
Avoid looking up services to check if they support responses (#109588)
We already have the Service object as its the value in the services_map so there is not need to look it up again
This commit is contained in:
parent
e877113b21
commit
2f724b042b
@ -640,7 +640,7 @@ async def async_get_all_descriptions(
|
||||
descriptions[domain] = {}
|
||||
domain_descriptions = descriptions[domain]
|
||||
|
||||
for service_name in services_map:
|
||||
for service_name, service in services_map.items():
|
||||
cache_key = (domain, service_name)
|
||||
description = descriptions_cache.get(cache_key)
|
||||
if description is not None:
|
||||
@ -695,11 +695,10 @@ async def async_get_all_descriptions(
|
||||
if "target" in yaml_description:
|
||||
description["target"] = yaml_description["target"]
|
||||
|
||||
if (
|
||||
response := hass.services.supports_response(domain, service_name)
|
||||
) != SupportsResponse.NONE:
|
||||
response = service.supports_response
|
||||
if response is not SupportsResponse.NONE:
|
||||
description["response"] = {
|
||||
"optional": response == SupportsResponse.OPTIONAL,
|
||||
"optional": response is SupportsResponse.OPTIONAL,
|
||||
}
|
||||
|
||||
descriptions_cache[cache_key] = description
|
||||
|
Loading…
x
Reference in New Issue
Block a user