Skip to content

IndexError: list index out of range #134

@kridgo

Description

@kridgo

Hi,

I am using the enocean integration in Home Assistant, wich has been running fine for over a month. Out of a sudden, it chrashed on parsing an incoming packet as you can see in the log output underneath. After a restart of Home Assistant, the integration is operating normal again. It seems like the incoming packet was malformed or something so that the DB6.BIT_7 bit could not be accessed.
Maybe some form of exception handling could be used to drop packets in such cases instead of the integration crashing?

Thanks in advance and best regards

The Home Assistant Log Output looks like this: (I removed the sender ID)

2022-07-19 15:42:57 DEBUG (Thread-3) [homeassistant.components.enocean.dongle] Received radio packet: xx:xx:xx:xx->FF:FF:FF:FF (-73 dBm): 0x01 ['0xd5', '0x9', '0x0', '0x1', '0x98', '0xb6', '0x0'] ['0x0', '0xff', '0xff', '0xff', '0xff', '0x49', '0x0'] OrderedDict()
2022-07-19 15:42:57 ERROR (Thread-3) [root] Uncaught thread exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/threading.py", line 973, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.9/site-packages/enocean/communicators/serialcommunicator.py", line 39, in run
    self.parse()
  File "/usr/local/lib/python3.9/site-packages/enocean/communicators/communicator.py", line 63, in parse
    status, self._buffer, packet = Packet.parse_msg(self._buffer, communicator=self)
  File "/usr/local/lib/python3.9/site-packages/enocean/protocol/packet.py", line 147, in parse_msg
    packet = UTETeachIn(packet_type, data, opt_data, communicator=communicator)
  File "/usr/local/lib/python3.9/site-packages/enocean/protocol/packet.py", line 372, in __init__
    super(UTETeachIn, self).__init__(packet_type=packet_type, data=data, optional=optional)
  File "/usr/local/lib/python3.9/site-packages/enocean/protocol/packet.py", line 46, in __init__
    self.parse()
  File "/usr/local/lib/python3.9/site-packages/enocean/protocol/packet.py", line 388, in parse
    self.unidirectional = not self._bit_data[DB6.BIT_7]
IndexError: list index out of range

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions