Cereal2nd / velbus-aio

Velbus Asyncio
Apache License 2.0
15 stars 10 forks source link

VMBDALI module doesn't load correctly from cache #102

Closed niobos closed 4 months ago

niobos commented 4 months ago

It looks like the VMBDALI module doesn't load correctly from cache:

2024-05-22 11:13:06.461 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/velbusaio/protocol.py", line 169, in _process_message
    await self._message_received_callback(msg)
  File "/usr/local/lib/python3.12/site-packages/velbusaio/controller.py", line 61, in _on_message_received
    await self._handler.handle(msg)
  File "/usr/local/lib/python3.12/site-packages/velbusaio/handler.py", line 73, in handle
    await self._handle_module_type(msg)
  File "/usr/local/lib/python3.12/site-packages/velbusaio/handler.py", line 131, in _handle_module_type
    await self._velbus.add_module(
  File "/usr/local/lib/python3.12/site-packages/velbusaio/controller.py", line 96, in add_module
    await self._modules[addr].load()
  File "/usr/local/lib/python3.12/site-packages/velbusaio/module.py", line 778, in load
    await super().load(from_cache)
  File "/usr/local/lib/python3.12/site-packages/velbusaio/module.py", line 562, in load
    self._channels[int(num)]._name = chan["name"]
    ~~~~~~~~~~~~~~^^^^^^^^^^
KeyError: 1

When I clear the cache, it starts up correctly, but a restart keeps waiting for the VMBDALI module, presumably because of the above exception.

I'll try to look into this myself, but I wanted to create this issue already for reference.