Support media player grouping in apple_tv integration#94704
Conversation
|
Hey there @postlund, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
|
@postlund, will you have some time to review this? It adds HA grouping support using the set output devices feature I recently added to pyatv. |
|
@michalmo Right, sorry, I'll try to get to it asap. |
postlund
left a comment
There was a problem hiding this comment.
Overall gist looks good, but it's a big change and I think a core dev should have a look too.
| SUPPORT_BASE = ( | ||
| MediaPlayerEntityFeature.TURN_ON | ||
| | MediaPlayerEntityFeature.TURN_OFF | ||
| | MediaPlayerEntityFeature.GROUPING |
There was a problem hiding this comment.
I don't think this should be added here as it would suggest all devices supports grouping, which isn't the really the case (old Apple TVs for instance).
You need to add the features related to grouping to SUPPORT_APPLE_TV. You can just map all of them to GROUPING and the issue above will be solved.
There was a problem hiding this comment.
I'll explain my reasoning:
Apple devices can be controllers, that actually play the media and send it to other devices. Other AirPlay devices can be players.
Home Assistant has a few features gated behind this support flag, one of which is the group_members attribute.
A device that can be grouped needs to have this flag set so that it can expose that attribute.
In async_join_players there is an extra check for FeatureName.AddOutputDevices to see if the device can be the group controller, that feature is set If there is an MRP connection (so not for AirPlay only devices).
Now I don't have any device that doesn't work with grouping so I can't run any more checks.
@postlund do you know if feature support is device specific, or OS version specific? Also can these old Apple TVs be added to a group over AirPlay even if they can't be leaders? Are there any AirPlay devices that cannot be added t a group? If I knew that I could try to add more specific features flagging.
I'm available again to complete this, after a period of inactivity during the summer. I'm still motivated to get this in, since I'm already relying on this locally in automations. I need to resolve which devices need to be excluded from this, and add the required feature flagging. I'll create a ticket in the pyatv repo and move the discussion there. Other than that @postlund suggested that a core dev should have a look too, which could be done now (since only better feature flagging needs to be added), or after I update this PR. |
|
There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days. |
Proposed change
This PR adds support for grouping (
media_player.join,media_player.unjoinandgroup_members) to the apple_tv integration, which was enabled in the latest pyatv (#94683).Type of change
Additional information
Checklist
black --fast homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all..coveragerc.To help with the load of incoming pull requests: