home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.67k stars 30.8k forks source link

Frontier Silicon - media_title is hard to match against #92992

Closed phuhl closed 1 year ago

phuhl commented 1 year ago

The problem

When tuning in a channel on an internet radio the media_title is the channel name plus " - " and the info text. The info text changes regularly. Hence, you cannot just match against the channel name in an automation. This basically makes channel-based automations impossible.

            info_name = await afsapi.get_play_name()
            info_text = await afsapi.get_play_text()

            self._attr_media_title = " - ".join(filter(None, [info_name, info_text]))

To fix this, there could be an additional attribute media_name that just has the value of info_name.

What version of Home Assistant Core has the issue?

core-2023.4.5

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Frontier Silicon

Link to integration documentation on our website

https://www.home-assistant.io/integrations/frontier_silicon

Diagnostics information

No response

Example YAML snippet

platform: state
entity_id:
  - media_player.grundig_dkr_3000
attribute: media_title
# Won't work as the media_title will often be something 
# like "SRF 4 News - 10:35 Fussball - Schweiz: Schultz neuer Basel-Trainer".
from: SRF 4 News
for:
  hours: 0
  minutes: 0
  seconds: 1
id: set-sound-mode-normal

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 1 year ago

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

Code owner commands Code owners of `frontier_silicon` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign frontier_silicon` Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


frontier_silicon documentation frontier_silicon source (message by IssueLinks)

wlcrs commented 1 year ago

Such a thing as media_name does not exist for a media_player entity. cfr. https://github.com/home-assistant/core/blob/dev/homeassistant/components/media_player/__init__.py to learn which properties exist.

You are welcome to create a PR which improves the current way the Frontier Silicon integration works, but I won't do any work other than straight up fixing bugs.

As this is not a bug report but an enhancement request, I will close this issue.

wlcrs commented 1 year ago

@home-assistant close