I have cobbled something together on my local machine, which seems to be in line with the requirements you mention. The results that I get for the master:
volume_level: 0.25
is_volume_muted: false
media_content_type: music
media_position: 127.45142799999999
media_position_updated_at: 2019-10-23T06:42:22.552787+00:00
media_title: De muziek zegt alles - Hilversum
media_artist: Clarence Clemons&Jackson Browne - You're A Friend Of Mine
media_album_name: NPO Radio 2
source: 92.6 | NPO Radio 2 (Adult Hits)
source_list: 98.9 | NPO Radio 1 (Talk),92.6 | NPO Radio 2 (Adult Hits),96.8 | NPO 3FM (Top 40 & Pop Music),94.3 | NPO Radio 4 (Classical Music),Library,Amazon Music,Radio Paradise,TuneIn,Bluetooth,Optical Input,Spotify
shuffle: false
bluesound_group: bluesound_achterkamer,bluesound_voorkamer
is_master: true
friendly_name: bluesound_achterkamer
icon: /images/players/N180_nt.png
entity_picture: /api/media_player_proxy/media_player.bluesound_achterkamer?token=...&cache=...
supported_features: 65085
When the group no longer exists, the bluesound_group attribute is no longer present. While this works nicely on my local machine, I am not able to test with multiple groups or groups larger than 2 as I only have two devices⊠Would this work in its current form for the mini-media-player?
Thx for the hint. I have no idea why but the card is now working as it should (without adding your suggested fix). No clue what happened or why it suddenly works as expected :-).
Thatâs amazing, well done!
Just from looking at the attributes, yes that should do it.
Are you planning on submitting these changes in a PR to the HA repo?
Thatâs great to hear, I still wonder what caused the issue in the first place
Anyway, great that it works now!
Yes, Iâll give that a try. Have not done this before (and Iâm also not a big-shot star-studded python hero), so all takes some time for me to read-up on how to get things done. Repo is forked, changes committed to local feature branch, now need to create the PR and submit.
For reference: PR created. Slight change with respect to output mentioned above is that master is used instead of is_master. Otherwise the output should be identical to what was mentioned earlier in the conversation.
Why these two cards have different background color also if the config is the same?
The first two are sonos group with speaker_group option, the third is only a group card.
Ok, so itâs valid also for non-sonos groups?
EDIT: i have group option to true in all the cards, but only in sonos group i have that behaviourâŠ
Or maybe i donât understand well what the docs state.
The group option have nothing to do with sonos or speaker_group.
Okay, Iâll try to explain it clearer.
All cards are transparent, as a result of group: true and the cards will therefore have the same background color as the background behind the card, the cards are transparent, right?
The third card looks to be nested inside another card which seem to have a background-color set, the mini-media-player card is transparent and as a result you can see the underlaying card and itâs background-color right through it.
Thatâs a good fit for the shortcuts, have the shortcuts call a script with the entity_id and possibly skip_interval as parameters and handle the service call from the script, that way you can reuse the same script in multiple cards or places.
Yes, a general skip script would be ideal. The problem is I donât know how to get the progress and duration from the media_player entity. I believe media player only accepts seek_position which is an absolute position in the track, not an interval.
The magic of your card exposes the progress and duration of the track so that a 30 second skip can be calculated and seek_position can be used to skip.
Maybe we could get the HA people to code a seek_interval service call.
- type: custom:mini-media-player
entity: media_player.example
shortcuts:
buttons:
- type: script
id: skip
icon: mdi:rewind-10
data:
entity: media_player.example # Same as card entity
interval: -10 # Skip in seconds (change by preference)
- type: script
id: skip
icon: mdi:fast-forward-10
data:
entity: media_player.example # Same as card entity
interval: 10 # Skip in seconds (change by preference)
This will only work for media players reporting the media_position.
And it will throw an error if media_position + interval < 0 but itâs a good start.
I canât believe that I didnât know that media_position was in the state attributes.
I think Iâll have to use the media_position_updated_at attribute as well because the media_position doesnât seem to be the current position but the position last time the attributes were updated. Not sure why it doesnât stay up to date.
Thatâs a smart idea, thatâs actually how we calculate and track the progress in the mini-media-player card, some platforms seem to keep it pretty up to date and some less so, for performance reasons I guess.