rstrouse / ESPSomfy-RTS

A controller for Somfy RTS shades and blinds
The Unlicense
442 stars 32 forks source link

ESPSomfy web page not loading properly #251

Closed ngroves08 closed 5 months ago

ngroves08 commented 5 months ago

Hardware

ESP32

Firmware version

v2.3.1

Application version

v2.3.1

What happened? What did you expect to happen?

When I navigate to the IP address of the ESP32, the ESPSomfy web page partially loads, before I get an (ESPSomfy) error message which says "Could not connect to server. Too many clients connected...." even though there is only one client connected.

The problem temporarily goes away after rebooting the ESP32, but returns after a period of time (maybe a few hours?)

This issues only appeared after upgrading to v2.3.0 from ~v1.7

Despite the issues with the web interface, I can still control the blinds via the Home Assistant interface.

How to reproduce it (setp by step)

1. Boot up ESP32
2. Wait a few hours
3. Navigate to IP Address of ESP32

Logs

No response

rstrouse commented 5 months ago

I will look to see if I can create a condition where this exists. If ESPSomfy RTS idle during this period or is it having activity like moving the shades or listening to a wind sensor?

Also I assume you are running an ESP32 not an ESP32-S3, C3, or S2, is that correct?

ngroves08 commented 5 months ago

Thanks

Re your questions:

Also, the device is on a VLAN that has no access to the outside internet. Not sure if that makes a difference or not

rstrouse commented 5 months ago

Also, the device is on a VLAN that has no access to the outside internet. Not sure if that makes a difference or not

@ngroves08 the last statement may make a difference but it shouldn't. I have read some issues with the ESP32 libraries that the HTTPClient libraries do not timeout like they are supposed to and ESPSomfy RTS is checking github to see if there is a new version available.

What is supposed to happen is that it checks to see if the site is up then bails after 3 seconds if there is no return. But I am guessing that this is not occurring based upon some reading. The reports are conflicting in that some say it works as it is supposed to and others claim that it never times out. I dill do some more investigation.

ngroves08 commented 5 months ago

Thanks @rstrouse

Re internet access, I tried giving the ESP32 internet access. It went from not responding (when it had no internet access) to responding as expected (as soon as it got internet access).

Baseje commented 5 months ago

Thanks @rstrouse

Re internet access, I tried giving the ESP32 internet access. It went from not responding (when it had no internet access) to responding as expected (as soon as it got internet access).

I've exactly the same issue, after dropping internet the ESP comes not responsive after amount of time.

rstrouse commented 5 months ago

Please ensure you have the absolute latest 2.3.2 pre-release and let me know the results. I added some connection negotiation timeouts. If this fails then the github check for update feature will die a painful death. For me this works when removing my internet connection but there are a ton of ways to disable the outbound and inbound packets. Some of which may confuse the ESP32 libraries.

ngroves08 commented 5 months ago

The new firmware seems to have fixed it. Updated this morning and web interface has been working properly ever since

Thanks!

Baseje commented 5 months ago

I've just flashed to the latest version and disabled internet access. I'll come back with my findings!

rstrouse commented 5 months ago

I am pretty sure we got to the root of this issue. I will be releasing a maintenance release v2.3.3 today to backfill a couple of other issues today. Mostly cosmetic minor issues.

TimelessNL commented 4 months ago

Also, the device is on a VLAN that has no access to the outside internet. Not sure if that makes a difference or not

I might think this is related, I was setting up my first SomfyRTS but after connecting it to my dedicated IoT network the device became unresponsive. it seems that the websocket ports are not correctly handled when being routed. afbeelding For testing I put my client device on the 192.168.5.0/24 subnet while the SomfyRTS is on 192.168.255.0/24 with no firewall restrictions between the 2 subnets, when I try to access the SomfyRTS from within the same subnet everything works like expected, even without internet access on that subnet. But when routed it only loads the HTTP content.

For what it's worth, I'm using v2.4.0.

EDIT: Looking at the network traffic it seems the ESP is replying with an ICMP unreachable on the websocket requests?

11:41:21.681495 IP 192.168.5.124.52694 > 192.168.255.239.8080: Flags [S], seq 2568804642, win 64240, options [mss 1460,nop,wscale 8,nop,nop,sackOK], length 0
11:41:21.922663 IP 192.168.5.124.52696 > 192.168.255.239.8080: Flags [S], seq 2633301395, win 64240, options [mss 1460,nop,wscale 8,nop,nop,sackOK], length 0
11:41:24.806271 IP 192.168.255.239 > 192.168.5.124: ICMP host 192.168.255.239 unreachable, length 60
11:41:24.806427 IP 192.168.255.239 > 192.168.5.124: ICMP host 192.168.255.239 unreachable, length 60

EDIT2: As a test to confirm if it might be routing related I masqueraded the traffic to the SomfyRTS by adding 2 NAT rules like so: afbeelding This made the webinterface work: afbeelding