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

so i have several Tplink Light Switchs working with HA

now i made a card with them and wanted to do a Status so when a Light switch is On it will say ON or OFF… but i cant get rid of the Toggle Switch … i dont like Glance… i like the Entity…
Left Side Name right Side Status
just like an excel spread sheet…
but glances just do squares
class for a Binary Sensor… but Tplink Kasa doesnt show you can add a Binary sensor to that switch…

so how do i add it to the Entities card… and changea Toggle Switch to a word saying ON or OFF or Open and Closed say or my own word if i dont like ON or OFF

Create a Template Binary Sensor whose state shows the state of the switch. Make sure to specify door for device class.

im having issues i dont understand there examples

so i got so far
binary_sensor:

  • platform: template
    sensors:
    test:
    friendly_name: “test test”
    device_class: light
    value_template: "{{ is_state(‘switch.h_hot_water_tank_switch’, ‘on’) }}
    unique_id: status

dont know why its not just simple
Toggle Switch = State

so instead of a Toggle switch it prints State Word

so much typing just to print State Word

im just randomy trying things from that page
as there is no example
type this in exactly convert Light Switch Toggle Switch to display ON or OFF

Please properly format code snippets. If you don’t there’s no way to know if you have a typo.

Did you actually want help, or did you just want to complain?

1 Like

Asking for help then complaining how much typing you need to do will get you much less help.
Wow, so much typing just to make that point

i dont know what your talking about i not complaining
Explain it exactly how to write the code if i was 5 years old
explain each line of code i need… detail answers… more detail then whats provided on that page
what you talking about code snippets.,. its properly formated its copied right out configurartion yaml
i dunno what your talking about typos, i said i randomy adding code from the link your provided.
i do not know what any of thoise examples do… Im 100% guessing… you need to explain it to someone that knows absolutly nothing…

  - platform: template
    sensors:
      test:
      friendly_name: “ON”
      device_class: light
      value_template: "{{ is_state(‘switch.h_hot_water_tank_switch’, ‘on’) }}
      friendly_name: “OFF”
      device_class: light
      value_template: "{{ is_state(‘switch.h_hot_water_tank_switch’, ‘off’) }}
      unique_id: status

so the code above gives me this error
Error loading /config/configuration.yaml: while parsing a block mapping
in “/config/configuration.yaml”, line 86, column 7
expected , but found ‘’
in “/config/configuration.yaml”, line 110, column 15

and i not complaing
i figured it be Simple like a Check Box a Toggle in the Entity Cards that says Display State or Display Toggle switch… or the word print <switch.sdfasfd.>=state so it prints the state word off or on

@samnewman86 i not complaining
i basicly asked for you guys to give me the exact code to convert Toggle swtich to On off

and detailed instructions and explaination then so any newbie 5yrs old and newer can understand

ive gone through google pages searching

Convert Toggle switch to ON OFF in home assistant but having 0 luck

it does not like my name “test” for a sensor name
it doesnt tell me what a slug of the test means either
since i testing the name of the sensor is called “test”

binary_sensor:

  - platform: template
    sensors:
      test:
        friendly_name: “test test”
        device_class: light
        value_template: "{{ is_state(‘switch.h_hot_water_tank_switch’, ‘on’) }}
        unique_id: status

so i tried more spaces and it doesnt like friendly name now so i dunno whats wrong

Ok, but that’s not what it sounded like. It sure sounded like you were complaining that it wasn’t as simple as you would have liked.

I can certainly do that, but generally I don’t assume the person requesting help needs that level of hand holding.

No, it was not properly formatted. Notice the difference between your first post of the code and the second. Do they look the same to you? Can you tell if the code is indented properly in the first post? If you’re not sure what I’m talking about, see #11 in this topic.

In your second post I can see at least three basic problems. First, the indentation is wrong. Second you’re using the wrong kind of quote marks. They need to be the simple ' or " characters, not the fancy curly quote characters. Third you’re missing quotes at the ends of the templates. Also, you don’t show what that code is “under.” I.e, is it under sensor: or binary_sensor:? (It should be the latter.)

Try this:

  - platform: template
    sensors:
      test_on:
        friendly_name: "ON"
        device_class: light
        value_template: "{{ is_state('switch.h_hot_water_tank_switch', 'on') }}"
      test_off:
        friendly_name: "OFF"
        device_class: light
        value_template: "{{ is_state('switch.h_hot_water_tank_switch', 'off') }}"

ok ill try your code

i get confused… i only started using home assistant basiclly since December… i dont understand half of any of these examples… none of which do not go in depth there are hardly any videos out there… i saw Dr ZZs but that doesnt help. i tried to use Node-Red and that has just confused me and doesnt work…

it frustrates me cuz all i figure was just simple radio button or a toggle to say display Toggle or Display State

just like the toggle Button Show Icon thats what i was looking for Instead of Show Icon toggle switch it be
Show State or Show Toggle by toggling

let me try your code… cuz it frustrates me… as i having issues with remote_gpio
and spent last couple hours googling and reading articles how to convert before i asked for help in here…

give me a few min ill copy and pates and then do i just load it inthe the entity page? or does it automaicllty change the entity card to on off

as i dont know when you write in configuration.yaml or when you write code in a entity card

so i copied and paste it so didnt give no errors but i dont know the next steps? how to change the toggle switch
the show code editor for the entities card is

type: entities
entities:
  - entity: switch.h_hot_water_tank_switch
    name: House Hot Water Tank
    icon: 'mdi:water'
  - entity: switch.b_hot_water_tank_switch
    name: Building Hot Water Tank
  - entity: binary_sensor.water_position
    name: Sauna Water Valve Position
    icon: 'mdi:valve'
theme: christmas
title: Status

under sensor i dunno sensor or binary sensor
i was just using the examples from that link
i wouldnt know which one to use

all i know is for the switch its

tplink:
  discovery: true

as for your code
i posted it under
Binary_sensor:
int the configuraration. yaml
the remote gpio doesnt work

######################
### Binary Sensors ###
######################
binary_sensor:
  - platform: template
    sensors:
      test_on:
        friendly_name: "ON"
        device_class: light
        value_template: "{{ is_state('switch.h_hot_water_tank_switch', 'on') }}"
      test_off:
        friendly_name: "OFF"
        device_class: light
        value_template: "{{ is_state('switch.h_hot_water_tank_switch', 'off') }}"

#reboot DSL modem
  - platform: remote_rpi_gpio
    host: 192.168.0.10
    ports:
      17: Reboot_DSL_Modem

gonna try a reboot and a clear cache to see if it shows anything

That should have created two binary_sensor entities, specifically binary_sensor.test_on and binary_sensor.test_off. You would display them (or at least one of them) in your entities card instead of the switch itself. Basically the binary sensor will just show the state of the switch without providing a means to change the switch’s state (i.e., just an indicator, not a toggle.)

@pnbruckner i think i did something wrong… so i change the code to work it for 2 hot water tanks but its working in reverse im guessing i messed it up… and i wish the people that write home assistant had videos for Dummies… like those books Dos For Dummies, Windows For Dummies, the yellow books… wish there was one for home asssitant so i could understand it… as im a visual learner not a words learner with my dislexia and learning disability… but something is reversed… and i found the 2 binary sensors i found you have to put the one thats off in there when the switch is off… as you can reverse it

but here the states are reversed… what did i do wrong??


######################
### Binary Sensors ###
######################
binary_sensor:
# Need to make a template to be able to change a Toggle Switch To On Of
# need to also change device class to something else to display other then ON OFF
# this is for when you dont have a binary sensor and you need to convert 
# a Tplink  Light Switch 
# Template is nothing visual  it just something you need to get entities
  - platform: template
    sensors:
    #Building Hot Water Tank
      b_hot_water_tank_on:
        friendly_name: "ON"
        #device_class: light
        value_template: "{{ is_state('switch.h_hot_water_tank_switch', 'on') }}"
      b_hot_water_tank_off:
        friendly_name: "OFF"
        #device_class: light
        value_template: "{{ is_state('switch.h_hot_water_tank_switch', 'off') }}"
    # House Hot Water Tank
      h_hot_water_tank_on:
        friendly_name: "ON"
        #device_class: light
        value_template: "{{ is_state('switch.h_hot_water_tank_switch', 'on') }}"
      h_hot_water_tank_off:
        friendly_name: "OFF"
        #device_class: light
        value_template: "{{ is_state('switch.h_hot_water_tank_switch', 'off') }}"

#reboot DSL modem
  - platform: remote_rpi_gpio
    host: 192.168.0.10
    ports:
      17: Reboot_DSL_Modem

i tried a reboot of HA but it didnt fix it so not sure what i did wrong

Home Assistant is still very much in development. I’ve been using it for a few years now, and when I started there was very little configuration that was possible via the UI. Pretty much everything had to be done by directly editing the YAML files. It’s come a long way since then, and it’s still being improved every day, especially the UI, but it’s still not where they want it to be. Until it gets more stable it would be a lost of wasted effort trying to write “for dummies” books/tutorials/videos, since they would be obsolete before you knew it.

I can see you’ve defined two sets of binary sensors – b_... and h_..., but they both are based on the same switch (switch.h_hot_water_tank_switch.) Did you mean to do that?

Let’s take one example, specifically binary_sensor.h_hot_water_tank_on. The way it’s defined, it should follow switch.h_hot_water_tank_switch. If the switch is on, the binary sensor should be on. And if the switch is off, the binary sensor should be off.

Please use the STATES tab of the Developer Tools page to see them both to see if they do indeed follow.

so what i have is
H for House Water Tank
switch.h_hot_water_tank_switch
B for Buiding Hot Water Tank (my shop)
switch.b_hot_water_tank_switch

i have a 3rd hot water tank for my sisters house i have a connected vpn to her house to fix her computer so i added a button for that which i havent done yet i dunno if that will work yet… but not there yet

this way i cant turn off both hot water tanks only use them when i want to
i sent a pic above of the Develop states… here is the setting for B aka building.
its also reversed some reason? reason i was asking what did i do wrong?

ah i figured there be lot of people making the software
like unraid or freenas those server programs there is videos and documentations step by step… so thats why i figured there be some dummies books.
but ya i can see what you mean if they are making it as they go there isnt documantation… so really home assistant is really a Beta software its constantly being developped not really stable release or offical release then. right something like that?

but ya if the Enties card you can see i have House Hot water Tank and Building Hot Water Tank

there are both currently set to off on the switch…
and i chose the binary_sensor.xxxxxx_off for both of them to equal off as they are right now show off
and the state shows off… just its reporting backwards

here is B one you saw the H one

and i appreciate the more explanation… im just still learning it… i just learned about Raspberry Pi in 2020 before that i never even heard of a raspberry pi except what to eat … so even though i in my 40s i just learning as i go… wish i knew this stuff years ago… i wouldnt get frustrated now lol

i also fixed my seperations… for me it makes sense but for other s it doesnt… part of my dislexia and learning disability

######################
### Binary Sensors ###
######################
binary_sensor:
# Need to make a template to be able to change a Toggle Switch To On Of
# need to also change device class to something else to display other then ON OFF
# this is for when you dont have a binary sensor and you need to convert 
# a Tplink  Light Switch 
# Template is nothing visual  it just something you need to get entities
  - platform: template
    sensors:
    ###############################
    ### Building Hot Water Tank ###
    ###############################
      b_hot_water_tank_on:
        friendly_name: "ON"
        #device_class: light
        value_template: "{{ is_state('switch.h_hot_water_tank_switch', 'on') }}"
      b_hot_water_tank_off:
        friendly_name: "OFF"
        #device_class: light
        value_template: "{{ is_state('switch.h_hot_water_tank_switch', 'off') }}"

    ############################
    ### House Hot Water Tank ###
    ############################
      h_hot_water_tank_on:
        friendly_name: "ON"
        #device_class: light
        value_template: "{{ is_state('switch.h_hot_water_tank_switch', 'on') }}"
      h_hot_water_tank_off:
        friendly_name: "OFF"
        #device_class: light
        value_template: "{{ is_state('switch.h_hot_water_tank_switch', 'off') }}"