mirror of
https://github.com/esphome/aioesphomeapi.git
synced 2025-01-12 20:10:42 +01:00
Remove unreachable check in connection send_messages (#704)
This commit is contained in:
parent
b67e19bd94
commit
402d6fe113
@ -41,6 +41,7 @@ cdef object HandshakeAPIError
|
|||||||
cdef object PingFailedAPIError
|
cdef object PingFailedAPIError
|
||||||
cdef object ReadFailedAPIError
|
cdef object ReadFailedAPIError
|
||||||
cdef object TimeoutAPIError
|
cdef object TimeoutAPIError
|
||||||
|
cdef object SocketAPIError
|
||||||
|
|
||||||
cdef object astuple
|
cdef object astuple
|
||||||
|
|
||||||
|
@ -611,21 +611,16 @@ class APIConnection:
|
|||||||
f"Connection isn't established yet ({self.connection_state})"
|
f"Connection isn't established yet ({self.connection_state})"
|
||||||
)
|
)
|
||||||
|
|
||||||
packets: list[tuple[int, bytes]] = []
|
packets: list[tuple[int, bytes]] = [
|
||||||
debug_enabled = self._debug_enabled
|
(PROTO_TO_MESSAGE_TYPE[type(msg)], msg.SerializeToString()) for msg in msgs
|
||||||
|
]
|
||||||
|
|
||||||
for msg in msgs:
|
if debug_enabled := self._debug_enabled:
|
||||||
msg_type = type(msg)
|
for msg in msgs:
|
||||||
if (message_type := PROTO_TO_MESSAGE_TYPE.get(msg_type)) is None:
|
|
||||||
raise ValueError(f"Message type id not found for type {msg_type}")
|
|
||||||
|
|
||||||
if debug_enabled:
|
|
||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
"%s: Sending %s: %s", self.log_name, msg_type.__name__, msg
|
"%s: Sending %s: %s", self.log_name, type(msg).__name__, msg
|
||||||
)
|
)
|
||||||
|
|
||||||
packets.append((message_type, msg.SerializeToString()))
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
assert self._frame_helper is not None
|
assert self._frame_helper is not None
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user