Make a helper show as text not a switch

Hi all,

Is there a way, in a front-end panel, to show a switch state as text or on/off icon instead of the usual on/off switch which can be used?

I have some sockets that are controlled via node-red but also want them to show current state in my control panel, it could be text as in “on” or “off” or just a plain or solid icon etc.

Thanks

Make what’s called a template helper (see helpers) that displays whatever you want off your entity then display that sensor on the dashboard

Another possible way - use “type: simple-entity”:

Thanks all,

I will admit, I’m struggling with this. I don’t use any Yaml etc, no config file stuff either, my whole system runs on basic HA stuff or via Node Red.

I tried a template but even the help stuff didn’t make any sense sadly.

Is there a better decsription somewhere I could read maybe?

… which includes yaml.
There are a lot of stock features which are only available with yaml.

Thanks, thats as maybe but if you have never used it then…

I do 99% in Node Red, my front end is hardly used so display is very basic. I’ll keep digging.

Had you ever used Node Red before you had ever used it the first time?

Sounds like a smart aleck question but not really. You have to start somewhere the first time to learn anything.

YAML is no different. People make a big deal out of it but it’s literally just learning one more way of organizing words to make HA do what you want. there aren’t even that many rules to follow.

2 Likes

You have two options, which have already been provided in this thread:

  1. Create a new entity which represents the read-only state of the switch
  2. Change how your dashboard displays the switch

Option 1 requires a new entity per switch, and you will have to write a template to reference the state of the switch.

  • Settings → devices and services → helpers → create helper → template → binary sensor
  • The state will be {{ is_state('switch.your_switch_entity', 'on') }}
  • You can choose a device class which will affect how the new entity is displayed on your dashboard. You might try either Plug or Power.

Option two requires you to update your Dashboard, and it’s going to depend on which card you are using to display the entities. If you are currently using (or don’t mind changing to) an “entities” card, you will need to:

  • go into the dashboard editor UI
  • find the entities card that you want to change
  • select “edit”.
  • Press the button in the bottom left for “show code editor”.
  • Now under each entity that you want to change to read-only, add a new line with this text and the same indentation as the line above it type: simple-entity
    For example, if you had this:
type: entities
entities:
  - entity: switch.my_switch_1
  - entity: switch.my_switch_2

…then you would change it to:

type: entities
entities:
  - entity: switch.my_switch_1
    type: simple-entity
  - entity: switch.my_switch_2
    type: simple-entity
1 Like

What I have learned from this forum is that everyone is born with all knowledge except HA, yaml, templates and HA GUI automations.
So whatever they used before was just natural and something they were born with.

1 Like

Yes fully agree with that but when it comes to my install, i find the KISS model works best for me - keep it simple stupid!

I prefer to have all code in one place and in one style, thats all.

1 Like

Hi,

A standard HA Tile card can also do that.

afbeelding
afbeelding

I understand but unfortunately that’s not always possible. It’s best to add as many tools to the tool box as you can to maintain the best flexibility to achieve the goals.

1 Like