ok, lets see if i can explain
I display an āentitiesā card in lovelace which contains sensors (not switchable entities that would require a button)
for example
- type: entities
title: Solar & Elec
show_header_toggle: false
entities:
- sensor.modbus_sb_pv_production
- sensor.mqtt_sm_grid_feed_in
- sensor.mqtt_calcfin_feed_earn_per_hour_elec
- sensor.mqtt_sm_purchased_electricity
- sensor.mqtt_calcfin_consumption_cost_per_hour_elec
- sensor.mqtt_calcfin_consumption_elec
Iād like to colour these entity icons according to their state.
with custom ui loaded (prior to ver 88 when it stopped functioning), i can add the following to my entity entry in my customize.yaml
sensor.modbus_sb_pv_production:
friendly_name: PV Generation
templates:
theme: >
icon: mdi:flash-circle
icon_color: >
if (state > 500) return 'rgb(0,255,0)';
if (state > 300) return 'rgb(0,0,255)';
if (state > 150) return 'rgb(255,255,0)';
if (state < 150) return 'rgb(120,120,120)';
defning the icon used (in this case mdi:flash-circle)
and the icon color
for example if i wanted to make the entity icon a static red it would be
icon_color: red
or in the above example, ārgb(0,255,0)ā or green for above a value of 500
or ārgb(0,0,255)ā blue if above 300 etc
Correct me if im wrong, In themes you can change the icon color across the board, but not on a per entity basis
Andrey who wrote custom ui seems to be off the air, but for me the ability to customise an icon color of an entity would be a nice core feature to have without having to rely on a custom element and its associated administration