Closed ildar170975 closed 2 years ago
The same issue was observed while trying to card-mod a fold-entity-row
:
https://community.home-assistant.io/t/card-mod-super-charge-your-themes/212176/1042?u=ildar_gabdullin
As a result - the styles was not applied to the fold-entity-row
when the theme was active.
A possible solution:
Instead of this:
card-mod-row-yaml: |
.: |
hui-generic-entity-row .text-content {
{% if states(config.entity) in ['unavailable','unknown'] %}
color: magenta;
{% endif %}
}
use this:
card-mod-row-yaml: |
.: |
hui-generic-entity-row .text-content {
{% if config is defined %}
{% if config.entity is defined %}
{% if states(config.entity) in ['unavailable','unknown'] %}
color: magenta;
{% endif %}
{% endif %}
{% endif %}
}
Some rows do not have a "config.entity" object probably.
My Home Assistant version: 2022.2.9
My lovelace configuration method (GUI or yaml): yaml/storage
What I am doing: Applying styles by card-mod theme. The main idea is to highlight
unavailable
entities. To simulate anunavailable
entity, a template sensor is created.What I expected to happen: Styles are applied w/o errors.
What happened instead: Styles are applied, there are errors in the log and in the Code Inspector.
Minimal steps to reproduce: 1) Create a theme:
2) Create a template sensor:
3) Create a card:
4) The card looks like:![изображение](https://user-images.githubusercontent.com/71872483/154819401-0981ce66-e9ca-4df6-9453-0a5a49572af3.png)
5) Check that the styles are applied properly. For the![изображение](https://user-images.githubusercontent.com/71872483/154819639-c9fe08d0-b079-4032-9161-8cbe7176c44e.png)
unavailable
entity the style is applied as below:6) See errors in the log:
Error messages from the browser console:![изображение](https://user-images.githubusercontent.com/71872483/154819424-650863c8-e4b1-4214-871d-e338a1ecdb72.png)
By putting an X in the boxes ([]) below, I indicate that I:
[x] Understand that this is a channel for reporting bugs, not a support forum (https://community.home-assistant.io/).
[x] Have made sure I am using the latest version of the plugin.
[x] Have followed the troubleshooting steps of the "Common Problems" section of https://github.com/thomasloven/hass-config/wiki/Lovelace-Plugins.
[x] 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.