customize_glob:
# All Entities - Hide Templates & Icon Color
# Note that yaml keys can't start with an asterisk. Use quotes in that case:
"*.*":
hide_attributes:
- templates
- icon_color
- all # <-- this hides, well, all customizations ;-)
note that the new more info box causes some new and unexpected effects when using this: if no attributes left to show, the box is still showing… This is because of the way HA now checks if there are any attributes left. I am trying to work out how to add these templates and icon_color attributes to the filter list in the ha more-info logic, but need Bram to help me out, and he is very busy.
yes,I have a permanent test on my test page:
- type: custom:auto-entities
card:
type: entities
title: Test Icon color Buttons
filter:
include:
- entity_id: sensor.*_actueel
options:
type: custom:button-card
template: support_custom_ui
so I can see if it keeps working, which it does all my power sensors colored nicely
I know… this why I have 2 or 3 cards actually using card_mod for coloring the icons. In a rather large setup with 3 very fledged out dashboards. So that isn’t too bad
the first 2 line can be replaced by:
if (['unavailable', 'unknown'].includes(state))
EDIT:
and this is indeed not working as expected in my setup…:
sensor.*_battery_level:
templates: &battery_color
icon_color: >
if (['unavailable', 'unknown'].includes(state)) return 'brown';
if (state <= entities['input_number.battery_alert_level'].state) return 'red';
return 'green';
It has some strange results, especially on slider 100% and 0 %. So Number()
is indeed necessary. I did take out the ‘=’, because of the mentioned edge threshold cases.
Ive also added your template to the examples in the custom-ui repo