Skip to content

Controller callback in update_status() is never awaited, so multiroom changes aren't picked up #135

Open

Description

@ccristal

Version: python-linkplay 0.2.14, through Home Assistant core 2026.10.2 (Home Assistant OS)
Devices: WiiM Pro (leader), 2× Audio Pro Addon C3 (WiiMu-A28, firmware 4.6.337158), each set up as its own linkplay config entry

Problem

The controller callback that should refresh multiroom groups is never awaited, so discover_multirooms() never runs when a device moves into or out of follower mode. Every time a speaker is joined, Home Assistant logs:

WARNING (MainThread) [py.warnings] /usr/local/lib/python3.14/site-packages/linkplay/bridge.py:180: RuntimeWarning: coroutine 'LinkPlayController.get_bridge_callback.<locals>.callback' was never awaited
  self.bridge.device.controller()

Cause

In LinkPlayPlayer.update_status() (bridge.py#L169-L180):

        # handle multiroom changes
        if self.bridge.device.controller is not None and (
            ...
        ):
            self.bridge.device.controller()

controller is the callback from LinkPlayController.get_bridge_callback() (controller.py#L21-L29), which is async def callback() and awaits self.discover_multirooms(). Calling it without await only creates a coroutine object, so the group re-read never runs. The Callable[[], None] annotations on LinkPlayDevice.controller and set_callback() hide this from type checkers.

Steps to reproduce (Home Assistant)

  1. Set up the leader and a follower under the linkplay integration.
  2. Call media_player.join with the leader as target and the follower in group_members.
  3. The devices group correctly: multiroom:getSlaveList on the leader lists the follower, and the follower's getStatusEx reports the leader's master_uuid.
  4. group_members in Home Assistant isn't updated, and the warning above is logged. It stays stale through normal polling and homeassistant.update_entity.
  5. Reloading any linkplay config entry, which runs discover_multirooms() during setup, immediately shows the correct group on all players.

media_player.unjoin is reflected correctly.

Suggested fix

update_status() is already async, so:

            await self.bridge.device.controller()

with the annotations changed to Callable[[], Awaitable[None]].

Possibly related: #134 (exceptions escaping discover_multirooms()). Once this callback actually runs, any such exception would reach update_status().

Activity

  1. daniel-simpson commented on Nov 12, 2026

    @daniel-simpson
    Contributor

    Confirming on python-linkplay 0.2.14 via Home Assistant core 2026.10.2 (three WiiM/Linkplay speakers, one linkplay config entry each).

    I see the same RuntimeWarning: coroutine 'LinkPlayController.get_bridge_callback.<locals>.callback' was never awaited at bridge.py:180 after media_player.join.

    One more consequence: unjoin called shortly after a join is silently a no-op. async_unjoin_player reads self._bridge.multiroom, which is still None because the group was never re-read, so no multiroom:SlaveKickout is sent. The debug log shows ConnectMasterAp:JoinGroupMaster for the join and nothing for the first unjoin. A second unjoin about 80 seconds later worked.

    I checked #136 locally. With the real get_bridge_callback() and a player moving to follower mode:

    If discover_multirooms() raises LinkPlayRequestException (see #134), it now propagates out of update_status(). previous_playing_mode is not updated in that case, so the callback is retried on the next poll, which seems like the right behaviour. It is worth knowing, though, because Home Assistant counts that exception as a failed poll.

    #136 looks right to me and the suite passes (290 passed). Could a maintainer take a look?

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions