hass-unified-remote icon indicating copy to clipboard operation
hass-unified-remote copied to clipboard

HA connection pool exhausted if Unified Remote server device is in S0 (Modern Standby) sleep

Open rendaa opened this issue 1 month ago • 0 comments

I deployed HA docker container on a Synology NAS and used this integration to control my desktop PC to enter sleep mode (WOL is done by the HA official integration). It works fine on my old device, a Win7 PC with Unified Remote server installed.

Last week I bought a new PC with Win11 Home pre-installed, things went out of order.

The HA log reported a lot of connection pool exceeded errors. HA mobile client could not even to connect HA server (stuck in "loading data" interface). I had to SSH to NAS and tried to investigate in shell.

In brief, I used netstat and found many ESTABLISHed connection to PC's 9510 port, this exhausted HA connection pool.

This integration worked fine on the old PC, as Win7 uses S3 legacy standby. Port 9510 is down, so there won't be further attempts.

By default, Win11 uses S0 modern standby. I could get response when trying to ping the Win11 PC while it's in S0 standby. If try "nc -z destopIP 9510" it won't get any error. But If I tried some operations in an iPad UR client app, I got "socket closed by server" in client status.

I think this causes our UR integration stucking in waiting server response. Maybe you could add some codes to avoid establish new connections to the same server if there is a hanging one.

As a work-around, in Win11 I can disable the S0 mode by manuplating the win11 registry, e.g. running this in an elevated command window: reg add HKLM\System\CurrentControlSet\Control\Power /v PlatformAoAcOverride /t REG_DWORD /d 0

But IMHO, this issue should be dealed in this integration (and HA should at least give users a chance to connect from the HA client app to restart HA instead of having to do this via SSH).

I am gratefully appreciate this great integration as well as your work. Thank you!

rendaa avatar Jan 11 '25 04:01 rendaa