lovelace-card-mod: 3.4.0/1 breaks --card-mod-xxx variables.
My Home Assistant version: 2024.1.0b2
My lovelace configuration method (GUI or yaml): yaml
What I am doing:
modding an icon and icon color based on state What I expected to happen: immediate change when state changed What happened instead: need to refresh the state for the change to happen
note the --paper-item-icon-color:
does change upon state change, but replacing that with the --card-mod-icon-color:
makes the reload necessary
as a matter of fact, thats how I found this mod to no longer function the same as in 3.3.1
of course, there is no replacement for the icon element…
Minimal steps to reproduce:
# The least amount of code possible to reproduce my error
debug: true
style: |
:host {
--card-mod-icon:
{% set vol = states(config.entity)|float(0) %}
{% if vol == 0.0 %} mdi:volume-off
{% elif vol <= 0.3 %} mdi:volume-low
{% elif vol <= 0.6 %} mdi:volume-medium
{% else %} mdi:volume-high
{% endif %};
--paper-item-icon-color: # --card-mod-icon-color:
{% if vol == 0.0 %} gray
{% elif vol <= 0.3 %} dodgerblue
{% elif vol <= 0.6 %} green
{% elif vol <= 0.8 %} orange
{% else %} red
{% endif %};
}
# End of code
mods are injected like:
card_mod: !include /path/card_mods/volume_color.yaml
so the new requirement for the full hierarchy is already implemented (as I had those long before it became the new requirement now in 3.4.0)
Error messages from the browser console: set to debug, the mod is supposed to be set correctly upon state change:
but as said, it only happens on reload
By putting an X in the boxes ([]) below, I indicate that I:
-
Understand that this is a channel for reporting bugs, not a support forum (https://community.home-assistant.io/).
-
Have made sure I am using the latest version of the plugin.
-
Have followed the troubleshooting steps of the “Common Problems” section of https://github.com/thomasloven/hass-config/wiki/Lovelace-Plugins.
-
Understand that leaving one or more boxes unticked or failure to follow the template above may increase the time required to handle my bug-report, or cause it to be closed without further action.
About this issue
- Original URL
- State: closed
- Created 6 months ago
- Reactions: 3
- Comments: 24 (2 by maintainers)
Commits related to this issue
- More stable icon formatting. Fix #333 again. — committed to ace26873/lovelace-card-mod by thomasloven 6 months ago
- Typo in code. Fix #333 — committed to jerzik/lovelace-card-mod by thomasloven 6 months ago
Works fine for me as well
Yep, that one’s on me. I thought I had updated all of my cards, but I missed that one. I should have double checked. Apologies.
wow: seems rock solid! (#fingerscrossed this is not cache 😉 ) <strike>I mean, even those chatty hydro-temp entities (which I separated for the rest) now seem stable. Before the complete auto-entities card would constantly recalculate, and now this seems to happen only on the entries that actually change state.</strike> Was some cache after all I believe, still very chatty and flashy, but at least it works! Thank you very much!
btw, it would still be cool (because of above chatty issue) if we could set some
update_interval
on those auto-entities (like eg apexcharts has). Would you be willing to consider a FR for that? if yes, I’ll write it up .Try as I might I cannot reproduce this even once.
I’ve tried to add some extra styling checks though. At least things should work better now if themes and card icon styles are combined.
anyways, back to the issue at hand:
downgrading to 3.3.1 fixes it, and
--card-mod-icon
changes are immediate.--card-mod-icon-color
is functional again too.I corrected the small error in the example.
@erkr I try state() == ‘on’ , nothing change; I also edited the line white; to: –tile-color: white; same result.
Shall I open a new thread?
Man, that was a stupid typo…
Fix is coming up.