ZHA completely stops working occasionally

and then displays a “failed to set up” error
This has been the case since I switched from z2m to ZHA. The former only had some very rare shutdowns but ZHA has them every couple of days, making its’ connected devices unusable.

In order to temporarily resolve the issue I have to reboot homeassistant which is inacceptable.
The log contains the following related entries:

Logger: homeassistant.components.zha.core.gateway
Source: components/zha/core/gateway.py:209
Integration: Zigbee Home Automation (documentation, issues)
First occurred: November 1, 2023 at 3:01:26 AM (3 occurrences)
Last logged: 3:03:56 PM

Couldn't start deCONZ = dresden elektronik deCONZ protocol: ConBee I/II, RaspBee I/II coordinator (attempt 1 of 3)
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/zigpy_deconz/api.py", line 313, in _command
    return await fut
           ^^^^^^^^^
asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/zha/core/gateway.py", line 209, in async_initialize
    await self.application_controller.startup(auto_form=True)
  File "/usr/local/lib/python3.11/site-packages/zigpy/application.py", line 198, in startup
    await self.initialize(auto_form=auto_form)
  File "/usr/local/lib/python3.11/site-packages/zigpy/application.py", line 155, in initialize
    await self.permit(0)
  File "/usr/local/lib/python3.11/site-packages/zigpy/application.py", line 1149, in permit
    await self.permit_ncp(time_s)
  File "/usr/local/lib/python3.11/site-packages/zigpy_deconz/zigbee/application.py", line 488, in permit_ncp
    await self._api.write_parameter(NetworkParameter.permit_join, time_s)
  File "/usr/local/lib/python3.11/site-packages/zigpy_deconz/api.py", line 312, in _command
    async with asyncio_timeout(COMMAND_TIMEOUT):
  File "/usr/local/lib/python3.11/asyncio/timeouts.py", line 111, in __aexit__
    raise TimeoutError from exc_val
TimeoutError


__

Logger: zigpy_deconz.api
Source: components/zha/core/gateway.py:209
First occurred: November 1, 2023 at 3:01:26 AM (9 occurrences)
Last logged: 3:04:07 PM

No response to 'Command.write_parameter' command with seq id '0x2d'
No response to 'Command.read_parameter' command with seq id '0x1c'
No response to 'Command.read_parameter' command with seq id '0x02'
No response to 'Command.read_parameter' command with seq id '0x0b'

__

Logger: homeassistant.config_entries
Source: components/zha/core/gateway.py:209
First occurred: November 1, 2023 at 3:01:36 AM (3 occurrences)
Last logged: 3:04:07 PM

Error setting up entry /dev/ttyS0 for zha
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/zigpy_deconz/api.py", line 313, in _command
    return await fut
           ^^^^^^^^^
asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/zigpy/application.py", line 197, in startup
    await self.connect()
  File "/usr/local/lib/python3.11/site-packages/zigpy_deconz/zigbee/application.py", line 88, in connect
    self.version = await api.version()
                   ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/zigpy_deconz/api.py", line 465, in version
    (self._proto_ver,) = await self.read_parameter(
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/zigpy_deconz/api.py", line 430, in read_parameter
    r = await self._command(Command.read_parameter, 1 + len(data), param, data)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/zigpy_deconz/api.py", line 312, in _command
    async with asyncio_timeout(COMMAND_TIMEOUT):
  File "/usr/local/lib/python3.11/asyncio/timeouts.py", line 111, in __aexit__
    raise TimeoutError from exc_val
TimeoutError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 387, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/zha/__init__.py", line 180, in async_setup_entry
    await zha_gateway.async_initialize()
  File "/usr/src/homeassistant/homeassistant/components/zha/core/gateway.py", line 222, in async_initialize
    raise exc
  File "/usr/src/homeassistant/homeassistant/components/zha/core/gateway.py", line 209, in async_initialize
    await self.application_controller.startup(auto_form=True)
  File "/usr/local/lib/python3.11/site-packages/zigpy/application.py", line 201, in startup
    await self.shutdown()
  File "/usr/local/lib/python3.11/site-packages/zigpy/application.py", line 406, in shutdown
    await self._dblistener.shutdown()
  File "/usr/local/lib/python3.11/site-packages/zigpy/appdb.py", line 187, in shutdown
    await self._set_isolation_level(None)
  File "/usr/local/lib/python3.11/site-packages/zigpy/appdb.py", line 205, in _set_isolation_level
    await self._db._execute(lambda: setattr(self._db, "isolation_level", level))
  File "/usr/local/lib/python3.11/site-packages/aiosqlite/core.py", line 126, in _execute
    raise ValueError("Connection closed")
ValueError: Connection closed

How do I permanently solve this?

Home Assistant 2023.9.3
Supervisor 2023.11.3
Operating System 7.4
Frontend 20230911.0 - latest

coordinator: RaspBee 2


Steps that didn’t help:
-Removing the ZHA Toolkit addon
-downgrading HA core to 2023.9.3
-downgrading to Home Assistant Core 2022.5.5 and using Z2M (because I had a backup from that) and using Z2M again: I get random HA crashes occasionally (may also have to with me using a new coordinator I was recommended)

Steps I’m trying out right now:
-downgrading Home Assistant Core to 2022.3.8 (which was somewhat suggested by this post)…I typed in 2022.3.8 and it only downgraded me to 2023.9.3 without any explanation, wtf??? I’m starting to grow so tired of HA. Half of the stuff doesn’t work and there’s a risk of everything breaking for an uncertain amount of time every time I touch something.This probably broke because of updating just like all the other times but no, they had to incentivise it by not letting you use the Add-Integration button/HACS store otherwise + some smarty-pants in the forum baited me into doing it
-downgrading HA Core to some version between 2022.5.5 and 2022.2.9 (downgrade isn’t applied)
-downgrading HA core to 2022.2.9

bump, didn’t post in the right subforum originally

bump, I have no idea what next step I should take