How do you change Tplink Switch to a Door Class? so i can list it in Entity Card

You are making a mess by posting links to other topics that are completely unrelated to each other.

how do i make the icon colors work again
by using sensor
the Color icons based on state? toggle switch is disabled
is there extra line of code i need to add to get the
sensor.h_hot_water_tank_state show yellow when its on
the binary sensor one i have works fine goes yellow… but no more with sensor.
do i need to add a rgb(128,0,0) to the configuartion sensor yaml?

there was no color option in that link
i done the state_color: true doesnt work… what other option from that page do i need to add to the configuaration yaml

      
  - platform: template
    sensors:
      b_hot_water_tank_state:
        friendly_name: "Building Hot Water Tank Status"
        value_template: "{{ states('switch.b_hot_water_tank_switch') }}"
        state_color: true
        
      h_hot_water_tank_state:
        friendly_name: "House Hot Water Tank Status"
        value_template: "{{ states('switch.h_hot_water_tank_switch') }}"
        state_color: true
        
      m_hot_water_tank_state:
        friendly_name: "Mutti's Hot Water Tank Status"
        value_template: "{{ states('switch.m_hot_water_tank_switch') }}"
        state_color: true

You need to out it in the Lovelace card not the configuration

if ur talking about the photo i posted the toggle button is set to True
here is the code editor… i tried 2 different ways still wont light up

type: entities
entities:
  - entity: sensor.h_hot_water_tank_state
    name: House Hot Water Tank
    icon: 'mdi:water'
  - entity: sensor.b_hot_water_tank_state
    name: Building Hot Water Tank
    icon: 'mdi:water'
  - entity: sensor.m_hot_water_tank_state
    name: Mutti's Hot Water Tank
    icon: 'mdi:water'
  - entity: binary_sensor.water_position
    name: Sauna Water Valve Position
    icon: 'mdi:valve'
theme: christmas
title: Status
state_color: true
show_header_toggle: false

also tried which didnt work either

type: entities
entities:
  - entity: sensor.h_hot_water_tank_state
    name: House Hot Water Tank
    icon: 'mdi:water'
    state_color: true
  - entity: sensor.b_hot_water_tank_state
    name: Building Hot Water Tank
    icon: 'mdi:water'
    state_color: true
  - entity: sensor.m_hot_water_tank_state
    name: Mutti's Hot Water Tank
    icon: 'mdi:water'
    state_color: true
  - entity: binary_sensor.water_position
    name: Sauna Water Valve Position
    icon: 'mdi:valve'
theme: christmas
title: Status
state_color: true
show_header_toggle: false

is there something else i need to add
do i need to add if statesments?
if state=" on" icon color is this
if state =“off” icon color is this
if state =" unavaliable " icon color is this

for the 3 different states? since i using senor… instead of binary sensor?

and if i need to add if statements do i write that in the entities card?

or is there a simplier way
as id like
green for now off
yellow for on
blue for unavaliable

so i tried to follow some different google searchs no luck
from editing customization.yaml to adding icon_color to --state-icon-active-color:
i having zero luck … im just playing around… trying to find a way to change color

from what i google. lovelcate doesnt support sensor…
it only supports binary_sensor, input_booleans, switches
is there a way i can copy and paste binary_sensor and make a new setting for sensor
so i can make lovelace work for sensor
if i cant get the color to change no big deal just tried to get it to turn yellow as well

my configurational .yaml

sensor:
  - platform: template
    sensors:
      #icon_color: if (state === 'on') return 'rgb(0, 255, 0'; else return 'rgb(255, 0, 0)';
      b_hot_water_tank_state:
        friendly_name: "Building Hot Water Tank Status"
        value_template: "{{ states('switch.b_hot_water_tank_switch') }}"
        #--state-icon-active-color: "yellow"
        #state_color: true
        #icon_color: if (state === 'on') return 'rgb(0, 255, 0'; else return 'rgb(255, 0, 0)';
        
      h_hot_water_tank_state:
        friendly_name: "House Hot Water Tank Status"
        value_template: "{{ states('switch.h_hot_water_tank_switch') }}"
        #state_color: true
        #icon_color: if (state === 'on') return 'rgb(0, 255, 0'; else return 'rgb(255, 0, 0)';
        #icon_color: >
         # if (state === 'on') return [143,29,29];
         # return [45,133,58];      
      m_hot_water_tank_state:
        friendly_name: "Mutti's Hot Water Tank Status"
        value_template: "{{ states('switch.m_hot_water_tank_switch') }}"
        #state_color: true
       # icon_color: if (state === 'on') return 'rgb(0, 255, 0'; else return 'rgb(255, 0, 0)';

customatitype or paste code herezation,yaml

binary_sensor.water_position:
  friendly_name: door_class
  device_class: door
binary_sensor.internet: {}
switch.b_hot_water_tank_switch: {}
switch.h_hot_water_tank_switch: {
  icon_color: >
    if (state === 'on') return [143,29,29];
    return [45,133,58];      
    if (state === 'off') return [143,29,29];
    return [45,133,58];      
    if (state === 'unavaliable') return [143,29,29];
    return [45,133,58];      
}

What you are trying to do only works with custom ui.

You could change colors with the custom mod card.
And then change the settimgs for the entity card in lovelace like this:

- entity_id: sensor.xyz
  options:
    style: |
      :host {
      --paper-item-icon-color: 
       {% if states(config.entity) == 'on' %} 
         yellow
       {% elif states(config.entity) == 'off' %}
         green
       {% else %}
         blue
       {% endif %}
       ;
       }

so since i have no idea

i can tell you i did installed the custom mod card using that HACS install and the themes. i do notice supervisor all the Addons are gone…only some are left but the like 100 addons are all gone so i figured maybe reason why the color doesnt work

as the binary sensor worked… when sanua pump comes on the icon turns yellow and it uses binary sensor… the switch.xxxxx that also turns yellow when on… but the sensor.xxxxx for the hot water tanks when they go on they do not change color

so ill have to google how to change custom mod card…

so for love lace
sensor.xyz is that the hotwater tanks… so i add options to each one…
so does that mean i leave the customization.yami alone…

well let me try and see if it works… i appreciate the help… google isnt your friend always as it doesnt always find what you truly looking for lol

ill get back to you

so couple questions so i under stand things… and the blue doesnt work for the else i tried googling
if statements home assistant but didnt get about { %else%} or you use {-% else %}
and couple others
had to change word options to card_mod from looking at the card mod page you linked
and does --paper-item-icon-color: means the icon what does paper item mean?

and here is the code so yellow and green do work now for my other 2 hot water tanks… 3rd one thats for blue unavaliable isnt working… i tried googling… and i try more spaces as you get in trouble if its not indented right… but having 0 luck is it a different else statement i seen a few different ways

  - entity: sensor.m_hot_water_tank_state
    name: Mutti's Hot Water Tank
    icon: 'mdi:water'
    card_mod:
      style: |
        :host {
           --paper-item-icon-color: 
          {% if states(config.entity) == 'on' %} 
            yellow
          {% elif states(config.entity) == 'off' %}
            red
          {% else %}
            blue
          {% endif %}
          ;
          }    

i tried adding another else if but it doesnt like it

    card_mod:
      style: |
        :host {
           --paper-item-icon-color: 
          {% if states(config.entity) == 'on' %} 
            yellow
          {% elif states(config.entity) == 'off' %}
            red
          {% elif states(config.entity) == 'unavailable' %}
#          {% else %}
            blue
          {% endif %}
          ;
          }   

i also having something werid going on its ih the card i trying to type words

like “red” but its coming out as “der” anything i type is being print backwards but no where else is it doing it

so i have tried different combinations below you can see none work for unavailable. on top of it
its glitching every so off
if you want to type “card_mod” it will type on the screen “dom_drac”
it will do that for anything you type… seems if i hit f5 and refresh it fixes it on the page what causes it?

so my combos was changing options to card_mod and then adding the code outside of the sub headings so it cover all but it will not turn blue

type: entities
entities:
  - entity: sensor.h_hot_water_tank_state
    name: House Hot Water Tank
    icon: 'mdi:water'
  - entity: sensor.b_hot_water_tank_state
    name: Building Hot Water Tank
    icon: 'mdi:water'
    card_mod:
    style: |
      :host {
      --paper-item-icon-color: 
      {% if states(config.entity) == 'on' %} 
        yellow
      {% elif states(config.entity) == 'off' %}
        green
      {% else %}
        blue
      {% endif %}
      ;
      }    
  - entity: sensor.m_hot_water_tank_state
    name: Mutti's Hot Water Tank
    icon: 'mdi:water'
    card_mod:
    style: |
      :host {
      --paper-item-icon-color: 
      {% if states(config.entity) == 'on' %} 
        yellow
      {% elif states(config.entity) == 'off' %}
        blue
      {% else %}
        blue
      {% endif %}
      ;
      }    

  - entity: binary_sensor.water_position
    name: Sauna Water Valve Position
    icon: 'mdi:valve'
theme: christmas
title: Status
state_color: false
show_header_toggle: false


ive change the State_color : false as i figure the thing is being over written the extra code
i tried

type: entities
entities:
  - entity: sensor.h_hot_water_tank_state
    name: House Hot Water Tank
    icon: 'mdi:water'
  - entity: sensor.b_hot_water_tank_state
    name: Building Hot Water Tank
    icon: 'mdi:water'
    card_mod:
    style: |
      :host {
      --paper-item-icon-color: 
      {% if states(config.entity) == 'on' %} 
        yellow
      {% elif states(config.entity) == 'off' %}
        green
      {% else %}
        blue
      {% endif %}
      ;
      }    
  - entity: sensor.m_hot_water_tank_state
    name: Mutti's Hot Water Tank
    icon: 'mdi:water'
    card_mod:
    style: |
      :host {
      --paper-item-icon-color: 
      {% if states(config.entity) == 'on' %} 
        yellow
      {% elif states(config.entity) == 'off' %}
        blue
      {% else %}
        blue
      {% endif %}
      ;
      }    

  - entity: binary_sensor.water_position
    name: Sauna Water Valve Position
    icon: 'mdi:valve'
  - entity: sensor.b_bedroom_light_switch_state
    name: Building Bedroom Light Switch
    icon: 'mdi:lightbulb'
theme: christmas
title: Status
state_color: false
show_header_toggle: false
card_mod:
  style: |
  :host {
  --paper-item-icon-color: 
    {% if states(config.entity) == 'on' %} 
      yellow
    {% elif states(config.entity) == 'off' %}
      blue
    {% else %}
      blue
    {% endif %}
    ;
    }    

also like i changed your options: to card_mod:
but didnt work

its like it does the IF and the elif but its skipping the {% else %}

so the colors do work least seems to work
for Off or ON
but not for unavailable.

i tried googling more for different IF statements for home assistant but they basiclly the same
or
{-% else %} something like that with the -