mirror of
https://github.com/esphome/aioesphomeapi.git
synced 2024-12-02 13:43:25 +01:00
Remove impossible check in send_message_await_response (#513)
This commit is contained in:
parent
48b56ad25c
commit
b9ec1d0bc5
@ -678,17 +678,14 @@ class APIConnection:
|
|||||||
async def send_message_await_response(
|
async def send_message_await_response(
|
||||||
self, send_msg: message.Message, response_type: Any, timeout: float = 10.0
|
self, send_msg: message.Message, response_type: Any, timeout: float = 10.0
|
||||||
) -> Any:
|
) -> Any:
|
||||||
res = await self.send_message_await_response_complex(
|
[response] = await self.send_message_await_response_complex(
|
||||||
send_msg,
|
send_msg,
|
||||||
None, # we will only get responses of `response_type`
|
None, # we will only get responses of `response_type`
|
||||||
None, # we will only get responses of `response_type`
|
None, # we will only get responses of `response_type`
|
||||||
(response_type,),
|
(response_type,),
|
||||||
timeout=timeout,
|
timeout=timeout,
|
||||||
)
|
)
|
||||||
if len(res) != 1:
|
return response
|
||||||
raise APIConnectionError(f"Expected one result, got {len(res)}")
|
|
||||||
|
|
||||||
return res[0]
|
|
||||||
|
|
||||||
def _report_fatal_error(self, err: Exception) -> None:
|
def _report_fatal_error(self, err: Exception) -> None:
|
||||||
"""Report a fatal error that occurred during an operation.
|
"""Report a fatal error that occurred during an operation.
|
||||||
|
Loading…
Reference in New Issue
Block a user