Badges and State-Label

I’m trying to wrap my arms around badge customization - but I find the docs confusing:


What does entity-button mean ?
Can anyone provide a sample?

Docs are wrong for that field. The sample in the image you posted is correct.

Perhaps it’s time to correct the docs then?
(I ask, since I failed to correct it - but I tried. Guess I don’t understand how to correct docs - or perhaps I haven’t got the required access rights)

2 Likes

I’d love to contribute, but as I said - I tried,but failed.
Besides, I wouldn’t know what to type instead of what’s already there. All I know (because you said so) is that what’s currently in there - is wrong.
And I think that the main part missing - is an example. And since I haven’t even been able to make it work at all, I definitely don’t have a working sample I can offer (yet). :man_shrugging:

dude, the example is there… and works…

Well, that’s not much of an example, is it? What exactly does it do?
I tried to add some more to it, like a different icon, show-name: false etc, but whatever I did, absolutely nothing happened. Didn’t even get any error messages!

it put’s a state label badge in the UI.

You cannot change the look of badges. Certain badges have specific items inside the circle, even if you try to override it, it will do nothing. For example, sensors display the state in the center of the circle and do not display an icon. Therefore icon does nothing for sensors. It’s different for every domain type. You have to try it yourself.

I tried to add it as a card manually as it is not available for selection, but got the following error:


@petro Can you help me by pointing out where the former mentioned example can be used?

That goes in the badges section on a view. They aren’t cards.

I added several badges using entity-filter and they actually work as intended, but in the badges list nothing shows:

If you’re referring to entity-filter not showing up in the badge list, then that is expected. The UI for that has not been developed yet.

There are some strange things in the docs so far…

These options seem not working:
image
Test example:

views:
  - title: badges
    path: test-badges
    badges:
      - type: state-label
        entity: device_tracker.iphone_5s
        show_name: false
        name: "show_name: false"
      - type: state-label
        entity: device_tracker.iphone_5s
        show_icon: false
        name: "show_icon: false"

image
This is not what I am expecting:

  • name is not displayed
  • icon is not displayed

The fields only work for certain domains and most domains have different behavior. This makes it appear as if the fields do nothing

Thank you for a quick reply!

I checked these fields with domains (do not have "lights", "scripts", "input_datetime" yet):
automation
sun
device_tracker
sensor
binary_sensor
person
switch
zone
group
input_boolean
input_select
input_number
input_text

Checking entities with "show_name: false":


All badges are with names.

      - type: state-label
        entity: automation.1
        show_name: false
        name: automation
      - type: state-label
        entity: sun.sun
        show_name: false
        name: sun
      - type: state-label
        entity: device_tracker.iphone_5s
        show_name: false
        name: device_tracker
      - type: state-label
        entity: sensor.cleargrass_1_co2
        show_name: false
        name: sensor
      - type: state-label
        entity: binary_sensor.updater
        show_name: false
        name: binary_sensor
      - type: state-label
        entity: person.ildar
        show_name: false
        name: person
      - type: state-label
        entity: switch.test_switch
        show_name: false
        name: switch
      - type: state-label
        entity: zone.home
        show_name: false
        name: zone
      - type: state-label
        entity: group.batteries
        show_name: false
        name: group
      - type: state-label
        entity: input_boolean.test_boolean
        show_name: false
        name: input_boolean
      - type: state-label
        entity: input_select.graph_hours_to_show_test
        show_name: false
        name: input_select
      - type: state-label
        entity: input_number.test_number
        show_name: false
        name: input_number
      - type: state-label
        entity: input_text.test_text
        show_name: false
        name: input_text

Now checking same entities with "show_icon: false" (just in case: including cases when icons are not supposed to be displayed - for "sensors", for example):


All badges with icons are still with icons.

Seems like it’s now broken.

For the record.
This PR implements the “show_name” option which is not working this moment.