I am trying to make the icon spin on the simple-thermostat card.
So far I got it to change color depending on the state of an input_boolean, but no rotation, what am I missing?
type: custom:simple-thermostat
entity: climate.workroom
header:
icon: mdi:fan
step_size: 1
control:
hvac:
'off':
name: 'Off'
icon: mdi:fan
fan_only:
name: Fan
heat:
name: Heat
icon: mdi:fire
cool:
name: Cool
heat_cool: false
dry: false
layout:
step: row
mode:
headings: false
icons: true
names: true
hide:
state: false
decimals: 0
card_mod:
style: |
:host {
{% if is_state('input_boolean.x1c_details', 'on') %}
--card-mod-icon-color: yellow;
animation: rotation 2s linear infinite;
{% else %}
--card-mod-icon-color: #03a9f4;
{% endif %}
}
@keyframes rotation {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
As you donāt want to rotate :host (even not possible), you have to assign the rotation to the object you want to rotate.
seems to be working! thanks so much once again
1 Like
Got it working!
card_mod:
style: |
{% if is_state('switch.inline_fan_fan', 'on') %}
.header__icon {
animation: rotation 2s linear infinite;
}
{% endif %}
@keyframes rotation {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
CZonin
May 8, 2024, 4:26pm
6470
Hey everyone. Looking to get some help on a the last few items for my setup. Iāve typically been able to get things working through trial and error, but I canāt seem to figure these out. Any help would be appreciated.
The first are these circular buttons in the Frigate card. Iām trying to change the background circle color, as well as the icon color:
For the background circle color, the card-mod helper output is
"body>home-assistant$home-assistant-main$ha-drawer>partial-panel-resolver>ha-panel-lovelace$hui-root$#view>hui-view>hui-masonry-view$#columns>div>hui-vertical-stack-card$#root>frigate-card$#ha-card>frigate-card-menu$div.matching>ha-icon-button:nth-child(1)"
with the property to change being background-color
within ha-icon-button.button
.
The icon color for it is within the same card-mod helper output, and the property is color
, but this is not within ha-icon-button.button
.
The last thing is the selected icon color within the controls in a tile card:
The card-mod helper output is:
"body>home-assistant$home-assistant-main$ha-drawer>partial-panel-resolver>ha-panel-lovelace$hui-root$#view>hui-view>hui-masonry-view$#columns>div>hui-vertical-stack-card$#root>hui-tile-card$ha-card>hui-card-features$hui-fan-speed-card-feature$div>ha-control-select$#option-off"
with the property being color
within .option.selected
For all of these, Iām able to get the property I want changed when inspecting, but canāt figure out how to format it properly for card-mod.
Peet
(Peet van Dijk)
May 9, 2024, 7:24am
6471
I am monitoring a fire-alarm panel, which used to work.
Log says: Template error: int got invalid input āNoneā when rendering template ā{{ state_attr(āsensor.sensor_thingspeakā, āfield1ā) | int}}ā but no default was specified.
field1: "0"
Nothing has been changed lately, canāt see any errors
type: picture-elements
card_mod:
style: |
@keyframes my-blink {
from {opacity: 0;}
to {opacity: 100;}
from {opacity: 100;}
to {opacity: 0;}
}
ha-card {
--my-fire-color: {% if state_attr("sensor.sensor_thingspeak", "field1") | int == 1 %} red {% else %} darkgrey {% endif %};
--my-trouble-color: {% if state_attr("sensor.sensor_thingspeak", "field2")| int == 1 %} orange {% else %} darkgrey {% endif %};
--my-rmh-color: {% if states('sensor.rookmelder_hal_smoke_amount')|int >= 5 %} red {% else %} darkgrey {% endif %};
--my-rmo-color: {% if states('sensor.rookmelder_overloop_smoke_amount')|int >= 5 %} red {% else %} darkgrey {% endif %};
--my-rmz-color: {% if states('sensor.rookmelder_zolder_smoke_amount')|int >= 5 %} red {% else %} darkgrey {% endif %};
--my-co-color: {% if states('binary_sensor.co_alarm')=='on' %} red {% else %} darkgrey {% endif %};
--my-test-color: {% if state_attr("sensor.sensor_thingspeak", "field5") |int==1 %} green {% else %} red {% endif %};
}
elements:
- type: icon
icon: mdi:circle
style:
top: 77%
left: 26.2%
color: lightgreen
animation: my-blink 2s linear infinite
transform: scale(.6,.6)
- type: icon
icon: mdi:circle
style:
top: 17.5%
left: 26.2%
transform: scale(.6,.6)
color: var(--my-fire-color)
- type: icon
icon: mdi:circle
style:
top: 17.5%
left: 29.2%
transform: scale(.6,.6)
color: var(--my-fire-color)
- type: icon
icon: mdi:circle
style:
top: 29%
left: 26.2%
transform: scale(.6,.6)
color: var(--my-trouble-color)
- type: icon
icon: mdi:circle
style:
top: 17.5%
left: 7.7%
transform: scale(.6,.6)
color: var(--my-rmh-color)
- type: icon
icon: mdi:circle
style:
top: 29%
left: 7.7%
transform: scale(.6,.6)
color: var(--my-rmo-color)
- type: icon
icon: mdi:circle
style:
top: 41.5%
left: 7.7%
transform: scale(.6,.6)
color: var(--my-rmz-color)
- type: icon
icon: mdi:circle
style:
top: 53%
left: 7.7%
transform: scale(.6,.6)
color: var(--my-co-color)
- type: icon
icon: mdi:circle
style:
top: 17.5%
left: 72%
transform: scale(.6,.6)
color: var(--my-test-color)
image: /local/images/bmc.png?v=7.0
Try using a format similar to thisā¦
--my-fire-color: {{ 'red' if state_attr('sensor.sensor_thingspeak', 'field1') | int == 1 else 'darkgrey' }};
I assume the code was AI generate?
Peet
(Peet van Dijk)
May 9, 2024, 8:24am
6473
Nope, no AI here, just googlingā¦
Iāve changed all the color lines, at least the blinking is back but the icons remain black
safvan89
(safvan)
May 9, 2024, 4:11pm
6474
is there any way to change tile card featuresā buttonās icons?
I tried to dig using inspector but nothing seems to work.
Depending on the card, yes. This a good thread to review.
@boheme61
In the morning I think you are right.
May be I should have been more patient and explain with details in the very beginning.
Please accept my apologize if I was rude.
For the record:
Tile card has nice default features:
ā iconās color depends on a domain & state;
ā cardās background gets the same color (with transparency) on hover.
So there are possible ways to style this behaviour.
Disclaimer: I am not an expert on the Tile card, so more possible ways of styling could be posā¦
I have the hover over icons working but it doesnāt seem to work when hovering over labels. I tried a few things but couldnāt quite get it. Is there a way to do this with the label:
attribute? Thanks.
Ildar_Gabdullin:
Hilight icons on hover:
Code
type: custom:mod-card
card_mod:
style:
tabbed-card $: |
mwc-tab:hover {
--mdc-theme-primary: red;
--mdc-tab-color-default: red;
}
card:
type: custom:tabbed-card
attributes:
icon: mdi:circle
tabs:
- card:
type: entities
entities:
- sun.sun
attributes:
icon: mdi:numeric-1-circle
- card:
type: entities
entities:
- sun.sun
attributes:
icon: mdi:numeric-2-circle
- card:
type: entities
entities:
- sun.sun
attributes:
icon: mdi:numeric-3-circle
- card:
type: entities
entities:
- sun.sun
attributes:
icon: mdi:numeric-4-circle
- card:
type: entities
entities:
- sun.sun
attributes:
icon: mdi:numeric-5-circle
chpego
(Chpego)
May 11, 2024, 12:33pm
6477
Hi all !
Iām trying to blinking an icon, where the state of an entity, on the picture element with card_mod, but doesnāt work :
- type: picture-elements
image: /local/rlKlbf6LYE.png
elements:
- type: state-icon
entity: cover.ikea_of_sweden_praktlysing_cellular_blind_volets
style:
left: 13%
top: 47%
tap_action:
action: toggle
card_mod:
style: |
:host {
{% if ( states('sensor.ikea_of_sweden_praktlysing_cellular_blind_batterie') | int ) < 20 %}
animation: blink 2s linear infinite;
color: red;
{% endif %}
}
Iāve made several searches but I canāt get the icon to flash red.
Update, i found myself :
card_mod:
style: |
:host {
{% if ( states('sensor.ikea_of_sweden_praktlysing_cellular_blind_batterie') | int ) < 20 %}
animation: blink 2s linear infinite;
--card-mod-icon-color: red;
{% endif %}
}
@keyframes blink {
50% {opacity: 0;}
}
Hi, I have a custom button card with a entity picture image ( the currently playing cover). It is possible to fade in the image every time that change? Now load without any transition. Is possible with card-mod?
Thanks in advance
hi,
can anybody tell me how to change the color of the icon inside a custom secondaryinfo-entity-row depending on a sensors state?
i have tried nearly everythingā¦
the bird should be yellow if motion ia detected and the slider turns the guest mode on or off
thx in advance
Can you show your not working code/your tries?
name: GƤstemodus
state_color: true
type: custom:secondaryinfo-entity-row
secondary_info: '[[ binary_sensor.bewegungsmelder_bad.state ]]'
card_mod:
style: |
ha-card {
{% if states('sensor.bewegungsmelser_bad') = 'on' %}
--card-mod-icon-color: var(--amber-color);
{% else %}
--card-mod-icon-color: grey;
{% endif %}
}
this was the last code.
i also tried without card-mod at the beginning, because i read about a breaking change not to use this anymore.
i used --paper-item-icon-color instead
inserted the color without template
and tried to use a kind of this
card_mod:
style:
hui-generic-entity-row $: |
.info.pointer .secondary ha-relative-time {
{% if is_state('sensor.bewegungsmelder_bad', 'on' %}
color: red;
{% endif %}
}
works alright here in any combination with or without icon using this:
card:
type: custom:mod-card
card_mod:
style:
tabbed-card:
$:
.: |
mwc-tab:hover {
--mdc-theme-primary: var(--power-color);
--mdc-tab-color-default: var(--power-color);
}
mwc-tab-bar {
background: {{'var(--lovelace-background)'
if states('input_select.theme')|regex_search('(ight|Dark|Matrix)')
else 'var(--primary-color)'}};
}
mwc-tab:
$:
mwc-tab-indicator $: |
.mdc-tab-indicator__content--underline {
border-color: var(--active-color);
}
.: |
.mdc-tab {
min-width: 80px;
}
.material-icons {
display: contents !important;
}
.mdc-tab--active {
--mdc-icon-size: {{states('input_number.active_icon_size')}}px;
/*background: var(--text-color-off) !important;*/
}
card:
type: custom:tabbed-card
# attributes:
# isFadingIndicator: true
styles:
--mdc-tab-horizontal-padding: 4px;
--mdc-theme-primary: var(--active-color)
# --mdc-theme-secondary: var(--text-color-off) # not functional
--mdc-tab-color-default: var(--text-primary-color)
tabs:
'[[tabs]]'
Note I did some other tab mods, so I had to change the Dom path a bit, maybe its just what you need
I apologize @Mariusthvdb , I should have explained myself better. Currently when hovering over the active tab the icon, label text, and underline are all highlighted. However, when hovering over an inactive tab only the icon is highlighted. Since I donāt use icons on the tabs and only the label text is displayed, when I hover Iād like the label text to highlight.
Yes, that is what I tested and see happening with the mod I posted. Text only label gets highlighted when hovered
Is there a way to target the ha-sortable element inside of the drag-and-drop sections ?
Iāve tried several ways to add this but I canāt find the right selectorsā¦
What Iām trying to reproduce:
Here is the exact thing Iām trying to target (but any above element could do):
Iāve tried to add this to that specific section:
card-mod:
style: |
ha-sortable$: |
.card {
padding: 20px 17px;
background-color: white;
border-radius: 1em;
}
Without much luckā¦ tried also a few other selectors like hui-grid-section but nothing seems to work
Maybe this? But no luck either
card_mod:
style:
hui-section$: |
.container {
padding: 20px 17px!important;
background-color: white !important;
border-radius: 1em !important;
}