Skip to content

Conversation

@LouisChrist
Copy link
Contributor

Proposed change

This adds support for media_player.join and media_player.unjoin. This also deprecates the custom actions for grouping: bluesound.join and bluesound.unjoin.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.

To help with the load of incoming pull requests:

Copilot AI review requested due to automatic review settings December 19, 2025 16:40
@home-assistant
Copy link

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

Code owner commands

Code owners of bluesound can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign bluesound Removes the current integration label and assignees on the pull request, 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 pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the pull request.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for standard Home Assistant media_player.join and media_player.unjoin services to the Bluesound integration, while deprecating the custom bluesound.join and bluesound.unjoin actions. The PR introduces a group_members attribute to track media player grouping relationships and updates the supported features to include MediaPlayerEntityFeature.GROUPING.

Key changes:

  • Implements async_join_players() and async_unjoin_player() methods for standard media player grouping
  • Adds group_members property and rebuild_group_members() method to track grouped entities
  • Adds deprecation warnings to the legacy bluesound.join and bluesound.unjoin services with a breaking change scheduled for version 2026.12.0

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
homeassistant/components/bluesound/media_player.py Implements new media player grouping feature with async_join_players() and async_unjoin_player() methods; adds group_members tracking; deprecates legacy join/unjoin services
homeassistant/components/bluesound/utils.py Adds id_to_paired_player() utility function to convert id strings to PairedPlayer objects
homeassistant/components/bluesound/strings.json Adds deprecation warning messages for bluesound.join and bluesound.unjoin actions
tests/components/bluesound/test_media_player.py Adds comprehensive tests for new grouping functionality including test_join_players(), test_unjoin_player(), and test_attr_group_members()
tests/components/bluesound/snapshots/test_media_player.ambr Updates snapshot to reflect new group_members attribute and updated supported_features with GROUPING flag

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 8 comments.

Comments suppressed due to low confidence (1)

tests/components/bluesound/test_media_player.py:337

  • Missing test coverage for deprecation warnings. The new code adds deprecation warnings for bluesound.join and bluesound.unjoin services (lines 473-485 and 497-509 in media_player.py). Tests should verify that calling these deprecated services creates the appropriate repair issues via ir.async_create_issue. This ensures the deprecation mechanism works correctly and users receive proper warnings.
async def test_join(
    hass: HomeAssistant,
    setup_config_entry: None,
    setup_config_entry_secondary: None,
    player_mocks: PlayerMocks,
) -> None:
    """Test the bluesound.join action."""
    await hass.services.async_call(
        DOMAIN,
        SERVICE_JOIN,
        {
            ATTR_ENTITY_ID: "media_player.player_name1111",
            ATTR_MASTER: "media_player.player_name2222",
        },
        blocking=True,
    )

    player_mocks.player_data_secondary.player.add_follower.assert_called_once_with(
        "1.1.1.1", 11000
    )


async def test_unjoin(
    hass: HomeAssistant,
    setup_config_entry: None,
    setup_config_entry_secondary: None,
    player_mocks: PlayerMocks,
) -> None:
    """Test the bluesound.unjoin action."""
    updated_sync_status = dataclasses.replace(
        player_mocks.player_data.sync_status_long_polling_mock.get(),
        leader=PairedPlayer("2.2.2.2", 11000),
    )
    player_mocks.player_data.sync_status_long_polling_mock.set(updated_sync_status)

    # give the long polling loop a chance to update the state; this could be any async call
    await hass.async_block_till_done()

    await hass.services.async_call(
        DOMAIN,
        "unjoin",
        {ATTR_ENTITY_ID: "media_player.player_name1111"},
        blocking=True,
    )

    player_mocks.player_data_secondary.player.remove_follower.assert_called_once_with(
        "1.1.1.1", 11000
    )

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Change Bluesound group list to use IDs instead of names

1 participant