onlyoneme / home-assistant-custom-components-wiim

WiiM devices integration for Home Assistant.
50 stars 8 forks source link

Error when calling play_url: ClientOSError #4

Open xfiber opened 1 year ago

xfiber commented 1 year ago

Hi, I am trying to use your integration with Arylic Up2Stream HD DAC. Firmware: 4.6.414645.35

When ever I am calling:

service: wiim_custom.play_url data: entity_id: media_player.living_room url: http://radiostream.pl/tuba10-1.mp3

I get this error originated from a custom integration:

Logger: custom_components.wiim_custom.media_player Source: custom_components/wiim_custom/media_player.py:393 Integration: WiiM (documentation, issues) First occurred: 18:49:56 (465 occurrences) Last logged: 20:05:06

Failed communicating with WiiM (httpapi) 'Living Room': <class 'aiohttp.client_exceptions.ClientOSError'>

Do we need to "fake" client OS ?

Best regards, Bartek

onlyoneme commented 1 year ago

I'm sorry, but my component is going to work only with WiiM Mini (and Pro probably). I've no idea if it can work with other Linkplay modules and I have no way to test it. Does your device need http or https communication?

xfiber commented 1 year ago

Seems like device needs https communication (but not sure 100%) When ever I try to call a service I get this error about Client OS. However, when I start a live stream from 4Stream app it updates properly on HA. See below.

Screenshot 2022-12-11 at 20 26 17
onlyoneme commented 1 year ago

Does it respond to that:

https:///httpapi.asp?command=getStatusEx

when executed in the web browser?

xfiber commented 1 year ago

This is an output from curl:

curl -vk "https://192.168.88.70/httpapi.asp?command=getStatusEx"
*   Trying 192.168.88.70:443...
* Connected to 192.168.88.70 (192.168.88.70) port 443 (#0)
* ALPN: offers h2
* ALPN: offers http/1.1
* (304) (OUT), TLS handshake, Client hello (1):
* (304) (IN), TLS handshake, Server hello (2):
* (304) (IN), TLS handshake, Unknown (8):
* (304) (IN), TLS handshake, Request CERT (13):
* (304) (IN), TLS handshake, Certificate (11):
* (304) (IN), TLS handshake, CERT verify (15):
* (304) (IN), TLS handshake, Finished (20):
* (304) (OUT), TLS handshake, Certificate (11):
* (304) (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / AEAD-CHACHA20-POLY1305-SHA256
* ALPN: server did not agree on a protocol. Uses default.
* Server certificate:
*  subject: C=CN; ST=Shanghai; L=Shanghai; O=linkplay; OU=linkplay; CN=www.linkplay.com; emailAddress=mail@linkplay.com
*  start date: Nov 14 12:24:18 2018 GMT
*  expire date: Nov 11 12:24:18 2028 GMT
*  issuer: C=CN; ST=Shanghai; L=Shanghai; O=linkplay; OU=linkplay; CN=www.linkplay.com; emailAddress=mail@linkplay.com
*  SSL certificate verify result: self signed certificate (18), continuing anyway.
> GET /httpapi.asp?command=getStatusEx HTTP/1.1
> Host: 192.168.88.70
> User-Agent: curl/7.84.0
> Accept: */*
> 
* LibreSSL SSL_read: error:1404C45C:SSL routines:ST_OK:reason(1116), errno 0
* Closing connection 0
curl: (56) LibreSSL SSL_read: error:1404C45C:SSL routines:ST_OK:reason(1116), errno 0
onlyoneme commented 1 year ago

So it seems to listen on 443 port just like Mini.

Can you verify if those commands are working with your device?

https://www.wiimhome.com/pdf/HTTP%20API%20for%20WiiM%20Mini.pdf

And even more important here, what about that

http://192.168.88.70:49152/description.xml

?

xfiber commented 1 year ago

All of them are ending up with the same error:

***   Trying 192.168.88.70:443...
* Connected to 192.168.88.70 (192.168.88.70) port 443 (#0)
* ALPN: offers h2
* ALPN: offers http/1.1
* (304) (OUT), TLS handshake, Client hello (1):
* (304) (IN), TLS handshake, Server hello (2):
* (304) (IN), TLS handshake, Unknown (8):
* (304) (IN), TLS handshake, Request CERT (13):
* (304) (IN), TLS handshake, Certificate (11):
* (304) (IN), TLS handshake, CERT verify (15):
* (304) (IN), TLS handshake, Finished (20):
* (304) (OUT), TLS handshake, Certificate (11):
* (304) (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / AEAD-CHACHA20-POLY1305-SHA256
* ALPN: server did not agree on a protocol. Uses default.
* Server certificate:
*  subject: C=CN; ST=Shanghai; L=Shanghai; O=linkplay; OU=linkplay; CN=www.linkplay.com; emailAddress=mail@linkplay.com
*  start date: Nov 14 12:24:18 2018 GMT
*  expire date: Nov 11 12:24:18 2028 GMT
*  issuer: C=CN; ST=Shanghai; L=Shanghai; O=linkplay; OU=linkplay; CN=www.linkplay.com; emailAddress=mail@linkplay.com
*  SSL certificate verify result: self signed certificate (18), continuing anyway.
> GET /httpapi.asp?command=EQGetStat HTTP/1.1
> Host: 192.168.88.70
> User-Agent: curl/7.84.0
> Accept: */*
> 
*** LibreSSL SSL_read: error:1404C45C:SSL routines:ST_OK:reason(1116), errno 0**
* Closing connection 0
curl: (56) LibreSSL SSL_read: error:1404C45C:SSL routines:ST_OK:reason(1116), errno 0**
onlyoneme commented 1 year ago

It will not work if those command are not accepted, sorry...

What about similar commands but on http / 80 port?

xfiber commented 1 year ago

Unfortunately port 80 is refused. Such a pity it will not work :(

curl -vk "http://192.168.88.70/httpapi.asp?command=getPlayerStatus"                                     
*   Trying 192.168.88.70:80...
* connect to 192.168.88.70 port 80 failed: Connection refused
* Failed to connect to 192.168.88.70 port 80 after 12 ms: Connection refused
* Closing connection 0
curl: (7) Failed to connect to 192.168.88.70 port 80 after 12 ms: Connection refused
xfiber commented 1 year ago

Found something on arylic forum, indeed it does not support any http(s) apis. Only upnp is supported. https://forum.arylic.com/t/up2stream-hd-dac-http-get/1703?replies_to_post_number=3

onlyoneme commented 1 year ago

So it won't work with nagyrobi's Linkplay module at all, but can be partially controlled by my module. Does it respond to player commands from HA interface? Does it reflect your streamer status when you play audio files?

xfiber commented 1 year ago

It does not respond to Stop/start. I've only tried calling service.

onlyoneme commented 1 year ago

So no public httpapi support indeed. A beta version of my module should handle your device a bit better as it uses upnp purely to get the current player status, but still no control is possible. I do not have plans to move completely from httpapi to upnp, sorry.

xfiber commented 1 year ago

I've installed latest beta version and indeed I get current player status. No problem. I will most likely switch to older Arylic devices to make my integration work. Arylic even does not give any info about upnp inegration at this time. https://developer.arylic.com/docs/