godfreym29
(Godfreym29)
September 17, 2024, 9:46am
7092
Iāve worked out how to change the text, but just canāt fathom how to conditionally change the text colourā¦
type: entities
entities:
- entity: input_number.heating_lounge_target_temperature
name: Lounge Target Temperature
icon: mdi:sofa
- entity: input_boolean.heating_lounge_boost
type: custom:multiple-entity-row
name: Lounge Boost
toggle: true
state_color: true
card_mod:
style: |
.entities-row div.entity:nth-child(1) div::before {
color: orange;
content: {%if is_state('switch.lounge_neo_standby','on') -%} "test on\A" {%- else -%} "test off\A" {%- endif %};
line-height: var(--mdc-typography-body1-line-height, 1.5rem);
}
.entities-row div.entity:nth-child(1) div {
color: transparent;
line-height: 0px;
}
entities:
- entity: switch.lounge_neo_standby
name: Standby
- entity: input_datetime.heating_lounge_boost_start
name: start
- entity: input_datetime.heating_lounge_boost_stop
name: stop
Hi lads,
Iāve tried to vertically align the content of my mushroomcar, but i canāt seem to do it:
type: custom:mushroom-template-card
primary: Spot
secondary: ''
icon: mdi:spotlight
entity: light.eetkamer_spot_midden
layout_options:
grid_columns: 1
grid_rows: 1
layout: vertical
fill_container: true
card_mod:
style: |
{% if is_state(config.entity,'on') %}
:host {
--ha-card-background: var(--blue-grey-color);
}
{% endif %}
ha-card{
border-radius: 0px;
min-height:220px;
vertical-align: middle;
--card-primary-font-size: 46px !important;
--card-primary-line-height: 46px !important;
}
mushroom-shape-icon {
--icon-size: 90px;
}
this strangly enough looks like this:
is there a way to lower the icon and text to the center?
1 Like
fwiw, Ive added that exact yaml to my test dashboard, and it scrolls along unfortunatelyā¦
jimz011
(Jim)
September 17, 2024, 3:42pm
7095
@Mariusthvdb please check out this thread and try again.
opened 11:14AM - 19 Jun 24 UTC
My Home Assistant version: 2024.6.3
With one of the latest Home Assistant updā¦ ates, the **position: sticky** property stopped working in some cases.
It works if you use it on a card that is in a grid.
```
type: grid
square: false
columns: 1
cards:
- type: custom:stack-in-card
mode: horizontal
card_mod:
style:
.: |
:host {
position: sticky !important;
z-index: 3 !important;
top: -20px !important;
}
ha-card {
transition: none !important;
border-radius: 0px;
background: var(--primary-background-color);
box-shadow: 0px 0px 6px 0px var(--primary-background-color) !important;
height: 80px;
margin: -8px -12px;
padding: 8px 12px;
}
cards:
- type: custom:mushroom-title-card
title: ŠŠ¾Š¼Š½Š°ŃŃ
title_tap_action:
action: navigate
navigation_path: rooms
card_mod:
style:
.: |
ha-card {
transition: none !important;
--primary-text-color: rgb(var(--rgb-grey));
--title-font-size: 16px;
--card-secondary-color: rgb(var(--rgb-grey));
--subtitle-font-size: 14px;
margin: 7px 0px -18px 0px;
}
- type: custom:mushroom-title-card
subtitle: 4 ŠøŠ· 9
title_tap_action:
action: navigate
navigation_path: rooms
card_mod:
style:
.: |
ha-card {
transition: none !important;
--primary-text-color: rgb(var(--rgb-grey));
--title-font-size: 16px;
--card-secondary-color: rgb(var(--rgb-grey));
--subtitle-font-size: 14px;
text-align: end;
margin: 8px 0px -4px 0px;
}
- type: grid
square: false
columns: 2
cards:
- type: custom:stack-in-card
card_mod:
style: |
ha-card {
transition: none !important;
height: 176px !important;
}
cards:
- type: custom:layout-card
layout_type: custom:grid-layout
layout:
grid-template-columns: auto auto
margin: '-4px -4px 0px -4px;'
cards:
- type: custom:mushroom-template-card
entity: input_text.gostinaia
tap_action:
action: more-info
icon: hue:room-living
primary: ŠŠ¾ŃŃŠøŠ½Š°Ń
layout: horizontal
badge_icon: null
card_mod:
style:
mushroom-state-info$: |
.primary {
transition: none !important;
font-size: 14px !important;
position: relative;
overflow: visible !important;
top: -50px;
left: -132px;
}
.secondary {
transition: none !important;
position: relative;
overflow: visible !important;
top: -62px;
left: -180px;
}
mushroom-shape-icon$: |
.shape {
transition: none !important;
position: relative;
left: -30px;
top: 75px;
--icon-color: rgb(253, 64, 112) !important;
--shape-color: rgba(254, 64, 112, 0.2) !important;
#--icon-symbol-size: 90px;
}
.: |
ha-card {
transition: none !important;
background: none;
box-shadow: none;
--badge-icon-size: 1em;
--badge-size: 1.5em;
width: 100px !important;
}
:host {
--mush-icon-size: 120px;
}
- type: custom:stack-in-card
card_mod:
style:
.: |
ha-card {
transition: none !important;
box-shadow: none;
}
cards:
- type: custom:mushroom-light-card
entity: light.lights_gostinaia
icon: mdi:lightbulb
primary_info: none
secondary_info: none
card_mod:
style:
.: |
ha-card {
transition: none !important;
padding-bottom: 0px !important;
--icon-border-radius: 12px;
align-items: flex-end;
}
- type: custom:mushroom-media-player-card
entity: media_player.gostinaia_tv
icon: mdi:motion-play-outline
primary_info: none
secondary_info: none
tap_action:
action: toggle
card_mod:
style: |
ha-card {
transition: none !important;
padding-bottom: 0px !important;
--icon-border-radius: 12px;
align-items: flex-end;
--rgb-state-media-player: 0, 188, 212;
}
- type: custom:mushroom-template-card
primary: []
icon_color: []
icon: []
secondary: []
card_mod:
style: |
ha-card {
transition: none !important;
padding-bottom: 0px !important;
--icon-border-radius: 12px;
align-items: flex-end;
}
```
But it doesn't work for stack-in-card, which is located in the main dashboard space
```
type: custom:stack-in-card
mode: vertical
card_mod:
style:
.: |
:host {
position: sticky !important;
z-index: 3 !important;
bottom: -20px !important;
}
ha-card {
transition: none !important;
box-shadow: 0px 0px 12px 0px var(--primary-background-color) !important;
background: var(--primary-background-color);
padding: 0px 0px 0px 0px;
margin: 0px -8px 0px;
border-radius: 0px;
height: 126px;
}
cards:
- type: custom:mushroom-chips-card
card_mod:
style: |
ha-card {
transition: none !important;
margin: 10px -10px -16px 1px !important;
box-shadow: inset 0px 0px 12px 10px var(--primary-background-color) !important;
}
ha-card > .chip-container {
flex-wrap: nowrap;
overflow-x: auto;
overscroll-behavior-x: contain;
scroll-snap-type: x mandatory;
scroll-snap-align: start;
}
ha-card > .chip-container > * {
flex-shrink: 0;
}
chips:
- type: template
card_mod:
style: |
ha-card {
transition: none !important;
background: none !important;
min-width: 0px !important;
width: 5px !important;
}
- type: template
entity: weather.gismeteo
content: |-
{{ states('sensor.current_weather') }}
{{ states('sensor.gismeteo_apparent_temperature') | round(0) }} Ā°C
icon: |-
{% if is_state('weather.gismeteo', 'sunny') %}
mdi:weather-sunny
{% elif is_state('weather.gismeteo', 'partlycloudy') %}
mdi:weather-partly-cloudy
{% elif is_state('weather.gismeteo', 'cloudy') %}
mdi:weather-cloudy
{% elif is_state('weather.gismeteo', 'rainy') %}
mdi:weather-rainy
{% elif is_state('weather.gismeteo', 'partly-rainy') %}
mdi:weather-partly-rainy
{% elif is_state('weather.gismeteo', 'pouring') %}
mdi:weather-pouring
{% elif is_state('weather.gismeteo', 'fog') %}
mdi:weather-fog
{% elif is_state('weather.gismeteo', 'hail') %}
mdi:weather-hail
{% elif is_state('weather.gismeteo', 'hazy') %}
mdi:weather-hazy
{% elif is_state('weather.gismeteo', 'lightning') %}
mdi:weather-lightning
{% elif is_state('weather.gismeteo', 'lightning-rainy') %}
mdi:weather-lightning-rainy
{% elif is_state('weather.gismeteo', 'partly-lightning') %}
mdi:weather-partly-lightning
{% elif is_state('weather.gismeteo', 'snowy') %}
mdi:weather-snowy
{% elif is_state('weather.gismeteo', 'snowy-heavy') %}
mdi:weather-snowy-heavy
{% elif is_state('weather.gismeteo', 'snowy-rainy') %}
mdi:weather-snowy-rainy
{% elif is_state('weather.gismeteo', 'partly-snowy') %}
mdi:weather-partly-snowy
{% elif is_state('weather.gismeteo', 'partly-snowy-rainy') %}
mdi:weather-partly-snowy-rainy
{% elif is_state('weather.gismeteo', 'clear-night') %}
mdi:weather-night
{% elif is_state('weather.gismeteo', 'night-partly-cloudy') %}
mdi:weather-night-partly-cloudy
{% endif %}
icon_color: >-
{% if is_state('weather.gismeteo', 'sunny') %} #FFF900 {% elif
is_state('weather.gismeteo', 'partlycloudy') %} #B3B6B7 {% elif
is_state('weather.gismeteo', 'cloudy') %} #626567 {% elif
is_state('weather.gismeteo', 'rainy') %} blue {% elif
is_state('weather.gismeteo', 'partly-rainy') %} #4E4DD8 {% elif
is_state('weather.gismeteo', 'pouring') %} #2E9AFE {% elif
is_state('weather.gismeteo', 'fog') %} #C0C0C0 {% elif
is_state('weather.gismeteo', 'hail') %} white {% elif
is_state('weather.gismeteo', 'hazy') %} grey {% elif
is_state('weather.gismeteo', 'lightning') %} #D9D401 {% elif
is_state('weather.gismeteo', 'lightning-rainy') %} #D9D401 {% elif
is_state('weather.gismeteo', 'partly-lightning') %} #D9D401 {% elif
is_state('weather.gismeteo', 'snowy') %} grey {% elif
is_state('weather.gismeteo', 'snowy-heavy') %} f5f5f5 {% elif
is_state('weather.gismeteo', 'snowy-rainy') %} f5f5f5 {% elif
is_state('weather.gismeteo', 'partly-snowy') %} f5f5f5 {% elif
is_state('weather.gismeteo', 'partly-snowy-rainy') %} f5f5f5 {% elif
is_state('weather.gismeteo', 'clear-night') %} #FFF900 {% elif
is_state('weather.gismeteo', 'night-partly-cloudy') %} #B3B6B7 {%
endif %}
card_mod:
style: |
ha-card {
transition: none !important;
margin: 2px;
margin-bottom: 10px;
padding: 1px 6px 1px 2px;
}
.content {
white-space: pre-wrap;
}
```
Someone had the same problem and tried my second code and it worked for him. Maybe it will help you.
1 Like
yeah, well, tbh, I only tried this for testing purposes.
Iāve added your second yaml suggestion
only to try what you reported, and unfortunately that did not work in my regular view.
I cant use the config in the link with the stack-in-card:
type: custom:mod-card
card_mod:
style: |
:host {
position: sticky;
top: 0;
z-index: 1;
}
card:
type: custom:stack-in-card
cards: []
because I donāt use that custom card. For me personally, no need to start using it for the Sticky
as a matter of fact, I am also hoping to be able to delete the layout-card, in my quest to use as few custom cards as possible.
I moved to single cards masonry
(default), or sections
where possible, only using the layout card in those views where core track cards have unexplained gapsā¦ or on views where I need the background to fill the full desktop view and show beyond the actual section space.
jmfargas
(jmfargas)
September 18, 2024, 4:37pm
7097
Does anybody know how to create a rule with card-mod to change the input[type=ārangeā] for a custom:slider-entity-row ? I need to add āpointer-events: none;ā
This is the code I need to add with card-mod:
card_mod:
style: |
input[type="range"] {
pointer-events: none;
}
But I donāt know where and how to add itā¦
Many thanks
so I didnt notice this before, but somehow the card_mod styling to this sensor entity is Not applied when I use the entity in a conditional row, when the styling is completely correct as a regular entity
Was this already noticed, and do we have a reason?
entities:
- entity: sensor.gdacs_alerts
card_mod:
style: |
:host {
{% set alert = states(config.entity)|int(0) %}
--card-mod-icon:
{{'mdi:shield-check' if alert == 0 else 'mdi:alert'}};
--card-mod-icon-color:
{{'var(--ok-color)' if alert == 0 else 'var(--alert-color)'}};
}
- type: conditional
conditions:
- entity: binary_sensor.gdacs_alerts
state: 'off'
row:
entity: sensor.gdacs_alerts
card_mod:
style: |
:host {
{% set alert = states(config.entity)|int(0) %}
--card-mod-icon:
{{'mdi:shield-check' if alert == 0 else 'mdi:alert'}};
--card-mod-icon-color:
{{'var(--ok-color)' if alert == 0 else 'var(--alert-color)'}};
}
Marius, styles should be set for the conditional row, not for the inner row.
right, I found this now:
Conditional row inside Entities card:
Do not use ":host" here.
type: vertical-stack
cards:
- type: entities
entities:
- input_boolean.test_boolean
- type: entities
entities:
- sun.sun
- type: conditional
conditions:
- entity: input_boolean.test_boolean
state: 'on'
row:
entity: sun.sun
icon: 'mdi:desk-lamp'
name: NƤhlicht Lampe
style:
hui-simple-entity-row$: |
hui-geneā¦
sorry, should have looked that up firstā¦
update
howeverā¦ I can make color: red
work so that proves the right structure, but when doing:
- type: conditional
conditions:
- entity: binary_sensor.gdacs_alerts
state: 'off'
row:
entity: sensor.gdacs_alerts
card_mod:
style:
hui-sensor-entity-row $: |
hui-generic-entity-row {
--card-mod-icon:
{% set alert = states(config.entity)|int(0) %}
{{'mdi:shield-check' if alert == 0 else 'mdi:alert'}};
--card-mod-icon-color:
{% set alert = states(config.entity)|int(0) %}
{{'var(--ok-color)' if alert == 0 else 'var(--alert-color)'}};
}
the card-mod-icon and -color are not effective.
needs more researchā¦
so given Styles may NOT be applied to Conditional row/element Ā· Issue #201 Ā· thomasloven/lovelace-card-mod Ā· GitHub my templates would seem fine. However, Ive found the config.entity
is not seen but the conditional row apparently, and need to change to the actual entity hard coded:
- type: conditional
conditions:
- entity: binary_sensor.gdacs_alerts
state: 'off'
row:
entity: sensor.gdacs_alerts
card_mod:
style:
hui-sensor-entity-row $: |
hui-generic-entity-row {
--card-mod-icon:
{% set alert = states('sensor.gdacs_alerts')|int(0) %}
{{'mdi:shield-check' if alert == 0 else 'mdi:alert'}};
--card-mod-icon-color:
{% set alert = states('sensor.gdacs_alerts')|int(0) %}
{{'var(--ok-color)' if alert == 0 else 'var(--alert-color)'}};
}
to get the icon and icon-color to change as I want them
made it a bit shorter with:
card_mod:
style:
hui-sensor-entity-row $: |
hui-generic-entity-row {
{% set alert = states('sensor.gdacs_alerts')|int(0) %}
--card-mod-icon:
mdi:{{'shield-check' if alert == 0 else 'alert'}};
--card-mod-icon-color:
var(--{{'ok' if alert == 0 else 'alert'}}-color);
}
too bad that config.,entity cant be used there, but if that is what it takesā¦
svkoch
September 18, 2024, 10:59pm
7102
color: {% if is_state('switch.lounge_neo_standby','on') %} green {% else %} red {% endif %} !important;
I think that should work
sebbaT
September 18, 2024, 11:27pm
7103
try this:
type: entities
entities:
- type: custom:slider-entity-row
entity: light.test-light-dimmer
card_mod:
style:
ha-slider$: |
div.container > input {
pointer-events: none;
}
would you believe after all these years, Ive never known about thatā¦
was this ever mentioned in this thread at all?
might be worth an addition to your main post on the conditional row
for reference and completeness:
type: entities
title: Mod regular entity and same entity in a conditional row
entities:
- entity: sensor.gdacs_alerts
card_mod:
style: |
:host {
{% set alert = states(config.entity)|int(0) %}
--card-mod-icon:
mdi:{{'shield-check' if alert == 0 else 'alert'}};
--card-mod-icon-color:
var(--{{'ok' if alert == 0 else 'alert'}}-color);
}
- type: conditional
conditions:
- entity: binary_sensor.gdacs_alerts
state: 'on'
row:
entity: sensor.gdacs_alerts
card_mod:
style:
hui-sensor-entity-row $: |
hui-generic-entity-row {
{% set alert = states(config.row.entity)|int(0) %}
--card-mod-icon:
mdi:{{'shield-check' if alert == 0 else 'alert'}};
--card-mod-icon-color:
var(--{{'ok' if alert == 0 else 'alert'}}-color);
}
1 Like
s_ockey
(Steve)
September 19, 2024, 6:29am
7105
Looking for some assistance. I have used card mod on other dashboard but canāt get it working as desired with glance card. I am trying to reduce the white space to condense the height of the card. Here is the yaml and card showing no impact. Where am I going wrong?
not sure this will be the cause (didnt check the main post on Glance card), but its !important
jmfargas
(jmfargas)
September 19, 2024, 8:30am
7107
@sebbaT Many thanks for your suggestion, unfortunately it doesnāt work ?
Iām not an expert at all about styles nor HASS, sorry. The following is a screen capture of the google Chrome inspector:
If I manually add āpointer-events: none;ā as a declaration inside the input[type=ārangeā]{} it worksā¦
I tried the following code, but it doesnāt work either:
card_mod:
style:
ha-slider $: |
div.container > input[type="range"] {
pointer-events: none;
}
Many thanks!
sebbaT
September 19, 2024, 9:01am
7108
You need to have the custom:slider-entity-row
within an entities card, or use custom:mod-card
:
Within an Entities Card:
type: entities
entities:
- type: custom:slider-entity-row
entity: light.test-light-dimmer
card_mod:
style:
ha-slider$: |
div.container > input {
pointer-events: none;
}
Within Mod Card:
type: custom:mod-card
card:
type: custom:slider-entity-row
entity: light.test-light-dimmer
card_mod:
style:
slider-entity-row$:
ha-slider$: |
div.container > input {
pointer-events: none;
}
f-zappa
September 19, 2024, 10:00am
7109
I need a hint - how to animate the icon within a tile card? I found a lot of examples for mushroom cards but not for the āvanillaā home assistant tile card.
s_ockey
(Steve)
September 19, 2024, 10:27am
7110
Thanks. Iāve tried removing the āimportantā but it hasnāt changed anything.
my post was not directed to removing the important
, but instead, adding the !
and use !important
.
Having said that, did you check the main post on styling the margins on the Glance cards in Ildars overview?