Hi all, Iām working on this mini project to try and port a footer that looks like this. Now I will post the photos of what I managed to create by making do with my knowledge, but above all by studying the examples posted by the great @rhysb here on the forum.
Also Iād like to thank @piitaya for making these awesome cards.
Letās get to the point, this is my card:
NORMAL MODE
MUSIC MODE
In normal mode, the card allows you to switch between the various cards you see.
In music mode, the card will make room for a cute popup that will show the current track.
In all of this though, I need your help:
-
First @rhysb, Iām asking for your help to fix the CSS of this card a bit, especially to keep it stuck at the bottom.
-
create a popup or card extension at the bottom āHomeā , where you can choose the room to display via an input_select and state-switch.
-
Implement any popup on press for music
-
Any idea is welcome.
I am also attaching the code below if you want to test it (the sticky card code is missing because it doesnāt work as I would like)
type: custom:state-switch
entity: media_player.camera_mattia
default: <default>
transition: <transition>
transition_time: <transition_time>
states:
'off':
type: horizontal-stack
cards:
- type: custom:stack-in-card
mode: horizontal
cards:
- type: custom:mushroom-template-card
primary: |-
{% if is_state('input_select.seleziona_stanza', 'Home') %}
Home
{% elif is_state('input_select.seleziona_stanza', 'Cucina') %}
Cucina
{% elif is_state('input_select.seleziona_stanza', 'Salotto') %}
Salotto
{% endif %}
secondary: ''
icon: |-
{% if is_state('input_select.seleziona_stanza', 'Home') %}
mdi:home
{% elif is_state('input_select.seleziona_stanza', 'Cucina') %}
mdi:fridge
{% elif is_state('input_select.seleziona_stanza', 'Salotto') %}
mdi:sofa
{% endif %}
icon_color: white
entity: input_select.seleziona_stanza
tap_action: none
card_mod:
style: |
ha-card {
--spacing: 8px;
--icon-size: 35px;
--primary-text-color: rgb(var(--rgb-white));
}
mushroom-shape-icon {
--shape-color: none !important;
}
- type: custom:mushroom-chips-card
chips:
- type: template
entity: input_boolean.menu
double_tap_action:
action: none
icon: mdi:chevron-up
tap_action:
action: fire-dom-event
browser_mod:
service: browser_mod.popup
data:
title: Rhys
content:
type: vertical-stack
cards:
- type: custom:stack-in-card
cards:
- type: custom:mushroom-chips-card
chips:
- type: back
card_mod:
style: |
ha-card {
position: absolute;
left: 0px;
top: 10px;
}
alignment: end
card_mod:
style:
mushroom-template-chip:
$: |
mushroom-chip {
cursor: default !important;
}
.: |
ha-card {
height: var(--chip-height);
margin-right: calc(-1 * var(--chip-spacing));
transition: all 0s;
}
.chip-container * {
margin: 10px 10px 0px 0px;
display: flex;
}
mushroom-conditional-chip {
margin: 0px !important;
}
- type: custom:mushroom-title-card
title: 'Seleziona la vista:'
subtitle: ''
alignment: center
card_mod:
style: |
:host {
position: relative;
top: 0px;
z-index: 1;
--mush-title-padding: 12px 0px 12px;
}
ha-card {
background: rgba(var(--rgb-card-background-color), 0.2);
backdrop-filter: blur(5px);
-webkit-backdrop-filter: blur(5px);
padding: var(--mush-chip-spacing, 8px);
border-radius: 0 0 24px 24px;
margin: -8px 0px 34px;
box-shadow: 0px 4px 8px -2px rgba(0, 0, 0, 0.16);
transition: all 0s;
}
ha-card:before {
content: "";
position: absolute;
width: 100%;
height: 100%;
left: 0px;
//background: url('/local/camera_mattia.jpg') top center / 100%;
opacity: 0.4;
z-index: -1;
margin-top: -8px;
- type: vertical-stack
cards:
- type: custom:mushroom-template-card
primary: Home
secondary: ''
icon: mdi:home
icon_color: black
fill_container: false
layout: horizontal
entity: input_select.seleziona_stanza
tap_action:
action: call-service
service: input_select.select_option
target:
entity_id: input_select.seleziona_stanza
data:
option: Home
card_mod:
style: |
ha-card {
width: 200px;
height: 20px;
--spacing: 0px;
padding-bottom: calc(var(--spacing) * 1.618) !important;
box-shadow: var(--ha-card-box-shadow) !important;
border-radius: 10px 10px 10px10px !important;
margin-left: auto;
margin-right: auto;
transition: all 0s;
--icon-size: 35px;
--primary-text-color: rgb(var(--rgb-black));
{% if is_state('input_select.seleziona_stanza', 'Home') %}
background: #eeeee4;
width: 300px;
height: 20px;
{% endif %}
}
mushroom-shape-icon {
--shape-color: none !important;
}
- type: custom:mushroom-template-card
primary: Cucina
secondary: ''
icon: mdi:fridge
icon_color: black
fill_container: false
layout: horizontal
entity: input_select.seleziona_stanza
tap_action:
action: call-service
service: input_select.select_option
target:
entity_id: input_select.seleziona_stanza
data:
option: Cucina
card_mod:
style: |
ha-card {
width: 200px;
height: 20px;
--spacing: 0px;
padding-bottom: calc(var(--spacing) * 1.618) !important;
box-shadow: var(--ha-card-box-shadow) !important;
border-radius: 10px 10px 10px10px !important;
margin-left: auto;
margin-right: auto;
transition: all 0s;
--icon-size: 35px;
--primary-text-color: rgb(var(--rgb-black));
{% if is_state('input_select.seleziona_stanza', 'Cucina') %}
background: #eeeee4;
width: 300px;
height: 20px;
{% endif %}
}
mushroom-shape-icon {
--shape-color: none !important;
}
- type: custom:mushroom-template-card
primary: Salotto
secondary: ''
icon: mdi:sofa
icon_color: black
fill_container: false
layout: horizontal
entity: input_select.seleziona_stanza
tap_action:
action: call-service
service: input_select.select_option
target:
entity_id: input_select.seleziona_stanza
data:
option: Salotto
card_mod:
style: |
ha-card {
width: 200px;
height: 20px;
--spacing: 0px;
padding-bottom: calc(var(--spacing) * 1.618) !important;
box-shadow: var(--ha-card-box-shadow) !important;
border-radius: 10px 10px 10px10px !important;
margin-left: auto;
margin-right: auto;
transition: all 0s;
--icon-size: 35px;
--primary-text-color: rgb(var(--rgb-black));
{% if is_state('input_select.seleziona_stanza', 'Salotto') %}
background: #eeeee4;
width: 300px;
height: 20px;
{% endif %}
}
mushroom-shape-icon {
--shape-color: none !important;
}
card_mod:
style:
ha-header-bar$: |
.mdc-top-app-bar__section--align-start {
justify-content: end !important;
}
.mdc-top-app-bar__section {
padding: 0px !important;
}
.mdc-top-app-bar__title {
display: none;
}
.mdc-top-app-bar__row {
height: 36px !important;
}
.mdc-top-app-bar {
padding: 8px;
}
.: |
ha-icon-button {
background: color-mix(in srgb, var(--grey-color) 10%, transparent);
border-radius: var(--mush-chip-border-radius, 19px);
border: var(--ha-card-border-width, 1px) solid var(--ha-card-border-color, var(--divider-color, #e0e0e0)) !important;
}
ha-header-bar {
margin-bottom: -64px;
width: 36px;
margin-left: auto !important;
}
:host {
--popup-padding-x: 0px;
--popup-padding-y: 0px;
--popup-min-width: 450px;
--mdc-icon-button-size: 36px;
--mdc-icon-size: 18px;
}
.content {
margin: -24px -24px -24px !important;
}
hold_action:
action: none
card_mod:
style: |
ha-card {
margin-top: 7px;
margin-left: 50px;
--chip-icon-size: 20px;
--chip-box-shadow: none;
--chip-background: none;
--chip-spacing: 0;
}
card_mod:
style: |
ha-card {
padding: 0px;
width: 210px;
height: 50px;
box-shadow: var(--ha-card-box-shadow) !important;
border-radius: 35px 35px 35px 35px !important;
background: var(--card-background-color);
}
- type: custom:mushroom-template-card
secondary: ''
icon: mdi:music-note-eighth
layout: vertical
icon_color: blue
tap_action:
action: navigate
navigation_path: house
card_mod:
style: |
ha-card {
width: 50px;
--spacing: 5px;
background: var(--card-background-color) !important;
box-shadow: var(--ha-card-box-shadow) !important;
border-radius: calc(var(--ha-card-border-radius, 12px) * 2) !important;
margin-top: 0px;
margin-left: 120px;
transition: all 0.5s;
}
- type: custom:mushroom-template-card
secondary: ''
icon: mdi:video
layout: vertical
icon_color: ''
tap_action:
action: navigate
navigation_path: house
card_mod:
style: |
ha-card {
width: 50px;
--spacing: 5px;
background: var(--card-background-color) !important;
box-shadow: var(--ha-card-box-shadow) !important;
border-radius: calc(var(--ha-card-border-radius, 12px) * 2) !important;
margin-top: 0px;
margin-left: 80px;
transition: all 0s;
}
- type: custom:mushroom-template-card
secondary: ''
icon: mdi:chart-bar
layout: vertical
icon_color: orange
tap_action:
action: navigate
navigation_path: house
card_mod:
style: |
ha-card {
width: 50px;
--spacing: 5px;
background: var(--card-background-color) !important;
box-shadow: var(--ha-card-box-shadow) !important;
border-radius: calc(var(--ha-card-border-radius, 12px) * 2) !important;
margin-top: 0px;
margin-left: 40px;
transition: all 0s;
}
idle:
type: horizontal-stack
cards:
- type: custom:mushroom-template-card
secondary: ''
icon: |-
{% if is_state('input_select.seleziona_stanza', 'Home') %}
mdi:home
{% elif is_state('input_select.seleziona_stanza', 'Cucina') %}
mdi:fridge
{% elif is_state('input_select.seleziona_stanza', 'Salotto') %}
mdi:sofa
{% endif %}
layout: vertical
icon_color: white
tap_action:
action: navigate
navigation_path: house
card_mod:
style: |
ha-card {
width: 50px;
--spacing: 5px;
background: var(--card-background-color) !important;
box-shadow: var(--ha-card-box-shadow) !important;
border-radius: calc(var(--ha-card-border-radius, 12px) * 2) !important;
margin-top: 0px;
margin-left: 0px;
transition: all 0.5s;
}
- type: custom:stack-in-card
mode: horizontal
cards:
- type: custom:mushroom-media-player-card
entity: media_player.camera_mattia
layout: horizontal
show_volume_level: true
use_media_info: true
card_mod:
style: |
mushroom-shape-icon {
display: flex;
{% set media_type = state_attr(config.entity, 'media_content_type') %}
{% if media_type == 'tvshow' %}
--card-mod-icon: mdi:television-classic;
animation: flicker 1s linear infinite alternate;
{% elif media_type == 'movie' %}
--card-mod-icon: mdi:movie-roll;
animation: spin 2s linear infinite reverse;
{% elif media_type == 'music' %}
--card-mod-icon: mdi:music;
animation: beat 1.3s ease-out infinite both;
{% elif media_type == 'playlist' %}
--card-mod-icon: mdi:music;
animation: beat 1.3s ease-out infinite both;
{% 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 {
{% if not is_state(config.entity, 'off') %}
background: rgba(var(--rgb-card-background-color), 0.6) url( '{{ state_attr(config.entity, "entity_picture") }}' ) center no-repeat;
background-size: cover;
background-blend-mode: overlay;
{% endif %}
border-radius: 35px 35px 35px 35px !important;
height: 50px !important;
margin-left: -8px;
}
card_mod:
style: |
ha-card {
width: 210px;
box-shadow: var(--ha-card-box-shadow) !important;
border-radius: 35px 35px 35px 35px !important;
margin-left: -40px;
{% if is_state('media_player.camera_mattia', 'off') %}
{% else %}
background-image: url( '{{ state_attr( "media_player.camera_mattia", "entity_picture" ) }}' );
background-position: center;
background-repeat: no-repeat;
background-size: cover;
background-color: rgba(var(--rgb-card-background-color), 0.8);
background-blend-mode: overlay;
position: relative;
{% endif %}
}
- type: custom:mushroom-template-card
secondary: ''
icon: mdi:video
layout: vertical
icon_color: ''
tap_action:
action: navigate
navigation_path: house
card_mod:
style: |
ha-card {
width: 50px;
--spacing: 5px;
background: var(--card-background-color) !important;
box-shadow: var(--ha-card-box-shadow) !important;
border-radius: calc(var(--ha-card-border-radius, 12px) * 2) !important;
margin-top: 0px;
margin-left: 80px;
transition: all 0s;
}
- type: custom:mushroom-template-card
secondary: ''
icon: mdi:chart-bar
layout: vertical
icon_color: orange
tap_action:
action: navigate
navigation_path: house
card_mod:
style: |
ha-card {
width: 50px;
--spacing: 5px;
background: var(--card-background-color) !important;
box-shadow: var(--ha-card-box-shadow) !important;
border-radius: calc(var(--ha-card-border-radius, 12px) * 2) !important;
margin-top: 0px;
margin-left: 40px;
transition: all 0s;
}
playing:
type: horizontal-stack
cards:
- type: custom:mushroom-template-card
secondary: ''
icon: |-
{% if is_state('input_select.seleziona_stanza', 'Home') %}
mdi:home
{% elif is_state('input_select.seleziona_stanza', 'Cucina') %}
mdi:fridge
{% elif is_state('input_select.seleziona_stanza', 'Salotto') %}
mdi:sofa
{% endif %}
layout: vertical
icon_color: white
tap_action:
action: navigate
navigation_path: house
card_mod:
style: |
ha-card {
width: 50px;
--spacing: 5px;
background: var(--card-background-color) !important;
box-shadow: var(--ha-card-box-shadow) !important;
border-radius: calc(var(--ha-card-border-radius, 12px) * 2) !important;
margin-top: 0px;
margin-left: 0px;
transition: all 0.5s;
}
- type: custom:stack-in-card
mode: horizontal
cards:
- type: custom:mushroom-media-player-card
entity: media_player.camera_mattia
layout: horizontal
show_volume_level: true
use_media_info: true
card_mod:
style: |
mushroom-shape-icon {
display: flex;
{% set media_type = state_attr(config.entity, 'media_content_type') %}
{% if media_type == 'tvshow' %}
--card-mod-icon: mdi:television-classic;
animation: flicker 1s linear infinite alternate;
{% elif media_type == 'movie' %}
--card-mod-icon: mdi:movie-roll;
animation: spin 2s linear infinite reverse;
{% elif media_type == 'music' %}
--card-mod-icon: mdi:music;
animation: beat 1.3s ease-out infinite both;
{% elif media_type == 'playlist' %}
--card-mod-icon: mdi:music;
animation: beat 1.3s ease-out infinite both;
{% 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 {
{% if not is_state(config.entity, 'off') %}
background: rgba(var(--rgb-card-background-color), 0.6) url( '{{ state_attr(config.entity, "entity_picture") }}' ) center no-repeat;
background-size: cover;
background-blend-mode: overlay;
{% endif %}
border-radius: 35px 35px 35px 35px !important;
height: 50px !important;
margin-left: -8px;
}
card_mod:
style: |
ha-card {
width: 210px;
box-shadow: var(--ha-card-box-shadow) !important;
border-radius: 35px 35px 35px 35px !important;
margin-left: -40px;
{% if is_state('media_player.camera_mattia', 'off') %}
{% else %}
background-image: url( '{{ state_attr( "media_player.camera_mattia", "entity_picture" ) }}' );
background-position: center;
background-repeat: no-repeat;
background-size: cover;
background-color: rgba(var(--rgb-card-background-color), 0.8);
background-blend-mode: overlay;
position: relative;
{% endif %}
}
- type: custom:mushroom-template-card
secondary: ''
icon: mdi:video
layout: vertical
icon_color: ''
tap_action:
action: navigate
navigation_path: house
card_mod:
style: |
ha-card {
width: 50px;
--spacing: 5px;
background: var(--card-background-color) !important;
box-shadow: var(--ha-card-box-shadow) !important;
border-radius: calc(var(--ha-card-border-radius, 12px) * 2) !important;
margin-top: 0px;
margin-left: 80px;
transition: all 0s;
}
- type: custom:mushroom-template-card
secondary: ''
icon: mdi:chart-bar
layout: vertical
icon_color: orange
tap_action:
action: navigate
navigation_path: house
card_mod:
style: |
ha-card {
width: 50px;
--spacing: 5px;
background: var(--card-background-color) !important;
box-shadow: var(--ha-card-box-shadow) !important;
border-radius: calc(var(--ha-card-border-radius, 12px) * 2) !important;
margin-top: 0px;
margin-left: 40px;
transition: all 0s;
}