diff --git a/omnikinverter/tcp.py b/omnikinverter/tcp.py index 299f5224..6dbf65e6 100644 --- a/omnikinverter/tcp.py +++ b/omnikinverter/tcp.py @@ -195,10 +195,14 @@ def parse_messages(serial_number: int, data: bytes) -> dict[str, Any]: for (message_type, reply_serial_number, message) in _unpack_messages( bytearray(data) ): - if reply_serial_number != serial_number: - raise OmnikInverterPacketInvalidError( - f"Replied serial number {reply_serial_number} " - f"not equal to request {serial_number}" + if reply_serial_number != serial_number: # pragma: no cover + # This is allowed as it does not seem to be required to pass the serial + # number in the request - though empirical testing has to point out whether + # the request takes longer this way. + LOGGER.debug( + "Replied serial number %s not equal to request %s", + reply_serial_number, + serial_number, ) if message_type == MESSAGE_TYPE_INFORMATION_REPLY: diff --git a/tests/test_models.py b/tests/test_models.py index ece20ebf..cc84f9dd 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -429,18 +429,6 @@ async def test_inverter_tcp_end_marker() -> None: assert str(excinfo.value) == "Invalid end byte" -async def test_inverter_tcp_reply_identical_serial() -> None: - """Require replied serial to be identical to the request.""" - - with pytest.raises(OmnikInverterPacketInvalidError) as excinfo: - assert tcp.parse_messages(1234, load_fixture_bytes("tcp_reply.data")) - - assert ( - str(excinfo.value) - == "Replied serial number 987654321 not equal to request 1234" - ) - - async def test_inverter_tcp_known_message_type() -> None: """Require message type to be known."""