cgiesche/streamdeck-homeassistant

failed to connect with version 3.5.1 / 2.4.5 works

Closed this issue · 8 comments

hello,

have have the problem that the new version of the plugin i get this error failed to connect to ws://ip:8123/api/websocket

please help thanks

Hi, thanks for the awesome plugin.
Unfortunately it recently also stopped working for me with the same error message: "Failed to connect to ws://ip:8123/api/websocket" where ip is my internal ip. I can reach the webinterface in Firefox from the same machine. I restarted mac/elgato, tried to create a new token, etc. So far no luck getting the plugin to work again.
Because i have no idea of this i also tried opening the websocket in firefox to test general connection, which returns:
No WebSocket UPGRADE hdr: None
Can "Upgrade" only to "WebSocket".

I run on Mac/latest OS (Sequoia).
As the error message in the plugin is quite limited i dont know where to search for errors or debug this. Let me know if you have any directions :-)

Hi,

there is a way to get more detailed logs. On MacOS it should work like this (can not test, because i do not own a mac device):

  1. Run the following command in the terminal. It enables debugging of the stream-deck application:
    defaults write com.elgato.StreamDeck html_remote_debugging_enabled -bool YES
  2. Restart stream-deck application
  3. Point your browser to http://localhost:23654/
    grafik
  4. Select "PI" or "Plugin" to debug either Settings or the plugin itself. There, you have access to all log output and network activity:
    grafik

PS. It seems that elgato has improved their Plugin API. When I find the time to migrate my plugin, it should be much easier to debug...

In the debug console I see:

WebSocket connection to 'ws://<my_ha_ip>:8123/api/websocket' failed: Error in connection establishment: net::ERR_ADDRESS_UNREACHABLE

From the command line on my Mac:

➜  ~ curl -vv  "http://<my_ha_ip>:8123/api/websocket" 
*   Trying <my_ha_ip>:8123...
* Connected to <my_ha_ip> (<my_ha_ip>) port 8123
> GET /api/websocket HTTP/1.1
> Host: <my_ha_ip>:8123
> User-Agent: curl/8.7.1
> Accept: */*
> 
* Request completely sent off
< HTTP/1.1 400 Bad Request
< Content-Type: text/plain; charset=utf-8
< Referrer-Policy: no-referrer
< X-Content-Type-Options: nosniff
< Server: 
< X-Frame-Options: SAMEORIGIN
< Content-Length: 66
< Date: Tue, 26 Nov 2024 01:06:17 GMT
< 
No WebSocket UPGRADE hdr: None
* Connection #0 to host <my_ha_ip>left intact
 Can "Upgrade" only to "WebSocket".% 

I see the exact same problem on my machine. If I use wscat, it outputs this:

Connected (press CTRL+C to quit)
< {"type":"auth_required","ha_version":"2024.11.3"}

The connection itself works, but not with the streamdeck plugin.

I tracked this down to what appears to be a change in recent OS X security settings. On my system, Elgato Stream Deck was disallowed access to the local network, see System Settings > Privacy and Security > Local Network. Once I enabled it, the plugin works again.

Image

Awesome, thanks for your efforts @zerowidth

I tracked this down to what appears to be a change in recent OS X security settings. On my system, Elgato Stream Deck was disallowed access to the local network, see System Settings > Privacy and Security > Local Network. Once I enabled it, the plugin works again.

Image

Awesome, that worked for me. Thanks @zerowidth

Brilliant ! Many thanks @zerowidth, it was simple but I didn't think about it.