Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't join Audio Pro devices in a LinkPlay group #130172

Closed
ccristal opened this issue Nov 8, 2024 · 6 comments · Fixed by #132091
Closed

Can't join Audio Pro devices in a LinkPlay group #130172

ccristal opened this issue Nov 8, 2024 · 6 comments · Fixed by #132091

Comments

@ccristal
Copy link

ccristal commented Nov 8, 2024

The problem

I have an Audio Pro C3. Its API can be invoked via http (not https). The Linkplay integration is able to discover and configure it, but it can't join it to a group with a master device with an API accessible via https (like a Wiim Pro).
This is the error message I get when I try to add my Audio Pro C3 as a satellite speaker to a Wiim Pro master:

File "/usr/local/lib/python3.12/site-packages/linkplay/utils.py", line 49, in session_call_api
    raise LinkPlayRequestException(
linkplay.exceptions.LinkPlayRequestException: Cannot connect to host 192.168.1.47:443 ssl:default [Connect call failed ('192.168.1.47', 443)] error requesting data from 'https://192.168.1.47/httpapi.asp?command=ConnectMasterAp:JoinGroupMaster:eth0.0.0.0:wifi0.0.0.0'

The device on 192.168.1.47 is the Audio Pro device, so the protocol should be http.

What version of Home Assistant Core has the issue?

core-2024.11.0

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Linkplay

Link to integration documentation on our website

https://www.home-assistant.io/integrations/linkplay/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

File "/usr/local/lib/python3.12/site-packages/linkplay/utils.py", line 49, in session_call_api
    raise LinkPlayRequestException(
linkplay.exceptions.LinkPlayRequestException: Cannot connect to host 192.168.1.47:443 ssl:default [Connect call failed ('192.168.1.47', 443)] error requesting data from 'https://192.168.1.47/httpapi.asp?command=ConnectMasterAp:JoinGroupMaster:eth0.0.0.0:wifi0.0.0.0'
2024-11-17 10:34:36.884 DEBUG (MainThread) [linkplay] Request command at https://192.168.1.47: ConnectMasterAp:JoinGroupMaster:eth0.0.0.0:wifi0.0.0.0
2024-11-17 10:34:37.385 DEBUG (MainThread) [linkplay] Request command at https://192.168.1.173: ConnectMasterAp:JoinGroupMaster:eth0.0.0.0:wifi0.0.0.0
2024-11-17 10:34:37.679 DEBUG (MainThread) [linkplay] Request multiroom:getSlaveList at https://192.168.1.177
2024-11-17 10:34:37.804 DEBUG (MainThread) [linkplay] Response multiroom:getSlaveList: {'slaves': 0, 'wmrm_version': '4.2'}
Logger: homeassistant.components.linkplay.config_flow
Source: components/linkplay/config_flow.py:38
integration: LinkPlay (documentation, issues)
First occurred: 00:00:58 (2 occurrences)
Last logged: 00:01:18

Failed to connect to LinkPlay device at fd00::1:222:6cff:fe2a:7ec7
Failed to connect to LinkPlay device at fd00::1:222:6cff:feb8:e7b2
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/yarl/_parse.py", line 134, in split_netloc
    port = int(port_str)
           ^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: ':1:222:6cff:fe2a:7ec7'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 516, in _request
    url = self._build_url(str_or_url)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 444, in _build_url
    url = URL(str_or_url)
          ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/yarl/_url.py", line 307, in __new__
    return pre_encoded_url(val) if encoded else encode_url(val)
                                                ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/yarl/_url.py", line 154, in encode_url
    username, password, host, port = split_netloc(netloc)
                                     ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/yarl/_parse.py", line 136, in split_netloc
    raise ValueError("Invalid URL: port can't be converted to integer")
ValueError: Invalid URL: port can't be converted to integer

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/linkplay/utils.py", line 46, in session_call_api
    response = await session.get(url)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 518, in _request
    raise InvalidUrlClientError(str_or_url) from e
aiohttp.client_exceptions.InvalidUrlClientError: https://fd00::1:222:6cff:fe2a:7ec7/httpapi.asp?command=getStatusEx

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/linkplay/discovery.py", line 55, in linkplay_factory_httpapi_bridge
    return await linkplay_factory_bridge_endpoint(https_endpoint)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/linkplay/discovery.py", line 39, in linkplay_factory_bridge_endpoint
    await bridge.device.update_status()
  File "/usr/local/lib/python3.12/site-packages/linkplay/bridge.py", line 44, in update_status
    self.properties = await self.bridge.json_request(LinkPlayCommand.DEVICE_STATUS)  # type: ignore[assignment]
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/linkplay/bridge.py", line 329, in json_request
    response = await self.endpoint.json_request(command)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/linkplay/endpoint.py", line 51, in json_request
    return await session_call_api_json(self._endpoint, self._session, command)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/linkplay/utils.py", line 79, in session_call_api_json
    result = await session_call_api(endpoint, session, command)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/linkplay/utils.py", line 49, in session_call_api
    raise LinkPlayRequestException(
linkplay.exceptions.LinkPlayRequestException: https://fd00::1:222:6cff:fe2a:7ec7/httpapi.asp?command=getStatusEx error requesting data from 'https://fd00::1:222:6cff:fe2a:7ec7/httpapi.asp?command=getStatusEx'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/yarl/_parse.py", line 134, in split_netloc
    port = int(port_str)
           ^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: ':1:222:6cff:fe2a:7ec7'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 516, in _request
    url = self._build_url(str_or_url)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 444, in _build_url
    url = URL(str_or_url)
          ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/yarl/_url.py", line 307, in __new__
    return pre_encoded_url(val) if encoded else encode_url(val)
                                                ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/yarl/_url.py", line 154, in encode_url
    username, password, host, port = split_netloc(netloc)
                                     ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/yarl/_parse.py", line 136, in split_netloc
    raise ValueError("Invalid URL: port can't be converted to integer")
ValueError: Invalid URL: port can't be converted to integer

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/linkplay/utils.py", line 46, in session_call_api
    response = await session.get(url)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 518, in _request
    raise InvalidUrlClientError(str_or_url) from e
aiohttp.client_exceptions.InvalidUrlClientError: http://fd00::1:222:6cff:fe2a:7ec7/httpapi.asp?command=getStatusEx

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/linkplay/config_flow.py", line 38, in async_step_zeroconf
    bridge = await linkplay_factory_httpapi_bridge(discovery_info.host, session)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/linkplay/discovery.py", line 60, in linkplay_factory_httpapi_bridge
    return await linkplay_factory_bridge_endpoint(http_endpoint)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/linkplay/discovery.py", line 39, in linkplay_factory_bridge_endpoint
    await bridge.device.update_status()
  File "/usr/local/lib/python3.12/site-packages/linkplay/bridge.py", line 44, in update_status
    self.properties = await self.bridge.json_request(LinkPlayCommand.DEVICE_STATUS)  # type: ignore[assignment]
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/linkplay/bridge.py", line 329, in json_request
    response = await self.endpoint.json_request(command)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/linkplay/endpoint.py", line 51, in json_request
    return await session_call_api_json(self._endpoint, self._session, command)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/linkplay/utils.py", line 79, in session_call_api_json
    result = await session_call_api(endpoint, session, command)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/linkplay/utils.py", line 49, in session_call_api
    raise LinkPlayRequestException(
linkplay.exceptions.LinkPlayRequestException: http://fd00::1:222:6cff:fe2a:7ec7/httpapi.asp?command=getStatusEx error requesting data from 'http://fd00::1:222:6cff:fe2a:7ec7/httpapi.asp?command=getStatusEx'
Logger: homeassistant.components.media_player
Source: components/media_player/__init__.py:1371
integration: Media Player (documentation, issues)
First occurred: 17 November 2024 at 23:42:34 (2 occurrences)
Last logged: 17 November 2024 at 23:42:46

Error retrieving proxied image from http://192.168.1.47:49152/un_known
Error retrieving proxied image from http://192.168.1.173:49152/un_known

Additional information

No response

@home-assistant
Copy link

home-assistant bot commented Nov 8, 2024

Hey there @Velleman, mind taking a look at this issue as it has been labeled with an integration (linkplay) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of linkplay can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign linkplay Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


linkplay documentation
linkplay source
(message by IssueLinks)

@ccristal
Copy link
Author

ccristal commented Nov 9, 2024

I have already rolled back to nagyrobi's custom integration because of this issue, but I can restore the configuration with the new integration if it helps reproducing the problem and getting it fixed more quickly.

@silamon
Copy link
Contributor

silamon commented Nov 10, 2024

I've tested this case specifically when adding multiroom, but it appears that there are still some bugs here in gathering the leader of the multiroom. I haven't seen this bug specifically in the same way you mentioned, but I'll fix the other bugs and try to add it the next release and see if it fixes it along the way.

@ccristal
Copy link
Author

I've tested this case specifically when adding multiroom, but it appears that there are still some bugs here in gathering the leader of the multiroom. I haven't seen this bug specifically in the same way you mentioned, but I'll fix the other bugs and try to add it the next release and see if it fixes it along the way.

Again, happy to do some testing for you if it helps...

@silamon
Copy link
Contributor

silamon commented Nov 11, 2024

If you don't mind, I would appreciate it if you could test since I don't think I have found the issue thus far. You can wait if you want until 2024.11.2 is released, since some multiroom fixes are planned to be fixed there.

The command "ConnectMasterAp:JoinGroupMaster:eth0.0.0.0:wifi0.0.0.0" should list the real ethernet address in there, that's also not happening and should be fixed in 2024.11.2.

Just like in the other issue:
The integration is capable of detecting the correct protocol (either 80 and 443) and will even attempt to accept the LinkPlay certificate. On the latest home assistant version (2024.11.0+ or 2024.11.2), you can enable debug logging to get more information.

@ccristal
Copy link
Author

ccristal commented Nov 17, 2024

Hi! I have now installed 2024.11.2, and the issue still exists. I have added the relevant log messages (or at least what I think is relevant) to the main issue description.

177 is my main device (Wiim Pro), 47 and 173 are the satellites (Audio Pro Addon C3) (we don't use "master" and "slave" anymore here... ;-) ).

So, the action completes but nothing is actually linked.

Hope this helps. Thanks for looking into this...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants