Skip to content

HASS Plugin: no way to obtain service response if response is optional. #2497

@maristieuvelonde

Description

@maristieuvelonde

HA services have three possible states for response: null, optional, not optional. Since the new auto detection mechanism was put in place, there is no way to obtain the response from services that mark the the result state as optional such as the conversation API and process service. Unfortunately this means it's impossible to use AppDaemon to write a middleware for conversations.

# Set the return_response flag if doing so is not optional
match service_properties:
case {"response": {"optional": False}}:
req["return_response"] = True

See also this issue #2232 and #2010

Additionally this works perfectly fine while calling the parent websocket method:

req = {
    "type": "call_service",
    "domain": "conversation",
    "service": "process",
    "service_data": {
        "text": "Tell me about something",
    },
    "return_response": True
}
res = await self._plugin.websocket_send_json(**req)

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions