Home_Assistant_NeoSmartBlinds icon indicating copy to clipboard operation
Home_Assistant_NeoSmartBlinds copied to clipboard

Blinds no longer controllable - Server disconnected / Connection Reset By Peer

Open markdesouza opened this issue 1 year ago • 3 comments

HI, The integration was working perfectly until I rebooted to upgrade to 2024.11.1. Now all the blind entities show up, but when clicking on the up/down buttons, blinds do not respond.

Looking at the logs I see: 2024-11-30 07:37:58.885 ERROR (MainThread) [custom_components.neosmartblinds.neo_smart_blind] Parameters: {'id': '<REDACTED>', 'command': '<REDACTED>', 'hash': '<REDACTED>'} 2024-11-30 07:37:58.885 ERROR (MainThread) [custom_components.neosmartblinds.neo_smart_blind] URL: http://192.168.5.15:8838/neo/v1/transmit 2024-11-30 07:37:58.886 ERROR (MainThread) [custom_components.neosmartblinds.neo_smart_blind] Server disconnected 2024-11-30 07:40:00.691 ERROR (MainThread) [custom_components.neosmartblinds.neo_smart_blind] Parameters: {'id': '<REDACTED>', 'command': '<REDACTED>', 'hash': '<REDACTED>'} 2024-11-30 07:40:00.691 ERROR (MainThread) [custom_components.neosmartblinds.neo_smart_blind] URL: http://192.168.5.15:8838/neo/v1/transmit 2024-11-30 07:40:00.691 ERROR (MainThread) [custom_components.neosmartblinds.neo_smart_blind] [Errno 104] Connection reset by peer

When I ssh into home assistant, it appears the curl can not connect to the hub: [core-ssh ~]$ curl http://192.168.5.15:8838/neo/v1/transmit curl: (56) Recv failure: Connection reset by peer

The hub is definitely up and connected to wifi: [core-ssh ~]$ ping 192.168.5.15 PING 192.168.5.15 (192.168.5.15): 56 data bytes 64 bytes from 192.168.5.15: seq=0 ttl=254 time=44.554 ms

Most curiously, logging into the neoblind app, I am able to control all the blinds, perfectly.

The last time this occurred (few weeks ago), I finally got it working after rebooting home assistant and the hub multiple times. Both the hub and the home assistant have static ips set and the wifi signal strength is strong according to unifi.

My random thoughts:

  • Does the neoblind app use the same http api? If it doesn't perhaps something is happening to the endpoint on the hub. Either a general firmware bug or because the integration might not prior close connections (or something like that)
  • I notice there is a hash included in the api request, is this api time dependant? Could there be clock drift between the hub/home assistant. The time in home assistant looks correct when compared to my macbook.

Thanks in advance, Mark

markdesouza avatar Nov 29 '24 21:11 markdesouza

So the integration is working again. All I did was upgrade to 11.3

The hub responds differently to curl requests when working: [core-ssh ~]$ curl http://192.168.5.15:8839/neo/v1/transmit curl: (1) Received HTTP/0.9 when not allowed

Not sure how having home assistant update can make the hub respond differently via curl. The only think I can think of is that the connections are being left open and eventually the hub runs out of http connections.

markdesouza avatar Dec 01 '24 00:12 markdesouza

I have some digging around and because I have 10 blinds, I suspect the issue relates to connections either being not closed or kept alive after the connection has been closed on one side.

I suspect changing line 294 in cover.py / http_session_factory from: self.home_assistant.data[DATA_NEOSMARTBLINDS] = aiohttp.ClientSession(timeout=t) to: self.home_assistant.data[DATA_NEOSMARTBLINDS] = aiohttp.ClientSession(timeout=t, force_close=True)

will fix this issue.

markdesouza avatar Dec 01 '24 00:12 markdesouza

@markdesouza Hi, did you by any chance figure out the issue? I am having same issue and tried adding force_close=True, but still no luck. exact same error (Connection Reset by Peer). Blinds respond when using the Neo app, just no longer work with HA.

Raul-7-7 avatar Jan 12 '25 21:01 Raul-7-7

I'm facing the same issue, the integration works for a time (not long) and then just becomes unresponsive.

Manually triggering and open or close also shows nothing in the logs after this issue occurs.

This error originated from a custom integration.

Logger: custom_components.neosmartblinds.neo_smart_blind
Source: custom_components/neosmartblinds/neo_smart_blind.py:135
integration: NeoSmartBlinds (documentation, issues)
First occurred: 7:00:00 AM (2 occurrences)
Last logged: 7:00:01 AM

xxx.yyy-02, disconnected from hub: ConnectionResetError(104, 'Connection reset by peer')
xxx.yyy-03, disconnected from hub: ConnectionResetError(104, 'Connection reset by peer')

GrantDG avatar Mar 16 '25 21:03 GrantDG

I'm facing the same issue, the integration works for a time (not long) and then just becomes unresponsive.

Manually triggering and open or close also shows nothing in the logs after this issue occurs.

This error originated from a custom integration.

Logger: custom_components.neosmartblinds.neo_smart_blind
Source: custom_components/neosmartblinds/neo_smart_blind.py:135
integration: NeoSmartBlinds (documentation, issues)
First occurred: 7:00:00 AM (2 occurrences)
Last logged: 7:00:01 AM

xxx.yyy-02, disconnected from hub: ConnectionResetError(104, 'Connection reset by peer')
xxx.yyy-03, disconnected from hub: ConnectionResetError(104, 'Connection reset by peer')

A bit of an update on this, I've subsequently attempted a direct call (via PostMan) to the hub, and am receiving the same error message. So, it seems that it's the controller that is having an issue.

I'm going to do some investigation to try and work out if the issue occurs when HA is not configured to access this particular controller (i.e. is the integration somehow 'breaking' the controller, or is the controller itself just a little flaky)

GrantDG avatar Mar 16 '25 21:03 GrantDG

Yes the hub seems to fall over after certain number requests. I didn't really have the time to debug the issue so I simply plugged the hub into a smart switch and scheduled it to power off/on once a week. Haven't had an issue since.

markdesouza avatar Mar 17 '25 02:03 markdesouza

I have some digging around and because I have 10 blinds, I suspect the issue relates to connections either being not closed or kept alive after the connection has been closed on one side.

I suspect changing line 294 in cover.py / http_session_factory from: self.home_assistant.data[DATA_NEOSMARTBLINDS] = aiohttp.ClientSession(timeout=t) to: self.home_assistant.data[DATA_NEOSMARTBLINDS] = aiohttp.ClientSession(timeout=t, force_close=True)

will fix this issue.

An update on this. I applied this change 2 weeks ago, and my blinds have had no issues since.

GrantDG avatar Mar 31 '25 21:03 GrantDG

Been having this issue for months and thought it was something I've been doing wrong. I'll try the cover.py edit recommended above but hope there is an update to this add on to officially fix it

ZainAjam avatar Apr 21 '25 14:04 ZainAjam

I tried the line 294 change but it caused by blinds to not be detected at all after home assistant reboot.

Also, I've noticed that when the controller stops responding to home assistant, there are two manual workarounds:

  1. Reboot the controller device, or
  2. Open the neo smart blinds app and trigger an action on the controller for any blind and then the controller will work with home assistant again

ZainAjam avatar Apr 21 '25 15:04 ZainAjam

@mtgeekman sounds like this issue 55 is the same as issues 53 and 58

ZainAjam avatar Apr 21 '25 15:04 ZainAjam

Yes the hub seems to fall over after certain number requests. I didn't really have the time to debug the issue so I simply plugged the hub into a smart switch and scheduled it to power off/on once a week. Haven't had an issue since.

Wish this helped me. I have it on a smart switch, but it stops working within a few hours of a reboot and it isn't feasible to reboot the controller few minutes. It can't be healthy for the controller

ZainAjam avatar Apr 21 '25 15:04 ZainAjam