zigpy / bellows

A Python 3 project to implement EZSP for EmberZNet devices
GNU General Public License v3.0
177 stars 86 forks source link

Drop empty frames #600

Closed puddly closed 7 months ago

puddly commented 7 months ago

It seems like zigbeed (or our TCP-enabling patchset for it) can sometimes send completely empty frames:

2023-12-11 14:47:18.882 DEBUG (MainThread) [zigpy.serial] Opening a serial connection to 'socket://core-silabs-multiprotocol:9999' (57600 baudrate)
2023-12-11 14:47:18.902 DEBUG (MainThread) [bellows.uart] Data frame: b'592a2c7e'
2023-12-11 14:47:18.902 DEBUG (MainThread) [bellows.uart] Sending: b'8610be7e'
2023-12-11 14:47:18.905 ERROR (MainThread) [homeassistant] Error doing job: Fatal error: protocol.data_received() call failed.
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 1003, in _read_ready__data_received
    self._protocol.data_received(data)
  File "/usr/local/lib/python3.11/site-packages/bellows/uart.py", line 76, in data_received
    self.frame_received(frame)
  File "/usr/local/lib/python3.11/site-packages/bellows/uart.py", line 103, in frame_received
    self.data_frame_received(data)
  File "/usr/local/lib/python3.11/site-packages/bellows/uart.py", line 124, in data_frame_received
    self._application.frame_received(self._randomize(data[1:-3]))
  File "/usr/local/lib/python3.11/site-packages/bellows/ezsp/__init__.py", line 305, in frame_received
    self._protocol(data)
  File "/usr/local/lib/python3.11/site-packages/bellows/ezsp/protocol.py", line 83, in __call__
    sequence, frame_id, data = self._ezsp_frame_rx(data)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/bellows/ezsp/v4/__init__.py", line 33, in _ezsp_frame_rx
    return data[0], data[2], data[3:]
           ~~~~^^^
IndexError: index out of range
2023-12-11 14:47:18.932 DEBUG (MainThread) [bellows.uart] Connection lost: IndexError('index out of range')
codecov[bot] commented 7 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (1ac01ed) 99.78% compared to head (c4d22f8) 99.78%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## dev #600 +/- ## ======================================= Coverage 99.78% 99.78% ======================================= Files 67 67 Lines 4719 4722 +3 ======================================= + Hits 4709 4712 +3 Misses 10 10 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.