I would like to add icons for electric sockets on the picture-elements of the apartment plan.
The socket shows the current consumption in W.
How to make an entry so that the ‘picture-elements’ shows the colors of the icon depending on the range of power consumption
for example green from 0-11W, yellow from 12-200W, orange from 201-1200W and red from above.
I have now
- type: state-icon
icon: mdi:power-socket-ch
entities:
- entity: sensor.kuchnia_9_power
card_mod:
style: |
:host {
--paper-item-icon-color:
{% set sped = states('sensor.kuchnia_9_power') | float(0) %}
{% if sped >= 0 and sped <= 11 %}
green;
{% elif sped >= 12 and sped <= 1000 %}
yellow;
{% elif sped >= 1000 and sped <= 2200 %}
red;
}
show_header_toggle: false