zxdavb / ramses_cc

HA integration for CH/DHW and HVAC systems that use the RAMSES II RF protocol
GNU General Public License v3.0
80 stars 17 forks source link

MqttTransport: Does not close down gracefully #177

Closed zxdavb closed 7 months ago

zxdavb commented 8 months ago

Traceback is:

2024-03-16 16:58:49.733 ERROR (Thread-7 (_thread_main)) [root] Uncaught thread exception
Traceback (most recent call last):
  File "/usr/lib/python3.12/threading.py", line 1073, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.12/threading.py", line 1010, in run
    self._target(*self._args, **self._kwargs)
  File "/home/dbonnes/clients/hass/venv/lib/python3.12/site-packages/paho/mqtt/client.py", line 3591, in _thread_main
    self.loop_forever(retry_first_connection=True)
  File "/home/dbonnes/clients/hass/venv/lib/python3.12/site-packages/paho/mqtt/client.py", line 1756, in loop_forever
    rc = self._loop(timeout)
         ^^^^^^^^^^^^^^^^^^^
  File "/home/dbonnes/clients/hass/venv/lib/python3.12/site-packages/paho/mqtt/client.py", line 1164, in _loop
    rc = self.loop_read()
         ^^^^^^^^^^^^^^^^
  File "/home/dbonnes/clients/hass/venv/lib/python3.12/site-packages/paho/mqtt/client.py", line 1556, in loop_read
    rc = self._packet_read()
         ^^^^^^^^^^^^^^^^^^^
  File "/home/dbonnes/clients/hass/venv/lib/python3.12/site-packages/paho/mqtt/client.py", line 2439, in _packet_read
    rc = self._packet_handle()
         ^^^^^^^^^^^^^^^^^^^^^
  File "/home/dbonnes/clients/hass/venv/lib/python3.12/site-packages/paho/mqtt/client.py", line 3033, in _packet_handle
    return self._handle_publish()
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dbonnes/clients/hass/venv/lib/python3.12/site-packages/paho/mqtt/client.py", line 3330, in _handle_publish
    self._handle_on_message(message)
  File "/home/dbonnes/clients/hass/venv/lib/python3.12/site-packages/paho/mqtt/client.py", line 3570, in _handle_on_message
    on_message(self, self._userdata, message)
  File "/home/dbonnes/clients/ramses_rf/src/ramses_tx/transport.py", line 1002, in _on_message
    self._pkt_read(pkt)  # TODO: remove raw_line attr from Packet()
    ^^^^^^^^^^^^^^^^^^^
  File "/home/dbonnes/clients/ramses_rf/src/ramses_tx/transport.py", line 485, in _pkt_read
    self._protocol.pkt_received(pkt)
  File "/home/dbonnes/clients/ramses_rf/src/ramses_tx/protocol.py", line 598, in pkt_received
    super().pkt_received(pkt)
  File "/home/dbonnes/clients/ramses_rf/src/ramses_tx/protocol.py", line 498, in pkt_received
    super().pkt_received(pkt)
  File "/home/dbonnes/clients/ramses_rf/src/ramses_tx/protocol.py", line 417, in pkt_received
    super().pkt_received(pkt)
  File "/home/dbonnes/clients/ramses_rf/src/ramses_tx/protocol.py", line 228, in pkt_received
    self._pkt_received(pkt)
  File "/home/dbonnes/clients/ramses_rf/src/ramses_tx/protocol.py", line 238, in _pkt_received
    self._msg_received(msg)
  File "/home/dbonnes/clients/ramses_rf/src/ramses_tx/protocol.py", line 247, in _msg_received
    self._loop.call_soon_threadsafe(self._msg_handler, msg)
  File "/usr/lib/python3.12/asyncio/base_events.py", line 837, in call_soon_threadsafe
    self._check_closed()
  File "/usr/lib/python3.12/asyncio/base_events.py", line 539, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
zxdavb commented 7 months ago

I think fixed in/by 0.31.18