Skip to content

No attempts to reconnect after OSError #176

@andreondra

Description

@andreondra

At first, I would like you to thank you for this amazing integration! Most of the time it works really well. However, I stumbled across this one issue.

Sometimes the JA-80T module disconnects -- the OSError and/or PermissionError exception is raised:

2024-05-05 22:19:56.061 ERROR (ThreadPoolExecutor-0_0) [custom_components.jablotron80] Unexpected error: %s
Traceback (most recent call last):
  File "/home/homeassistant/.homeassistant/custom_components/jablotron80/jablotron.py", line 842, in _read_data
    data = self._connection.read(64)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [Errno 5] Input/output error

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/homeassistant/.homeassistant/custom_components/jablotron80/jablotron.py", line 749, in read_send_packet_loop
    records = self._read_data()
              ^^^^^^^^^^^^^^^^^
  File "/home/homeassistant/.homeassistant/custom_components/jablotron80/jablotron.py", line 844, in _read_data
    self.reconnect()
  File "/home/homeassistant/.homeassistant/custom_components/jablotron80/jablotron.py", line 694, in reconnect
    self.connect()
  File "/home/homeassistant/.homeassistant/custom_components/jablotron80/jablotron.py", line 828, in connect
    self._connection = open(self._device, 'w+b',buffering=0)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: '/dev/jablocom'
2024-05-05 22:19:56.067 ERROR (ThreadPoolExecutor-0_0) [custom_components.jablotron80] Not connected to JA80, abort

However, after the module reconnects again, the integration does not attempt to resume connection, HA restart is needed. Also, as described in #97, the values remain stuck instead of reporting as unavailable. Overall, this is probably similar to the #165, maybe better exception handling is needed?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions