Skip to content

Improve the source labels for MusicCast players#74954

Merged
marcelveldt merged 5 commits into
home-assistant:devfrom
micha91:musiccast-source-labels
Jun 27, 2023
Merged

Improve the source labels for MusicCast players#74954
marcelveldt merged 5 commits into
home-assistant:devfrom
micha91:musiccast-source-labels

Conversation

@micha91
Copy link
Copy Markdown
Contributor

@micha91 micha91 commented Jul 11, 2022

Breaking change

If you have any automation depending on the source state attribute of the media player entity, you will have to update these, because we want to show more user friendly values such as "Net Radio" instead of net_radio. Calling the select_source service will still be possible using the old source names.

Proposed change

In the MusicCast app and in the display of the devices, the network related sources are shown in a more user friendly way as the values, which are used in the API. With this PR we use these alternative labels. For devices supporting external sources such as HDMI sources, it is possible to rename these sources in the app. Because the user is completely free to label two sources in the same way, we ensure that the source labels do not conflict with other sources. If there are conflicts such as HDMI 1 and HDMI 2 both labeled with "Apple TV", we name one of the sources as "Apple TV (hdmi1)" and the other "Apple TV (hdmi2)". To enable users to write automations without having to care about the user defined source names, it is still possible to call the select_source service with the original source names.
In my opinion, it would be best to edit the media_player entity structure and the frontend to show these user defined labels only in the frontend and work with the original unique API defined values for service calls and states. However there was not enough positive feedback for that in the architecture discussion, so we go this way.

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

  • 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
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

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.
  • Untested files have been added to .coveragerc.

The integration reached or maintains the following Integration Quality Scale:

  • No score or internal
  • 🥈 Silver
  • 🥇 Gold
  • 🏆 Platinum

To help with the load of incoming pull requests:

@probot-home-assistant
Copy link
Copy Markdown

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

@frenck
Copy link
Copy Markdown
Member

frenck commented Jul 11, 2022

Calling the select_source service will still be possible using the old source names.

So it is not a breaking change?

@micha91
Copy link
Copy Markdown
Contributor Author

micha91 commented Jul 11, 2022

Calling the select_source service will still be possible using the old source names.

So it is not a breaking change?

It is a breaking change for those who use the current source e.g. as a trigger by using a template such as {{is_state_attr('media_player.buro', 'source', 'airplay')}}. I just edited the text to hopefully clarify that.

@frenck frenck added the smash Indicator this PR is close to finish for merging or closing label Jul 25, 2022
@github-actions
Copy link
Copy Markdown

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.
Thank you for your contributions.

@github-actions github-actions Bot added the stale label Oct 23, 2022
Copy link
Copy Markdown
Contributor

@KevinCathcart KevinCathcart left a comment

Choose a reason for hiding this comment

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

These changes all make sense. The only complicated part is the source mapping property and that looks to handle all the edge cases.

The other changes are simple and pretty obviously correct.

Comment thread homeassistant/components/yamaha_musiccast/media_player.py
Comment thread homeassistant/components/yamaha_musiccast/media_player.py
@github-actions github-actions Bot removed the stale label Oct 29, 2022
@github-actions
Copy link
Copy Markdown

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.
Thank you for your contributions.

@github-actions github-actions Bot added the stale label Jan 27, 2023
@micha91
Copy link
Copy Markdown
Contributor Author

micha91 commented Feb 1, 2023

I would still love to get this merged

@github-actions github-actions Bot removed the stale label Feb 1, 2023
Copy link
Copy Markdown
Contributor

@OzGav OzGav left a comment

Choose a reason for hiding this comment

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

This looks good with no previous objections from others I think it should be approved.

Copy link
Copy Markdown
Member

@marcelveldt marcelveldt left a comment

Choose a reason for hiding this comment

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

Sorry for the late final review. We're really swamped with PR's and trying to catch up reviewing them.

Adding a small test for this logic would even be better but overall this PR looks solid to be merged.

Thanks!

@marcelveldt marcelveldt changed the title MusicCast Source Labels Improve the source labels for MusicCast players Jun 27, 2023
@marcelveldt marcelveldt merged commit 16fe79d into home-assistant:dev Jun 27, 2023
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

breaking-change by-code-owner cla-signed integration: yamaha_musiccast new-feature small-pr PRs with less than 30 lines. smash Indicator this PR is close to finish for merging or closing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Yamaha musiccast integration doesn't use configured source names

7 participants