Skip to content

Commit

Permalink
Remove fallback check and add test
Browse files Browse the repository at this point in the history
  • Loading branch information
elupus committed Nov 10, 2024
1 parent 6dab103 commit f79e6e3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 0 additions & 2 deletions nibe/connection/nibegw.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,6 @@ def datagram_received(self, data: bytes, addr):
with io.BytesIO(bytes(data)) as stream:
while block := Block.parse_stream(stream):
self._on_block(block, addr)
if remaining := stream.read():
logger.warning("Failed to parse: %s", remaining)
except ConstructError as e:
logger.warning(
f"Ignoring packet from {addr} due to parse error: {hexlify(data).decode('utf-8')}: {e}"
Expand Down
14 changes: 14 additions & 0 deletions tests/connection/test_nibegw.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,20 @@ async def test_read_product_info(nibegw: NibeGW):
assert "F1255-12 R" == product.model


async def test_read_product_info_with_extras(nibegw: NibeGW):
_enqueue_datagram(
nibegw,
"5c0019ee00f7" # token accessory version
"c0ee03ee0101c3" # accessory version from accessory
"06" # ack from pump
"5c00206d0d0124e346313235352d313220529f",
)
product = await nibegw.read_product_info()

assert isinstance(product, ProductInfo)
assert "F1255-12 R" == product.model


@pytest.mark.parametrize(
("raw", "table_processing_mode", "calls"),
[
Expand Down

0 comments on commit f79e6e3

Please sign in to comment.