Hiding Value of Sensor in Lovelace

This may seem odd but I would like to hide the value of some Binary Sensor’s in Lovelace.

I’ve setting binary_sensors based on values from a Google calendar entry (Waste Collection)

I am using a customized Monster Card to display what is being collected this week. It’s working nicely, items being collected appear, those not being collected are hidden.

I would like to hide the “on” value of the sensor in the card, I think it looks terrible.

image

If you don’t mind a grid layout with larger icons you could use Glance entries with show_state: false.

There’s always something from @thomasloven ! :slightly_smiling_face:

hmmm, unfortunately I am using a custom monster card to hide entities when their sensor is set to off.
Perhaps Monster-card has something that will hide the values

edit: It seems Monster-Card has a glance type, I’ll check it out

Glance card still shows the values, it looks better visually except for the collection date.

image

Add show_state: false to your glance card. That should do it.

Check out the docs:
https://www.home-assistant.io/lovelace/glance/

@dylpickles1234

Closer, I wish I could apply the show_state: false to individual entities. I don’t want to loose the value of Collection Date.

dummy-entity-row can be used with auto-entities which is better than monster-card anyway.

Edit: Actually, it should be usable with monster-card too. Just add type: custom:dummy-entity-row to the options of your filter.

@thomasloven
thanks, I can’t seem to get it to work. Perhaps it’s because I’m using a filter in the Monster-Card. Perhaps it’s because it’s the 3rd custom card element I’m using…

      - type: custom:card-modder
        style:
          border-radius: 5px
          --primary-color: white
        card:
          type: custom:my-monster-card
          show_empty: true
          card:
            type: entities
            title: Waste Collection
            show_header_toggle: false
          filter:
            include:
              - entity_id: sensor.collection_date
                options:
                  name: Collection Day
                  icon: mdi:calendar
              - type: custom:dummy-entity-row
                entity_id: binary_sensor.garbage
                options:
                  name: 1 Bag
                  icon: mdi:trash-can
                when:
                  - entity_id: binary_sensor.garbage
                    state: 'on'

If you add entity: between the - and your.entity_id you can then add individual configuration variables under each entity:

eg: change…

entities:
  - your.entity_id_1
  - your.entity_id_2
  - your.entity_id_3
  - your.entity_id_4

to…

entities:
  - entity: your.entity_id_1
  - entity: your.entity_id_2
  - entity: your.entity_id_3
  - entity: your.entity_id_4

You can also specify the number of columns to allow more room for the text. This needs to be above the entities section.

So all together it would look something like this…

type: glance
columns: 2
entities:
  - entity: your.entity_id_1
  - entity: your.entity_id_2
    show_state: false
  - entity: your.entity_id_3
    show_state: false
  - entity: your.entity_id_4
    show_state: false

If I put in entity: instead of entity_id: I get a card with every entity in HA all with the same name.

I think we cross-posted, I was referring to Glance entries.
If you’ve moved on to dummy-entity-row instead then show_state: false won’t be a valid configuration variable.

@jparthum

Nope, I followed you. :slight_smile:

I have 3 cards setup, glace, dummy, and original untouched

Oh, my mistake. Monster Card needs entity_id: instead of entity:.

If you already have entity_id: then you should be able to just add show_state: false directly underneath it.

@jparthum

I’ve tried the show_state: false in two locations. It doesn’t break anything but it also doesn’t hide the state value.

      - type: custom:card-modder
        style:
          border-radius: 5px
          --primary-color: white
        card:
          type: custom:my-monster-card
          show_empty: true
          card:
            type: glance
            columns: 2
            title: Waste Collection
            show_header_toggle: false
          filter:
            include:
              - entity_id: sensor.collection_date
                options:
                  name: Collection Day
                  icon: mdi:calendar
              - entity_id: binary_sensor.garbage
                < I also tried it here >
                options:
                  name: 1 Bag
                  icon: mdi:trash-can
                  show_state: false
                when:
                  - entity_id: binary_sensor.garbage
                    state: 'on'

My mistake again. :face_with_head_bandage:

I read the docs wrong and mixed up the two configuration variables sections. Where you ‘also tried it here’ is the correct location for individual entities, but I misinformed you and the Glance card only supports show_empty: true for the entire card (when entered directly under type: glance, just like you have columns: 2).

I apologize for misleading you; the Glance card may not do what you’re wanting after all. :slightly_frowning_face:

@jparthum No worries, I learned some things about glance cards in the process, so thank you for that!

1 Like
- entity_id: binary_sensor.garbage
  options:
    name: 1 Bag
    icon: mdi:trash-can
    type: custom:dummy-entity-row
1 Like

HI Thomas,
Since you’re able to hide the state for an entity, please let me ask if you can change the display of it also.
I was a heavy user of @andrey 's custom-ui which enabled us to change the _stateDisplay of entities to whatever you liked, and also template these:

device_tracker.ae_*:
  templates:
    theme: >
      if (state === 'home') return 'green';
      return 'grey';
    _stateDisplay: >
      if (state === 'home') return 'Online';
      return 'Offline';

This is deprecated now, and I really miss it, as Op here does… Would be really nice if we could somehow bring that back.

btw same goes for the ‘execute’ on script entities. We could change that using ‘action_name’ customization. This is still available in the more-info but now gone in Lovelace’s Frontend (as is theming btw, still wonder why that is). See:

using:

homeassistant:
  customize:
    script.reset_error_counter:
      action_name: Reset
      icon: mdi:alert-circle-outline

Hope you can have a look, wouldn’t know where else to file a ‘feature request’ :wink: