home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
74.02k stars 31.06k forks source link

[Linkplay]: Changing volume too fast now result in a crash of the entity. #131473

Open maxi1134 opened 3 days ago

maxi1134 commented 3 days ago

The problem

When using an automation to lower the sound of my Linkplay device ( Through a Universal media player ), it disconnect with the following error:

context manager error requesting data from 'https://192.168.0.151/httpapi.asp?command=setPlayerCmd:vol:14'

I believe that this is due to trying to poll the volume level while lowering it.

It worked for a year or so before now doing this. (I was previously using the HACS Linkplay integration)

What version of Home Assistant Core has the issue?

core-2024.11.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

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

Diagnostics information

home-assistant_linkplay_2024-11-24T17-33-16.955Z.log

Example YAML snippet

The universal entity used:

  - platform: universal
    name: Universal office Speakers
    unique_id: universal_office_speakers
    children:
      - media_player.mass_office_airplay_wiim_speaker
      - media_player.wiim_office_linkplay
    active_child_template: media_player.mass_office_airplay_wiim_speaker
    state_template: >-
                  {% if not is_state('media_player.mass_office_airplay_wiim_speaker','off')  %}
                      {{ states('media_player.mass_office_airplay_wiim_speaker') }}
                  {% else %}
                    off
                  {% endif %} 
    commands:
      turn_on:
        service: media_player.turn_on
        target:
          entity_id: 
            - media_player.mass_office_airplay_wiim_speaker   
      turn_off:
        service: media_player.turn_off
        target:
          entity_id: 
            - media_player.group_mass_home_airplay_speakers   
      volume_mute:
        service: media_player.volume_mute
        target:
          entity_id: 
            - media_player.wiim_office_linkplay
        data:
          is_volume_muted: "{{ is_volume_muted }}"
      volume_set:
        service: media_player.volume_set
        target:
          entity_id: 
            - media_player.wiim_office_linkplay
        data:
          volume_level: "{{ volume_level }}"
      volume_up:
        service: media_player.volume_up
        target:
          entity_id:
            - media_player.wiim_office_linkplay
      volume_down:
        service: media_player.volume_down
        target:
          entity_id: 
            - media_player.wiim_office_linkplay
    attributes:
      is_volume_muted: media_player.wiim_office_linkplay|is_volume_muted
      volume_level: media_player.wiim_office_linkplay|volume_level

The automation action used:

              - target:
                  entity_id: "{{media_players}}"
                data_template:
                  volume_level: >-
                    {{ state_attr((media_players | first),'volume_level') |
                    float - 0.03}}
                action: media_player.volume_set

Anything in the logs that might be useful for us?

linkplay.exceptions.LinkPlayRequestException: Interrupted by interrupt context manager error requesting data from 'https://192.168.0.151/httpapi.asp?command=setPlayerCmd:vol:14'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 464, in async_run
    await self._async_step(log_exceptions=False)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 528, in _async_step
    self._handle_exception(
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 558, in _handle_exception
    raise exception
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 526, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 764, in _async_call_service_step
    response_data = await self._async_run_long_action(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 727, in _async_run_long_action
    return await long_task
           ^^^^^^^^^^^^^^^
  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 1007, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1079, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/universal/media_player.py", line 567, in async_set_volume_level
    await self._async_call_service(SERVICE_VOLUME_SET, data, allow_override=True)
  File "/usr/src/homeassistant/homeassistant/components/universal/media_player.py", line 279, in _async_call_service
    await async_call_from_config(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 342, in async_call_from_config
    await hass.services.async_call(**params, blocking=blocking, context=context)
  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 1007, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1079, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/linkplay/media_player.py", line 157, in _wrap
    raise HomeAssistantError(
homeassistant.exceptions.HomeAssistantError: Exception occurred when communicating with API : Interrupted by interrupt 

Additional information

No response

home-assistant[bot] commented 3 days ago

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)