hello @rhysb first of all very nice that you have made this media player very nice and handy i have adjusted it a bit to my taste now i have a question is it possible if i use my sonos for tv sound then i get black in the screen where normally the picture comes from the song would it be possible to do this based on everything the media title is on TV is this status so know it but just donât know how to add it? thanks in advance!
type: custom:stack-in-card
cards:
- type: custom:stack-in-card
cards:
- type: custom:mushroom-media-player-card
entity: media_player.sonos_beam
icon: mdi:play
use_media_info: true
use_media_artwork: true
show_volume_level: true
media_controls:
- play_pause_stop
- previous
- next
volume_controls:
- volume_buttons
- volume_set
fill_container: false
card_mod:
style: |
mushroom-shape-icon {
display: flex;
{% set media_type = state_attr(config.entity, 'media_title') %}
{% if media_type == 'TV' %}
--card-mod-icon: mdi:television-classic;
animation: flicker 1s linear infinite alternate;
{% else %}
--card-mod-icon: mdi:play;
{% endif %}
}
@keyframes flicker {
0%, 31.98%, 32.98%, 34.98%, 36.98%, 39.98%, 67.98%, 68.98%, 95.98%, 96.98%, 97.98%, 98.98%, 100% { --icon-color: rgba(var(--rgb-indigo), 1); }
32%, 33%, 35%, 36%, 37%, 40%, 68%, 69%, 96%, 97%, 98%, 99% { --icon-color: rgba(var(--rgb-indigo), 0.6); }
}
@keyframes beat {
0%, 60% { --icon-symbol-size: 21px; }
5%, 17%, 57% { --icon-symbol-size: 22px; }
10%, 20%, 51% { --icon-symbol-size: 23px; }
25%, 45% { --icon-symbol-size: 24px; }
30%, 39% { --icon-symbol-size: 25px; }
33% { --icon-symbol-size: 26px; }
}
ha-card {
--ha-card-border-width: 0;
}
ha-card:before {
transform: translate3d(0,0,0);
-webkit-transform: translate3d(0,0,0);
content: "";
background: url('/local/idle_art.png') center no-repeat;
{% if not is_state(config.entity, 'playing') %}
background: url( '{{ state_attr(config.entity, "entity_picture") }}') center no-repeat;
{% endif %}
background-size: contain;
margin: 4px 4px 16px;
filter: drop-shadow(4px 4px 6px rgba(0, 0, 0, 0.5));
border-radius: var(--control-border-radius);
{% set media_type = state_attr(config.entity, 'media_content_type') %}
{% if media_type == 'TV' %}
aspect-ratio: 16 / 9;
{% else %}
aspect-ratio: 1 / 1;
{% endif %}
}
- type: conditional
conditions:
- entity: media_player.currently_playing
state_not: 'off'
- entity: media_player.currently_playing
state_not: idle
card:
entity: media_player.currently_playing
hide:
icon: true
name: true
runtime: true
source: true
power: true
state_label: true
volume: true
info: true
progress: false
controls: true
more_info: false
type: custom:mini-media-player
toggle_power: false
group: true
card_mod:
style:
mmp-progress$: |
paper-progress {
{{ '--paper-progress-container-color: rgba(var(--rgb-indigo-color), 0.2) !important;' if is_state(config.entity, 'playing') }}
}
.: |
ha-card {
margin: 0px 12px 12px;
--mmp-progress-height: 12px !important;
height: var(--mmp-progress-height);
--mmp-accent-color: rgb(var(--rgb-indigo-color));
--mmp-border-radius: 12px !important;
--ha-card-border-width: 0;
}
card_mod:
style: |
ha-card:before {
transform: translate3d(0,0,0);
-webkit-transform: translate3d(0,0,0);
content: "";
position: absolute;
height: 100%;
width: 100%;
background: url('/local/idle_art.png') center no-repeat;
{% if not is_state('media_player.currently_playing', 'idle') %}
background: url( '{{ state_attr('media_player.currently_playing', "entity_picture") }}' ) center no-repeat;
{% endif %}
filter: blur(150px) saturate(200%);
background-size: 100% 100%;
}
ha-card {
transform: translate3d(0,0,0);
-webkit-transform: translate3d(0,0,0);
}
- type: custom:layout-card
layout_type: custom:grid-layout
layout:
grid-template-columns: auto 58px
margin: '-14px 0px -8px -4px;'
cards:
- type: custom:mushroom-media-player-card
entity: media_player.sonos_beam
volume_controls:
- volume_mute
- volume_set
- volume_buttons
media_controls: []
show_volume_level: true
use_media_info: false
icon_type: none
primary_info: none
secondary_info: none
card_mod:
style: |
ha-card {
--ha-card-border-width: 0;
box-shadow: none;
margin-right: -8px !important;
}
- type: custom:mushroom-chips-card
chips:
- type: action
icon: mdi:television-speaker
alignment: end
name: tv mode
tap_action:
action: call-service
service: script.sonos_tv_mode
data: {}
target: {}
card_mod:
style: |
ha-card {
--chip-background: rgba(var(--rgb-disabled), 0.2);
margin-top: 10px;
--chip-box-shadow: none;
--chip-border-radius: var(--control-border-radius);
--chip-border-width: 0;
--chip-height: 42px;
}
- type: custom:mushroom-chips-card
chips:
- type: action
icon: mdi:speaker-multiple
alignment: end
name: Groep sonos aan
tap_action:
action: call-service
service: script.g
data: {}
target: {}
card_mod:
style: |
ha-card {
--chip-background: rgba(var(--rgb-disabled), 0.2);
margin-top: 10px;
--chip-box-shadow: none;
--chip-border-radius: var(--control-border-radius);
--chip-border-width: 0;
--chip-height: 42px;
}
- type: action
icon: mdi:speaker
alignment: end
name: Groep sonos uit
tap_action:
action: call-service
service: script.gv
data: {}
target: {}
card_mod:
style: |
ha-card {
--chip-background: rgba(var(--rgb-disabled), 0.2);
margin-top: 10px;
--chip-box-shadow: none;
--chip-border-radius: var(--control-border-radius);
--chip-border-width: 0;
--chip-height: 42px;
}
- type: action
icon: mdi:shuffle-variant
alignment: end
name: shuffel aan
tap_action:
action: call-service
service: script.sonos_shuffel_on
data: {}
target: {}
card_mod:
style: |
ha-card {
--chip-background: rgba(var(--rgb-disabled), 0.2);
margin-top: 10px;
--chip-box-shadow: none;
--chip-border-radius: var(--control-border-radius);
--chip-border-width: 0;
--chip-height: 42px;
}
- type: action
icon: mdi:shuffle-disabled
alignment: end
name: shuffel uit
tap_action:
action: call-service
service: script.sonos_shuffel_off
data: {}
target: {}
card_mod:
style: |
ha-card {
--chip-background: rgba(var(--rgb-disabled), 0.2);
margin-top: 10px;
--chip-box-shadow: none;
--chip-border-radius: var(--control-border-radius);
--chip-border-width: 0;
--chip-height: 42px;
}
- type: action
icon: mdi:numeric-5-box
alignment: end
name: volume 5%
tap_action:
action: call-service
service: script.sonos_volume_op_5
data: {}
target: {}
card_mod:
style: |
ha-card {
--chip-background: rgba(var(--rgb-disabled), 0.2);
margin-top: 10px;
--chip-box-shadow: none;
--chip-border-radius: var(--control-border-radius);
--chip-border-width: 0;
--chip-height: 42px;
}
- type: action
icon: mdi:numeric-10-box
alignment: end
name: volume 10%
tap_action:
action: call-service
service: script.sonos_volume_op_10
data: {}
target: {}
card_mod:
style: |
ha-card {
--chip-background: rgba(var(--rgb-disabled), 0.2);
margin-top: 10px;
--chip-box-shadow: none;
--chip-border-radius: var(--control-border-radius);
--chip-border-width: 0;
--chip-height: 42px;
}
- type: action
icon: mdi:fast-forward-15
alignment: end
name: volume 15%
tap_action:
action: call-service
service: script.sonos_volume_op_15
data: {}
target: {}
card_mod:
style: |
ha-card {
--chip-background: rgba(var(--rgb-disabled), 0.2);
margin-top: 10px;
--chip-box-shadow: none;
--chip-border-radius: var(--control-border-radius);
--chip-border-width: 0;
--chip-height: 42px;
}
- type: action
icon: mdi:dice-d20
alignment: end
name: volume 20%
tap_action:
action: call-service
service: script.sonos_volume_op_20
data: {}
target: {}
card_mod:
style: |
ha-card {
--chip-background: rgba(var(--rgb-disabled), 0.2);
margin-top: 10px;
--chip-box-shadow: none;
--chip-border-radius: var(--control-border-radius);
--chip-border-width: 0;
--chip-height: 42px;
}
- type: grid
square: false
columns: 4
cards:
- type: custom:mushroom-template-card
entity: script.sonos_beam_christmas_hits
primary: Kerst-Hits
secondary: ''
icon: phu:christmas-tree
tap_action:
action: toggle
layout: vertical
hold_action:
action: none
double_tap_action:
action: none
icon_color: blue
card_mod:
style: |
ha-card {
--icon-symbol-size: 32px;
--icon-size: 64px;
}
- type: custom:mushroom-template-card
entity: script.sonos_beam_music_release_radar
primary: R-Radar
secondary: ''
icon: mdi:music
tap_action:
action: toggle
layout: vertical
hold_action:
action: none
double_tap_action:
action: none
icon_color: blue
card_mod:
style: |
ha-card {
--icon-symbol-size: 32px;
--icon-size: 64px;
}
- type: custom:mushroom-template-card
entity: script.sonos_beam_music_top_50_be
primary: Top50BE
secondary: ''
icon: mdi:music
tap_action:
action: toggle
layout: vertical
hold_action:
action: none
double_tap_action:
action: none
icon_color: blue
card_mod:
style: |
ha-card {
--icon-symbol-size: 32px;
--icon-size: 64px;
}
- type: custom:mushroom-template-card
entity: script.sonos_beam_music_top_50_nl
primary: Top50NL
secondary: ''
icon: mdi:music
tap_action:
action: toggle
layout: vertical
hold_action:
action: none
double_tap_action:
action: none
icon_color: blue
card_mod:
style: |
ha-card {
--icon-symbol-size: 32px;
--icon-size: 64px;
}
- type: custom:mushroom-template-card
entity: script.sonos_beam_music_hot_hits_be
primary: HothidsBE
secondary: ''
icon: mdi:music
tap_action:
action: toggle
layout: vertical
hold_action:
action: none
double_tap_action:
action: none
icon_color: blue
card_mod:
style: |
ha-card {
--icon-symbol-size: 32px;
--icon-size: 64px;
}
- type: custom:mushroom-template-card
entity: script.sonos_beam_music_discover_weekly
primary: D-Weekly
secondary: ''
icon: mdi:music
tap_action:
action: toggle
layout: vertical
hold_action:
action: none
double_tap_action:
action: none
icon_color: blue
card_mod:
style: |
ha-card {
--icon-symbol-size: 32px;
--icon-size: 64px;
}
- type: custom:mushroom-template-card
entity: script.sonos_beam_music_party_mix_2_vm
primary: PMix2VM
secondary: ''
icon: mdi:music-box-outline
tap_action:
action: toggle
layout: vertical
hold_action:
action: none
double_tap_action:
action: none
icon_color: blue
card_mod:
style: |
ha-card {
--icon-symbol-size: 32px;
--icon-size: 64px;
}
- type: custom:mushroom-template-card
entity: script.sonos_beam_music_party_mix_3_vm
primary: PMix3VM
secondary: ''
icon: mdi:music-box-outline
tap_action:
action: toggle
layout: vertical
hold_action:
action: none
double_tap_action:
action: none
icon_color: blue
card_mod:
style: |
ha-card {
--icon-symbol-size: 32px;
--icon-size: 64px;
}
- type: custom:mushroom-template-card
entity: script.sonos_beam_music_party_mix_4_vm
primary: PMix4VM
secondary: ''
icon: mdi:music-box-outline
tap_action:
action: toggle
layout: vertical
hold_action:
action: none
double_tap_action:
action: none
icon_color: blue
card_mod:
style: |
ha-card {
--icon-symbol-size: 32px;
--icon-size: 64px;
}
- type: custom:mushroom-template-card
entity: script.sonos_beam_music_party_mix_5_vm
primary: PMix5VM
secondary: ''
icon: mdi:music-box-outline
tap_action:
action: toggle
layout: vertical
hold_action:
action: none
double_tap_action:
action: none
icon_color: blue
card_mod:
style: |
ha-card {
--icon-symbol-size: 32px;
--icon-size: 64px;
}
- type: custom:mushroom-template-card
entity: script.sonos_beam_music_nieuwste_nummers
primary: NieuwsN
secondary: ''
icon: mdi:heart-circle-outline
tap_action:
action: toggle
layout: vertical
hold_action:
action: none
double_tap_action:
action: none
icon_color: blue
card_mod:
style: |
ha-card {
--icon-symbol-size: 32px;
--icon-size: 64px;
}
- type: custom:mushroom-template-card
entity: script.sonos_beam_music_macky_gee
primary: MackyGee
secondary: ''
icon: mdi:heart-pulse
tap_action:
action: toggle
layout: vertical
hold_action:
action: none
double_tap_action:
action: none
icon_color: blue
card_mod:
style: |
ha-card {
--icon-symbol-size: 32px;
--icon-size: 64px;
}
- type: custom:mushroom-template-card
entity: script.sonos_beam_radio_qmusic_belguim
primary: Qmusic
secondary: ''
icon: mdi:radio
tap_action:
action: toggle
layout: vertical
hold_action:
action: none
double_tap_action:
action: none
icon_color: blue
card_mod:
style: |
ha-card {
--icon-symbol-size: 32px;
--icon-size: 64px;
}
- type: custom:mushroom-template-card
entity: script.sonos_beam_radio_top_radio
primary: TOPRadio
secondary: ''
icon: mdi:radio
tap_action:
action: toggle
layout: vertical
hold_action:
action: none
double_tap_action:
action: none
icon_color: blue
card_mod:
style: |
ha-card {
--icon-symbol-size: 32px;
--icon-size: 64px;
}
- type: custom:mushroom-template-card
entity: script.sonos_beam_radio_top_techno
primary: TOPTechno
secondary: ''
icon: mdi:radio
tap_action:
action: toggle
layout: vertical
hold_action:
action: none
double_tap_action:
action: none
icon_color: blue
card_mod:
style: |
ha-card {
--icon-symbol-size: 32px;
--icon-size: 64px;
}
- type: custom:mushroom-template-card
entity: script.sonos_beam_radio_top_versuz
primary: TOPVersuz
secondary: ''
icon: mdi:radio
tap_action:
action: toggle
layout: vertical
hold_action:
action: none
double_tap_action:
action: none
icon_color: blue
card_mod:
style: |
ha-card {
--icon-symbol-size: 32px;
--icon-size: 64px;
}
- type: custom:mushroom-template-card
entity: script.sonos_beam_radio_top_retroarena
primary: TOPretroA
secondary: ''
icon: mdi:radio
tap_action:
action: toggle
layout: vertical
hold_action:
action: none
double_tap_action:
action: none
icon_color: blue
card_mod:
style: |
ha-card {
--icon-symbol-size: 32px;
--icon-size: 64px;
}
here are the possible if sonos is on tv source
playing
source_list: TV
group_members: media_player.sonos_beam, media_player.sonos_ra
volume_level: 0.04
is_volume_muted: false
media_content_id: x-sonos-htastream:RINCON_48A6B83ABBD601400:spdif
media_content_type: music
media_title: TV
shuffle: false
repeat: off
queue_size: 1
icon: phu:sonos-beam
friendly_name: Sonos Beam
supported_features: 981567
source: TV