-
-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bang & Olufsen add beolink grouping #113438
base: dev
Are you sure you want to change the base?
Bang & Olufsen add beolink grouping #113438
Conversation
Add support for media player grouping via beolink Give media player entity name
Revert naming changes
simplify Beolink attributes
Add unexpand return value Set entity name on initialization
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please split this PR. One for bumping the library (and all changes needed to support that new version (not the changes needed for new features made possible for that version)). Then try to split the services into a separate PR if that makes sense. I haven't checked the media_player diff, but I don't believe adding services would add that much code to media_player.py
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
Of course. As for the custom services, there are 5 in total and they are all "required" for a smooth Beolink experience. These include "join", "expand", "unexpand", "leave" and "allstandby". I could reduce this down to only the "expand" service and remove the extra_state_attributes for the Beolink session, which would retain support for media_player grouping and remove a sizable amount of code, if that would make this PR more digestable. |
Add all_discovered to beolink_expand service Improve beolink_expand response
Yes, I'll address some of your comments and then make a new PR for basic Home Assistant grouping. |
Simplify code using walrus operator
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To make the implementation easier to understand, please add syrupy state snapshot assertions, maybe also snapshots of entity registry and device registry entries.
In particular, this would be helpful to understand the extra attributes.
I've made a smaller PR with support for Home Assistant grouping #123020 |
@mj23000 please don't forget to click the "Ready for review" button when you want the PR to be reviewed |
Please fix the merge conflicts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments. I've not reviewed the tests.
assert self.device_entry | ||
assert self.device_entry.name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is only for the type checker, let's hide the asserts behind if TYPE_CHECKING:
, also, maybe be explicit the device and name are not None
unless the name ""
is impossible and we want the type checker to know that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The _async_update_beolink
is also called directly on WebsocketNotification.BEOLINK
notifications, so I don't think the if TYPE_CHECKING:
can be added. I've added explicit None checks ("" is also a valid name).
|
||
async def _async_beolink_join(self) -> None: | ||
# Custom actions: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The meaning of this comment is unclear
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a separator for standard Home Assistant actions and custom actions.
"fields": { | ||
"beolink_jid": { | ||
"name": "Beolink JID", | ||
"description": "Manually specify Beolink JID to join." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I've asked several times now, but where do users find the JID? Should we explain it here? Maybe add a section in each service, where the section explains how to find the JID?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JIDs are found using the beolink extra_state_attributes.
Great idea to add a section to the services for the JID parameters. Though it seems that sections have a bug where they need to have at least one required field outside of the section to work and examples from within a section seem to be broken as well, so it hasn't been possible for me to make use of them, but I'll try to investigate further and open an issue if needed.
Fix comment placement Fix group leader group_members rebase error Replace entity_id method call with attribute
Proposed change
Add additional media player grouping to the bang_olufsen media_player entity, using Beolink custom actions.
Beolink is not limited to Mozart devices, which means that devices that can't to be added to Home Assistant (with this integration) can be expanded to using the custom actions, which reference the device's unique JID, instead of entity_id.
Additionally extra_state_attributes show Beolink self (name and JID), peers, listeners and leader.
Type of change
Additional information
Checklist
ruff format 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: