sebr / bhyve-home-assistant

Orbit BHyve custom component for Home Assistant
MIT License
250 stars 40 forks source link

ConnectionResetError: Cannot write to closing transport #156

Open meremortals70 opened 1 year ago

meremortals70 commented 1 year ago

Describe the bug System Error in HA Logs after installing 2022.9 beta

This error originated from a custom integration.

Logger: homeassistant Source: custom_components/bhyve/pybhyve/websocket.py:57 Integration: Orbit B-hyve (documentation) First occurred: 7:33:36 PM (1 occurrences) Last logged: 7:33:36 PM

Error doing job: Task exception was never retrieved

Traceback (most recent call last):
  File "/config/custom_components/bhyve/pybhyve/websocket.py", line 57, in _ping
    await self._ws.send_str(json.dumps({"event": "ping"}))
  File "/usr/local/lib/python3.10/site-packages/aiohttp/client_ws.py", line 151, in send_str
    await self._writer.send(data, binary=False, compress=compress)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/http_websocket.py", line 690, in send
    await self._send_frame(message, WSMsgType.TEXT, compress)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/http_websocket.py", line 601, in _send_frame
    raise ConnectionResetError("Cannot write to closing transport")
ConnectionResetError: Cannot write to closing transport

Please let me know if you need more. Can’t download the diagnostics on my iPad.

sebr commented 1 year ago

@meremortals70 sorry that I didn't follow up on this... lost track. Did this get resolved in a later version? I have never seen this issue.

SeeThisIsMe commented 1 year ago

I have had exactly the same issue for almost a year. Before that it worked fine. Still ongoing now with the latest version of HA and bhyve HACS integration.

I have 4 of the hose timer devices and always get this error with at least one of them every day. What happens is when the scheduled irrigation time comes around it start and then stops immediately with this error. If I then open the bhyve app it shows the watering working fine.

sebr commented 1 year ago

Are all the hose timers configured to start irrigating at the same time?

SeeThisIsMe commented 1 year ago

Nope. The water pressure is a bit low for more than one at a time. So the schedules are in a sequence with 5-6 minutes between when one finishes and the next one starts.

dinan5 commented 7 months ago

I have the same exact issue. Thank you.

AnthonyBe commented 2 months ago

I'm seeing this only on HA start-up (best I can tell). I'm currently running HA 2024.5.3 with Orbit integration v3.2.4. I have 3 x Gen 1 Orbit B-Hyve BT tap timers connected to a B-Hyve WiFi Hub.

2024-05-17 14:39:27.308 WARNING (MainThread) [custom_components.bhyve.pybhyve.websocket] Websocket exception: Cannot write to closing transport
2024-05-17 14:39:27.310 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/config/custom_components/bhyve/pybhyve/websocket.py", line 57, in _ping
    await self._ws.send_str(json.dumps({"event": "ping"}))
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client_ws.py", line 165, in send_str
    await self._writer.send(data, binary=False, compress=compress)
  File "/usr/local/lib/python3.12/site-packages/aiohttp/http_websocket.py", line 729, in send
    await self._send_frame(message, WSMsgType.TEXT, compress)
  File "/usr/local/lib/python3.12/site-packages/aiohttp/http_websocket.py", line 628, in _send_frame
    raise ConnectionResetError("Cannot write to closing transport")
ConnectionResetError: Cannot write to closing transport

Diagnostic file attached. config_entry-bhyve-5bc4b4819e8722eb2f3b99b8df98a730.json

dinan5 commented 1 month ago

Are there any updates on this issue? Thank you.

AnthonyBe commented 1 month ago

Oddly, I haven't see the error for a while (I'm now on HA 2024.6.4)

dinan5 commented 1 month ago

I'm still having the issue. I have three HA instances that all connect to 2 Orbit controllers. I'm wondering if its too much traffic. I'm experimenting by disabling some of the instances.