Slow performance and cryptic errors

Hi Everyone,

I have noticed lately that the performance of my HA is getting slow. It takes up to 5 seconds for lights to turn on when triggered by zigbee motion sensors (it used to be basically instant). Its really noticeable on a flash sequence I configured that is supposed to change colour every second but now doesn’t really flash any more, also my front end seems to take ages to load now too.

My hardware is a Raspberry Pi 4, 4GB, its boot drive is an SSD with a SATA-USB adaptor. It has been set up like this for around 2 years, with the problem starting probably a couple of months ago. I have checked both the RAM and CPU and there is plenty of headroom, neither ever going above 50% unless I’m updating ESPhome devices.

I have had a really good clear-out of orphaned entities, unused integrations etc and there has been no real improvement. A restart does seem to help, but only for a little while then everything slows down again.

The only suspicious log entries I can see are these ones:

Logger: homeassistant
Source: /usr/src/homeassistant/homeassistant/runner.py:145
First occurred: January 22, 2024 at 16:10:45 (52272 occurrences)
Last logged: 06:16:20

Error doing job: Fatal write error on datagram transport
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 1190, in sendto
    self._sock.sendto(data, addr)
TypeError: str, bytes or bytearray expected, not NoneType

I’ve no clue whats causing this one. The other suspicious one is this:

Logger: zigpy.zcl
Source: runner.py:188
First occurred: January 24, 2024 at 12:18:54 (19 occurrences)
Last logged: 05:15:37

[0x1C3A:1:0x0020] Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/zigpy/endpoint.py", line 253, in request return await self.device.request( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/zigpy/device.py", line 323, in request await send_request() File "/usr/local/lib/python3.11/site-packages/zigpy/application.py", line 833, in request await self.send_packet( File "/usr/local/lib/python3.11/site-packages/zigpy_deconz/zigbee/application.py", line 530, in send_packet raise zigpy.exceptions.DeliveryError( zigpy.exceptions.DeliveryError: Failed to deliver packet: <TXStatus.MAC_TRANSACTION_EXPIRED: 240> The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/zha/core/cluster_handlers/general.py", line 504, in check_in_response await self.checkin_response(True, self.CHECKIN_FAST_POLL_TIMEOUT, tsn=tsn) File "/usr/src/homeassistant/homeassistant/components/zha/core/cluster_handlers/__init__.py", line 83, in wrapper with wrap_zigpy_exceptions(): File "/usr/local/lib/python3.11/contextlib.py", line 155, in __exit__ self.gen.throw(typ, value, traceback) File "/usr/src/homeassistant/homeassistant/components/zha/core/cluster_handlers/__init__.py", line 75, in wrap_zigpy_exceptions raise HomeAssistantError(message) from exc homeassistant.exceptions.HomeAssistantError: Failed to send request: Failed to deliver packet: <TXStatus.MAC_TRANSACTION_EXPIRED: 240>
[0x1C3A:1:0x0020] Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/zigpy/endpoint.py", line 253, in request return await self.device.request( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/zigpy/device.py", line 323, in request await send_request() File "/usr/local/lib/python3.11/site-packages/zigpy/application.py", line 833, in request await self.send_packet( File "/usr/local/lib/python3.11/site-packages/zigpy_deconz/zigbee/application.py", line 530, in send_packet raise zigpy.exceptions.DeliveryError( zigpy.exceptions.DeliveryError: Failed to deliver packet: <TXStatus.MAC_TRANSACTION_EXPIRED: 240> The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/zha/core/cluster_handlers/general.py", line 507, in check_in_response await self.fast_poll_stop() File "/usr/src/homeassistant/homeassistant/components/zha/core/cluster_handlers/__init__.py", line 83, in wrapper with wrap_zigpy_exceptions(): File "/usr/local/lib/python3.11/contextlib.py", line 155, in __exit__ self.gen.throw(typ, value, traceback) File "/usr/src/homeassistant/homeassistant/components/zha/core/cluster_handlers/__init__.py", line 75, in wrap_zigpy_exceptions raise HomeAssistantError(message) from exc homeassistant.exceptions.HomeAssistantError: Failed to send request: Failed to deliver packet: <TXStatus.MAC_TRANSACTION_EXPIRED: 240>

Which may be a ZHA error?

So, I think the poor performance of my lights is (mostly) down to the position of my hue hub. It lives in a pretty noisy area with 4 x raspberry pi and 4 uncovered HDDs. I have moved it as far as my power/network cables will allow and added some shielding to the shelf below and that issue is now (mostly) resolved.

This does seem to have helped with the front-end performance too, but I feel like that may just be a coincidence.

This error is still persistent though:

Logger: homeassistant
Source: /usr/src/homeassistant/homeassistant/runner.py:145
First occurred: January 27, 2024 at 09:17:51 (11376 occurrences)
Last logged: 08:59:16

Error doing job: Fatal write error on datagram transport
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 1190, in sendto
    self._sock.sendto(data, addr)
TypeError: str, bytes or bytearray expected, not NoneType

with 11,376 occurrences in 24 hrs

I think the either the update to OS Version 11.5 or Core version 2024.2.0 has resolved the issue.