Skip to content

Add media content id attribute to Bang & Olufsen#156597

Merged
joostlek merged 5 commits into
home-assistant:devfrom
mj23000:bang_olufsen_media_id_attribute
Nov 27, 2025
Merged

Add media content id attribute to Bang & Olufsen#156597
joostlek merged 5 commits into
home-assistant:devfrom
mj23000:bang_olufsen_media_id_attribute

Conversation

@mj23000
Copy link
Copy Markdown
Contributor

@mj23000 mj23000 commented Nov 14, 2025

Proposed change

Add media ID attribute (if available) for the current playing media, such as Deezer or Tidal track ID or radio station ID. Additionally expand the media_content_type property to show the corresponding content type.

So for example, when playing a radio station, the content type will be now radio and content ID 123..... These values can be directly used in the play_media action

Additionally use keys from an enum to piece together the extra state attributes. This is no longer relevant to this PR, but is still a minor improvement.

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:

@tr4nt0r
Copy link
Copy Markdown
Contributor

tr4nt0r commented Nov 15, 2025

Uhm, the media player already has an attribute for the content id, you can simply add

    @property
    def media_content_id(self) -> str | None:
        """Content ID of current playing media."""
         return your content id

to the media player

@mj23000
Copy link
Copy Markdown
Contributor Author

mj23000 commented Nov 15, 2025

Uhm, the media player already has an attribute for the content id, you can simply add


    @property

    def media_content_id(self) -> str | None:

        """Content ID of current playing media."""

         return your content id

to the media player

I don't know how I've missed that. I will make the necessary changes.

@mj23000 mj23000 marked this pull request as draft November 15, 2025 22:48
@mj23000 mj23000 changed the title Add media id attribute to Bang & Olufsen Add media content id attribute to Bang & Olufsen Nov 18, 2025
@mj23000 mj23000 marked this pull request as ready for review November 18, 2025 11:07
frenck
frenck previously requested changes Nov 23, 2025
Copy link
Copy Markdown
Member

@frenck frenck left a comment

Choose a reason for hiding this comment

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

Oh hi there @mj23000 👋

A wild merge conflict appeared 🙈
Could you take a look? 🙏

../Frenck

                       

Blogging my personal ramblings at frenck.dev

@home-assistant home-assistant Bot marked this pull request as draft November 23, 2025 13:58
@home-assistant
Copy link
Copy Markdown
Contributor

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@mj23000 mj23000 force-pushed the bang_olufsen_media_id_attribute branch from 9dfb98f to 550166c Compare November 23, 2025 16:11
@mj23000 mj23000 marked this pull request as ready for review November 23, 2025 16:14
@home-assistant home-assistant Bot requested a review from frenck November 23, 2025 16:14
@joostlek joostlek dismissed frenck’s stale review November 27, 2025 14:53

merge conflict fixed

@joostlek joostlek merged commit f7c41e6 into home-assistant:dev Nov 27, 2025
36 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 28, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants