core icon indicating copy to clipboard operation
core copied to clipboard

Linkplay device will not seek or power off/idle

Open Joe31388 opened this issue 1 year ago • 12 comments

The problem

I'm unable to seek from a service call. Also, the power button doesn't work to make a player go idle.

What version of Home Assistant Core has the issue?

2024.8.3

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

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

Joe31388 avatar Sep 21 '24 04:09 Joe31388

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)

home-assistant[bot] avatar Sep 21 '24 09:09 home-assistant[bot]

Hi @Joe31388

We use GitHub for tracking issues with Home Assistant Core itself, not for providing support - so if you could provide more details like logs or any other helpful diagnostics data or error details or steps how to reproduce or your configuration, than we can handle it as an issue report, else it is a support request and you should try our Community Forum or join our Discord chat server.

Thanks! 👍

mib1185 avatar Sep 21 '24 09:09 mib1185

I am not OP, but using a Wiim Amp have the same issue. The status will never say "playing", there is no "wifi" source option (related?) and there is no seek or power option on the device page: Screenshot_20240923_103628

And when using a UI media player interface with a power option, clicking it gives this error:

Screenshot_20240923_103454

Borrower543 avatar Sep 23 '24 14:09 Borrower543

This error shows up when trying to seek.

Update for media_player.bathroom_speakers fails Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/linkplay/utils.py", line 48, in session_call_api response = await session.get(url) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 657, in _request conn = await self._connector.connect( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 564, in connect proto = await self._create_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 975, in _create_connection _, proto = await self._create_direct_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1319, in _create_direct_connection transp, proto = await self._wrap_create_connection( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1080, in _wrap_create_connection return await self._loop.create_connection(*args, **kwargs, sock=sock) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1149, in create_connection transport, protocol = await self._create_connection_transport( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1182, in _create_connection_transport await waiter asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/linkplay/utils.py", line 47, in session_call_api async with async_timeout.timeout(API_TIMEOUT): File "/usr/local/lib/python3.12/site-packages/async_timeout/init.py", line 141, in aexit self._do_exit(exc_type) File "/usr/local/lib/python3.12/site-packages/async_timeout/init.py", line 228, in _do_exit raise asyncio.TimeoutError TimeoutError

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

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/linkplay/media_player.py", line 130, in _wrap return await func(self, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/linkplay/media_player.py", line 174, in async_update await self._bridge.player.update_status() File "/usr/local/lib/python3.12/site-packages/linkplay/bridge.py", line 86, in update_status properties: dict[PlayerAttribute, str] = await self.bridge.json_request( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/linkplay/bridge.py", line 261, in json_request return await self.endpoint.json_request(command) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/linkplay/endpoint.py", line 44, 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 67, 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 51, in session_call_api raise LinkPlayRequestException( linkplay.exceptions.LinkPlayRequestException: error requesting data from 'https://192.168.150.116/httpapi.asp?command=getPlayerStatusEx'

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

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 942, in async_update_ha_state await self.async_device_update() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1300, in async_device_update await self.async_update() File "/usr/src/homeassistant/homeassistant/components/linkplay/media_player.py", line 132, in _wrap raise HomeAssistantError( homeassistant.exceptions.HomeAssistantError: Exception occurred when communicating with API <function LinkPlayMediaPlayerEntity.async_update at 0x7f0ecef36980>: error requesting data from 'https://192.168.150.116/httpapi.asp?command=getPlayerStatusEx'

Joe31388 avatar Sep 24 '24 21:09 Joe31388

I'm trying to get diagnostics added to the integration so this can be further diagnosed.

silamon avatar Sep 26 '24 19:09 silamon

Could you share the output of http(s)://<ip>/httpapi.asp?command=getPlayerStatusEx when the device reports "Idle" in Home Assistant? Based on the device, it may be http or https.

Just as a note:

  • Support for the stop/power off has been added just today.
  • Seek options are only available when it reports playing, for some reason it says "idle".
  • The wifi option is missing. I see some implementations add this by default.
  • It should be smart enough to check upon start if the player supports http or https. I'm not sure why it throws errors there.

silamon avatar Sep 27 '24 17:09 silamon

Could you share the output of http(s):///httpapi.asp?command=getPlayerStatusEx when the device reports "Idle" in Home Assistant? Based on the device, it may be http or https.

404: Not Found

Borrower543 avatar Sep 29 '24 16:09 Borrower543

Just noticed this in the logs too:

Update for media_player.kitchen_stereo_linkplay fails

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 942, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1300, in async_device_update
    await self.async_update()
  File "/usr/src/homeassistant/homeassistant/components/linkplay/media_player.py", line 130, in _wrap
    return await func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/linkplay/media_player.py", line 175, in async_update
    self._update_properties()
  File "/usr/src/homeassistant/homeassistant/components/linkplay/media_player.py", line 266, in _update_properties
    self._attr_source = SOURCE_MAP.get(self._bridge.player.play_mode, "other")
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/linkplay/bridge.py", line 227, in play_mode
    return PlayingMode(
           ^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/enum.py", line 757, in __call__
    return cls.__new__(cls, value)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/enum.py", line 1171, in __new__
    raise ve_exc
ValueError: '32' is not a valid PlayingMode

Borrower543 avatar Sep 29 '24 16:09 Borrower543

Could you share the output of http(s):///httpapi.asp?command=getPlayerStatusEx when the device reports "Idle" in Home Assistant? Based on the device, it may be http or https.

Just as a note:

  • Support for the stop/power off has been added just today.
  • Seek options are only available when it reports playing, for some reason it says "idle".
  • The wifi option is missing. I see some implementations add this by default.
  • It should be smart enough to check upon start if the player supports http or https. I'm not sure why it throws errors there.

Not sure what your are asking. When I enter this address in my browser with the speaker ip I get a bad cert error.

Joe31388 avatar Oct 01 '24 03:10 Joe31388

I'll wait for the debugging and diagnostics to be added, which will probably land in 2024.11.0.

If you want to try another attempt:

http://<ip>/httpapi.asp?command=getPlayerStatus https://<ip>/httpapi.asp?command=getPlayerStatus http://<ip>/httpapi.asp?command=getPlayerStatusEx https://<ip>/httpapi.asp?command=getPlayerStatusEx

Any of the previous links should definiately work, but it's based on what device you own.

Also consider to test on the latest stable version if you don't already.

silamon avatar Oct 01 '24 06:10 silamon

image

Tried them all and they fail with connection refused. https://my Speaker IP/httpapi.asp?command=getPlayerStatusEx gives out a cert error.

I can play music to this speaker with the integration without issue.

Joe31388 avatar Oct 04 '24 18:10 Joe31388

We'll wait for the debugging to be added then, thanks for trying though! :)

silamon avatar Oct 04 '24 18:10 silamon

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@home-assistant remove-label needs-more-information

silamon avatar Oct 19 '24 07:10 silamon

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@home-assistant remove-label needs-more-information

silamon avatar Nov 02 '24 12:11 silamon

@Joe31388 @corgana If you have already upgraded to 2024.11.0, chances are big you may have seen that most of the issues posted in this issue are solved. If not or some issue still happens, enable debug logging in that version and provide the logging if possible. Looking forward to hear back.

silamon avatar Nov 08 '24 19:11 silamon

Updated to 2024.11.0 and nothing has appeared to change:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 245, in handle_call_service response = await hass.services.async_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2802, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2845, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 989, in entity_service_call raise HomeAssistantError( homeassistant.exceptions.HomeAssistantError: Entity media_player.stereo does not support this service.

Output of: http:///httpapi.asp?command=getPlayerStatus when device reports idle:

{"type":"0","ch":"0","mode":"32","loop":"4","eq":"0","vendor":"","status":"stop","curpos":"0","offset_pts":"28554","totlen":"512000","Title":"","Artist":"","Album":"","alarmflag":"0","plicount":"0","plicurr":"0","vol":"5","mute":"0"}

Borrower543 avatar Nov 09 '24 12:11 Borrower543

I also noticed these in the log (as far as I can tell they were triggered before I was trying to "power off")

Update for media_player.stereo fails 
Logger: homeassistant.helpers.entity
Source: helpers/entity.py:944
First occurred: November 8, 2024 at 7:53:37 PM (98 occurrences)
Last logged: 6:54:39 AM

Update for media_player.kitchen_stereo fails
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 663, in _request
    conn = await self._connector.connect(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 563, in connect
    proto = await self._create_connection(req, traces, timeout)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1032, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1335, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1091, in _wrap_create_connection
    sock = await aiohappyeyeballs.start_connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohappyeyeballs/impl.py", line 82, in start_connection
    sock = await _connect_sock(
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohappyeyeballs/impl.py", line 174, in _connect_sock
    await loop.sock_connect(sock, address)
  File "/usr/local/lib/python3.12/asyncio/selector_events.py", line 641, in sock_connect
    return await fut
           ^^^^^^^^^
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/linkplay/utils.py", line 45, in session_call_api
    async with async_timeout.timeout(API_TIMEOUT):
  File "/usr/local/lib/python3.12/site-packages/async_timeout/__init__.py", line 141, in __aexit__
    self._do_exit(exc_type)
  File "/usr/local/lib/python3.12/site-packages/async_timeout/__init__.py", line 228, in _do_exit
    raise asyncio.TimeoutError
TimeoutError

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

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/linkplay/media_player.py", line 153, in _wrap
    return await func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/linkplay/media_player.py", line 202, in async_update
    await self._bridge.player.update_status()
  File "/usr/local/lib/python3.12/site-packages/linkplay/bridge.py", line 95, in update_status
    properties: dict[PlayerAttribute, str] = await self.bridge.json_request(
                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/linkplay/bridge.py", line 301, 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 65, 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:  error requesting data from 'https://192.168.222.22/httpapi.asp?command=getPlayerStatusEx'

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

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 944, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1302, in async_device_update
    await self.async_update()
  File "/usr/src/homeassistant/homeassistant/components/linkplay/media_player.py", line 155, in _wrap
    raise HomeAssistantError(
homeassistant.exceptions.HomeAssistantError: Exception occurred when communicating with API <function LinkPlayMediaPlayerEntity.async_update at 0x7f29e428f2e0>:  error requesting data from 'https://192.168.222.22/httpapi.asp?command=getPlayerStatusEx'

And:

    [Stereo(192.168.222.22):8009] Failed to connect to service MDNSServiceInfo(name='WiiM-AMP-087bfef615d60b761cd222d0545c5406._googlecast._tcp.local.'), retrying in 5.0s
    [Audio Group(192.168.222.22):32235] Failed to connect to service HostServiceInfo(host='192.168.222.22', port=32235), retrying in 5.0s
    [Stereo(192.168.222.22):8009] Failed to connect to service HostServiceInfo(host='192.168.222.22', port=8009), retrying in 5.0s
    [Chromecast(192.168.222.26):8009] Failed to connect to service HostServiceInfo(host='192.168.222.26', port=8009), retrying in 5.0s
    [Chromecastaudio(192.168.222.27):8009] Failed to connect to service HostServiceInfo(host='192.168.222.27', port=8009), retrying in 5.0s

Borrower543 avatar Nov 09 '24 12:11 Borrower543

Updated to 2024.11.0 and nothing has appeared to change.

That's very unfortunate. Thank you for providing the information, perfect to get issue further progressed towards resolution.

silamon avatar Nov 09 '24 13:11 silamon

With your last debug logs, I found the issue. Thank you, once again! It will be available in v2024.11.2.

Summarizing:

  • Seek support added: https://github.com/home-assistant/core/pull/130349
  • Found the playing mode 32 in the custom component of wiimu: https://github.com/home-assistant/core/pull/130351
  • No longer thrown an error in the logging when the device is offline: https://github.com/home-assistant/core/pull/130161
  • Add stop (power off idle command) support: https://github.com/home-assistant/core/pull/126941

silamon avatar Nov 11 '24 11:11 silamon

Great! Thanks so much! @silamon

Borrower543 avatar Nov 11 '24 13:11 Borrower543