Skip to content
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

Sonos integration - Source list (radio) has switched media artist/media title #37893

Closed
htvekov opened this issue Jul 15, 2020 · 9 comments
Closed

Comments

@htvekov
Copy link

htvekov commented Jul 15, 2020

The problem

  1. When playing from source_list (radio), media_artist and media_title are switched. If I play a Sonos/Spotify playlist, media artist/title is correctly shown and placed in correct attributes.

  2. Presentation of source has been changed since last major update. Source is now identical with source_list names. Previously it was displayed correctly. In this case correct source is "DR P4 Fyn". Correct source is displayed in Sonos app and briefly (for a few seconds) correct in HA as well, just after change of source, until media title/artist are presented.

Environment

  • Home Assistant Core release with the issue: Home Assistant Core 0.112.4
  • Last working Home Assistant Core release (if known):
  • Operating environment (OS/Container/Supervised/Core): HassOS 4.10
  • Integration causing this issue: Sonos
  • Link to integration documentation on our website: https://www.home-assistant.io/integrations/sonos/

Problem-relevant configuration.yaml

Traceback/Error logs

Additional information

source_list:
  - DR P1
  - DR P3
  - DR P4 Fyn 96.8 (Nyheder)
  - DR P5 (Pop)
  - DR P6 Beat
  - NOVA
  - Radio 100
  - Radio Soft
  - The Voice
volume_level: 0
is_volume_muted: false
media_content_id: 'x-rincon-mp3radio://http://live-icy.gslb01.dr.dk:80/A/A07H.mp3'
media_content_type: music
media_title: Bradley Cooper & Lady Gaga
media_artist: Shallow
source: DR P4 Fyn 96.8 (Nyheder)
shuffle: false
sonos_group:
  - media_player.kokken
  - media_player.stue
  - media_player.alrum
friendly_name: Køkken
entity_picture: >-
  /api/media_player_proxy/media_player.kokken?token=b9d4204fd9765eedb4b71597d3c9d5483a59f421c1f5ae66e2f591351d822d12&cache=9c3cd9674956a6b5
supported_features: 64063

image

When source playing (radio) is paused, media_title attribute changes to correct source name.

image

@probot-home-assistant
Copy link

sonos documentation
sonos source
(message by IssueLinks)

@amelchio
Copy link
Contributor

Please report just one issue per ticket, it easily gets confusing to discuss two things at once.

I am not sure anything can be done about the artist/title being swapped. Stations report this differently and I know of no way to figure out which order is used. See examples from the Sonos application here:

Screen Shot 2020-07-16 at 22 33 11

Screen Shot 2020-07-16 at 22 39 37

For the second issue, what you describe is the intended behavior; source should be one of the source_list items. HA does not show the station name (i.e. "DR P4 Fyn") as source but it might use it as a media_title when no other title is being streamed.

@htvekov
Copy link
Author

htvekov commented Jul 17, 2020

Hi' @amelchio

Sorry about the double issue in one ticket. Even though they were both related to latest Sonos integration update, I agree it's not smart dicussing two issue in one ticket 👍

  1. Ok. I assume then you just get one string from the stream and split this in two seperate attributes ? Then it's impossible to deal with this issue, as there's apparently no fixed order to this artist/title string from the different radio stations.
    I'll just keep my template that swap these two attributes if source attribute is present, as all my danish TuneIn stations all present artist/title in the same order. If all Danish TuneIn stations use same order, I might instead check the media_content_id attribute for language data. But this data is apparently only available from attribute upon source shift for a very short period or ?

  2. The 'real' station name (from stream) was presented as source in HA frontend in previous Sonos integration, right ?
    To present source attribute as actual sources from list makes perfect sense. In my case I'm just unlucky that two radio stations have stupid source names - referring to FM band frequency and genre ("DR P4 Fyn 96,8 (NYHEDER)" and "DR P5 (POP") 😖
    Any chance of the 'real' station name from stream as an extra attribute in HA 🤞, or do you want/need to keep attributes to an absolute minimum ? Once again I'm currently templating my way out of this issue. But it's hardcoded to specific stations and not dynamic in any way. There's of course also the possibility to rename the 'offending' source list name in the Sonos app. But that could end up in different naming for the same station with multiple users.

@amelchio
Copy link
Contributor

  1. Yes, it is split from one string. As I showed above, both combinations exist. It is possible that we organize them in the way that is less common, I don't know. The media_content_id should not disappear but I am not sure why it would contain language data, it should be the playing URL. Can you show an example of what you are referring to?

  2. I believe the station name used to be in media_title and media_artist would contain both the artist name and the song title (like in my screenshots above even though those are from the Sonos app). It is possible to add the radio station name from the stream as an additional attribute. I will look into that.

@htvekov
Copy link
Author

htvekov commented Aug 20, 2020

Hi' @amelchio

  1. When shifting between different sources media_content_id and media_title sometimes (and only sometimes) for a second or so shows loads of pre roll data, such as station language, content type, country region id etc. (See picture. I didn't make a sensor for that attribute to log the changes). Data often appear on the national danish stations (eg. DR P4)
    Don't know is this data originates from actual stream, TuneIn or... ? But if this pre roll data is valid data for all (or most) sources, then this could accomodate some very useful data for new attributes.

image

  1. I would very much appreciate the 'official' station name from stream as an attribute 👍😃 That would remove the need for static templates in my HA setup.

@amelchio
Copy link
Contributor

amelchio commented Sep 3, 2020

I'm sorry that I am so slow in responding, I do not have much time to devote to this.

  1. I never noticed anything like that (though I also didn't look for it). This is probably just the way this particular CDN works, I don't think it is something that can be supported in a general way.

  2. I was starting to do the work to officially add a new media player attribute when I noticed that media_channel already exists. This seems like just what we need so I will go ahead and use this attribute to add the information back.

For reference, the channel name was removed in #33063.

@htvekov
Copy link
Author

htvekov commented Sep 5, 2020

Hi' @amelchio

No worries ! 😎
Radio channel name from stream in media_channel attribute sounds like a perfect solution, thank you 👍

Regarding the other issue I believe you're right about it can't be supported in HA.
I also stumbled over this curious pre roll data by pure accident.

A final quick question: Is Sonos/Spotify eg. actual playlist name easily accessible from stream as well ?

Ciao !

@amelchio
Copy link
Contributor

amelchio commented Sep 5, 2020

I believe the current playlist is unknown. To my understanding, playing a playlist copies it to the current queue and from there it is just the queue, no different from having added each song individually.

@amelchio
Copy link
Contributor

I am going to close this issue now since it seems there is nothing more to do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants