home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.49k stars 30.7k forks source link

serial.serialutil.SerialException: write failed: [Errno 5] I/O error #111604

Closed bombaata closed 5 months ago

bombaata commented 8 months ago

The problem

Errors in logs, random reboots each day.

What version of Home Assistant Core has the issue?

core-2024.2.3

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

No response

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

22:37 2024-02-26 ERROR [homeassistant] Error doing job: Fatal write error on serial transport Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/serial/serialposix.py", line 621, in write
    n = os.write(self.fd, d)
        ^^^^^^^^^^^^^^^^^^^^
OSError: [Errno 5] I/O error

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/serial_asyncio_fast/__init__.py", line 301, in _write_data
    n = self._serial.write(data)
        ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/serial/serialposix.py", line 655, in write
    raise SerialException('write failed: {}'.format(e))
serial.serialutil.SerialException: write failed: [Errno 5] I/O error
22:37 2024-02-26 ERROR [homeassistant] Error doing job: Task exception was never retrieved Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/zha/sensor.py", line 237, in _refresh
    await self.async_update()
  File "/usr/src/homeassistant/homeassistant/components/zha/entity.py", line 229, in async_update
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/components/zha/core/cluster_handlers/smartenergy.py", line 324, in async_update
    result = await self.get_attributes(attrs, from_cache=False, only_cache=False)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/zha/core/cluster_handlers/__init__.py", line 514, in _get_attributes
    read, _ = await self.cluster.read_attributes(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/zigpy/zcl/__init__.py", line 528, in read_attributes
    result = await self.read_attributes_raw(to_read, manufacturer=manufacturer)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/zigpy/quirks/__init__.py", line 260, in read_attributes_raw
    results = await super().read_attributes_raw(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/zigpy/quirks/__init__.py", line 305, in _read_attributes
    return await super()._read_attributes(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/zigpy/zcl/__init__.py", line 377, in request
    return await self._endpoint.request(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/zigpy/endpoint.py", line 253, in request
    return await self.device.request(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/zigpy/device.py", line 327, in request
    await send_request()
  File "/usr/local/lib/python3.12/site-packages/zigpy/application.py", line 833, in request
    await self.send_packet(
  File "/usr/local/lib/python3.12/site-packages/zigpy_deconz/zigbee/application.py", line 508, in send_packet
    await self._api.aps_data_request(
  File "/usr/local/lib/python3.12/site-packages/zigpy_deconz/api.py", line 883, in aps_data_request
    rsp = await self.send_command(
          ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/zigpy_deconz/api.py", line 508, in send_command
    return await self._command(cmd, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/zigpy_deconz/api.py", line 581, in _command
    self._uart.send(command.replace(seq=seq).serialize())
    ^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'send'

Additional information

rpi3-64 running on a recent Sandisk Extrem U3 A2 µSD card.

Addons

Terminal & SSH (9.9.0)
Duck DNS (1.15.0)
File editor (5.8.0)
Home Assistant Google Drive Backup (0.112.1)
AdGuard Home (5.0.3)
Advanced SSH & Web Terminal (17.1.1)
Firefox (1.1.0) (disabled)
NGINX Home Assistant SSL proxy (3.8.0)

Integrations

AdGuard Home
Local IP Address
Mobile App
Bluetooth
DLNA Digital Media Renderer
DNS IP
Certificate Expiry
Fast.com
Google Cast
HACS
Home Assistant Supervisor
iBeacon Tracker
Meross LAN
Météo-France
Passive BLE monitor
Ping (ICMP)
Sun
System Monitor
Uptime
Raspberry Pi Power Supply Checker
Xiaomi BLE
Xiaomi Gateway (Aqara)
Xiaomi Gateway 3
Xiaomi Miio
Zigbee Home Automation
home-assistant[bot] commented 8 months ago

Hey there @dmulcahey, @adminiuga, @puddly, @thejulianjes, mind taking a look at this issue as it has been labeled with an integration (zha) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `zha` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign zha` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


zha documentation zha source (message by IssueLinks)

bombaata commented 8 months ago

I don't know if it's related, but the rpi rebooted again and caught a ZHA-related error before the reboot.

09:39 2024-02-27 ERROR [homeassistant] Error doing job: Task exception was never retrieved Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/zha/sensor.py", line 237, in _refresh
    await self.async_update()
  File "/usr/src/homeassistant/homeassistant/components/zha/entity.py", line 229, in async_update
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/components/zha/core/cluster_handlers/smartenergy.py", line 324, in async_update
    result = await self.get_attributes(attrs, from_cache=False, only_cache=False)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/zha/core/cluster_handlers/__init__.py", line 514, in _get_attributes
    read, _ = await self.cluster.read_attributes(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/zigpy/zcl/__init__.py", line 528, in read_attributes
    result = await self.read_attributes_raw(to_read, manufacturer=manufacturer)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/zigpy/quirks/__init__.py", line 260, in read_attributes_raw
    results = await super().read_attributes_raw(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/zigpy/quirks/__init__.py", line 305, in _read_attributes
    return await super()._read_attributes(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/zigpy/zcl/__init__.py", line 377, in request
    return await self._endpoint.request(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/zigpy/endpoint.py", line 253, in request
    return await self.device.request(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/zigpy/device.py", line 327, in request
    await send_request()
  File "/usr/local/lib/python3.12/site-packages/zigpy/application.py", line 833, in request
    await self.send_packet(
  File "/usr/local/lib/python3.12/site-packages/zigpy_deconz/zigbee/application.py", line 508, in send_packet
    await self._api.aps_data_request(
  File "/usr/local/lib/python3.12/site-packages/zigpy_deconz/api.py", line 883, in aps_data_request
    rsp = await self.send_command(
          ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/zigpy_deconz/api.py", line 508, in send_command
    return await self._command(cmd, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/zigpy_deconz/api.py", line 581, in _command
    self._uart.send(command.replace(seq=seq).serialize())
    ^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'send'

Using Conbee II coordinator with USB cable.

andi242 commented 8 months ago

slightly different on a SonOff here:

Logger: homeassistant
Source: components/zha/core/cluster_handlers/__init__.py:75
First occurred: 12:15:02 PM (2 occurrences)
Last logged: 12:23:26 PM

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/zha/core/cluster_handlers/__init__.py", line 64, in wrap_zigpy_exceptions
    yield
  File "/usr/src/homeassistant/homeassistant/components/zha/core/cluster_handlers/__init__.py", line 84, in wrapper
    return await RETRYABLE_REQUEST_DECORATOR(func)(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/zigpy/util.py", line 131, in retry
    return await func()
           ^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/zigpy/zcl/__init__.py", line 377, in request
    return await self._endpoint.request(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/zigpy/endpoint.py", line 253, in request
    return await self.device.request(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/zigpy/device.py", line 327, in request
    await send_request()
  File "/usr/local/lib/python3.12/site-packages/zigpy/application.py", line 833, in request
    await self.send_packet(
  File "/usr/local/lib/python3.12/site-packages/zigpy_znp/zigbee/application.py", line 959, in send_packet
    await self._send_request_raw(
  File "/usr/local/lib/python3.12/site-packages/zigpy_znp/zigbee/application.py", line 776, in _send_request_raw
    raise DeliveryError("Coordinator is disconnected, cannot send request")
zigpy.exceptions.DeliveryError: Coordinator is disconnected, cannot send request

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

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/zha/core/device.py", line 598, in async_configure
    await self.identify_ch.trigger_effect(
  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.12/contextlib.py", line 158, in __exit__
    self.gen.throw(value)
  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: Coordinator is disconnected, cannot send request

followed by (40 times):

Logger: frontend.js.latest.202402071
Source: components/system_log/__init__.py:306
First occurred: 12:21:19 PM (40 occurrences)
Last logged: 1:48:26 PM

Uncaught error from Firefox 123.0 on Windows 10 TypeError: this._clusterConfigurationStatuses is undefined _handleMessage (src/panels/config/integrations/integration-panels/zha/dialog-zha-reconfigure-device.ts:353:8) callbackFunction (src/data/zha.ts:200:61) callback (node_modules/home-assistant-js-websocket/dist/connection.js:23:33) forEach (node_modules/home-assistant-js-websocket/dist/connection.js:15:25)

can not add new devices via ZHA either.

puddly commented 8 months ago

Please fill out the issue template and include a list/screenshot of all your addons, custom components, and integrations.

issue-triage-workflows[bot] commented 5 months ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.