Card-mod-icon broken in 3.1.5
See original GitHub issueHome Assistant Core 2022.6.1 Home Assistant Supervisor 2022.05.3 Home Assistant OS 8.1 Home Assistant OS running on VMWare VM on Windows 11
My lovelace configuration method (GUI or yaml): GUI (created card via GUI but then used “show code editor” to edit card yaml)
What I am doing: Using card-mod to change light entity icon based on state.
What I expected to happen: Light entity icon to change based on state (on or off).
What happened instead: Worked correctly in 3.1.4 but broken in 3.1.5. Tested switching back and forth between the versions and clearing browser cache.
Minimal steps to reproduce:
- Update to card-mod version 3.1.5
- Create a button card (in my case is within a grid) and link to an entity such light using provided code above.
- Save and view card. Try toggling the card entity. Note that the icon does not change.
# The least amount of code possible to reproduce my error
show_name: true
show_icon: true
type: button
tap_action:
action: toggle
entity: light.kitchen_bar
card_mod:
style: |
:host {
--card-mod-icon:
{% if is_state(config.entity, 'on') %} mdi:ceiling-light-multiple
{% else %} mdi:ceiling-light-multiple-outline
{% endif %}
}
# End of code
Error messages from the browser console:
DevTools failed to load source map: Could not load content for chrome-extension://pccckmaobkjjboncdfnnofkonhgpceea/js/hls.js.map: System error: net::ERR_BLOCKED_BY_CLIENT
Not sure if this is relevant since card-mod loads version 3.1.5 just fine.
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.
Issue Analytics
- State:
- Created a year ago
- Comments:12 (6 by maintainers)
Use triple “`” to format your code. Otherwise it looks like a “каша”.
still having reliability issues with the card-mod-icon, now using HA 2022.12 and card-mod 3.2.0
even though the mod I set seems to have been noticed by the Browser:
The wrong icon regularly peeps through, and it’s a random process when it finally succeeds. refresh, reload, clear cache, stop and re-open browser etc etc
Ive also tried with some different style templates:
and they do work in dev tools template, but still are a no show in the menu bar. Aware the aria-label might soon be taken out, Id love to keep modding those view icons.
Thomas is there an obvious error we’re making here? or:
roll back to 3.1.4 still saves the day:
and I still see the header classes I defined in card-mod-theme. Fingers crossed they will stay like that (and are not in cache somehow)