[X] I'm running the latest version of CustomUI (Update guide) or using a specific release that is not marked as "Broken".
[X] I tried to force-refresh (Ctrl+Shift+R / Ctrl+F5) the browser
[X] (Optional, but recommended) I'm using Chrome or tried to reproduce the feature on Chrome.
Browser + Version:
68.0.3440.106
CustomUI version:
20180806
Home Assistant release (hass --version):
0.77.1
Problem-relevant configuration.yaml entries:
sensor.dyson_pure_cool_link_bedroom_air_quality:
friendly_name: Bedroom Dyson Fan Air Quality
hidden: false
group:
group.bedroom.*:
friendly_name: Air Quality
templates:
icon: mdi:recycle
icon_color: >
if (state >= 0 && state <= 3) return 'rgb(0, 255, 0)';
else if (state >= 4 && state <= 6) return 'rgb(255,255,0)';
else if (state >= 7 && state <= 8) return 'rgb(255, 140, 0)';
else if (state == 9) return 'rgb(255, 0, 0)';
_stateDisplay: >
if (state >= 0 && state <= 3) return 'Good';
else if (state >= 4 && state <= 6) return 'Good Enough';
else if (state >= 7 && state <= 8) return 'Mediocre';
else if (state == 9) return 'Bad';
else return state
My entity looks like this in the entity state viewer:
unit_of_measurement: level
friendly_name: Bedroom Dyson Fan Air Quality
custom_ui_state_card: state-card-custom-ui
hidden: false
group: {
"group.bedroom.*": {
"friendly_name": "Air Quality"
}
}
templates: {
"icon": "mdi:recycle",
"icon_color": "if (state >= 0 && state <= 3) return 'rgb(0, 255, 0)'; else if (state >= 4 && state <= 6) return 'rgb(255,255,0)'; else if (state >= 7 && state <= 8) return 'rgb(255, 140, 0)'; else if (state == 9) return 'rgb(255, 0, 0)';\n",
"_stateDisplay": "if (state >= 0 && state <= 3) return 'Good'; else if (state >= 4 && state <= 6) return 'Good Enough'; else if (state >= 7 && state <= 8) return 'Mediocre'; else if (state == 9) return 'Bad'; else return state\n"
}
icon: mdi:recycle
icon_color: rgb(0, 255, 0)
_stateDisplay: Good
In the current state, the icon should be green, but it keeps the default color. The code is correctly evaluated because the icon_color attribute has the right value (icon_color: rgb(0, 255, 0)) but it doesn't change the icon color.
Problem-relevant Home Assistant log entries:
No entry.
Any errors from browser Javascript console:
Nothing.
Checklist
Browser + Version: 68.0.3440.106
CustomUI version: 20180806
Home Assistant release (
hass --version
): 0.77.1Problem-relevant
configuration.yaml
entries:My entity looks like this in the entity state viewer:
In the current state, the icon should be
green
, but it keeps the default color. The code is correctly evaluated because theicon_color
attribute has the right value (icon_color: rgb(0, 255, 0)
) but it doesn't change the icon color.Problem-relevant Home Assistant log entries: No entry.
Any errors from browser Javascript console: Nothing.