šŸ“ 100% Templatable Lovelace Configurations

David, I am not a native English speaker and do not have a lot of experience of HA in part of MQTT & Tasmota. A code and a small picture would be more clear for me to help you.

What I could imagine:

  1. There is a multiple-entity-row.
  2. The primary item (the first one) is some entity (ā€œprimary entityā€).
  3. Other items (ā€œsecondary itemsā€) are either another entities or attributes of some entity.
  4. Every item (primary & secondary) has a ā€œtap_actionā€ which is ā€œmore-infoā€.

What you may want is:

  1. Disable the ā€œmore-infoā€ for some item (ā€œtap_action: action: noneā€).
  2. Show ā€œmore-infoā€ for another entity. To understand how to do this (or say ā€œnot possibleā€) I need a code for this card (+ explanations like ā€œI need more-info for THAT entity instead of THAT entityā€). Using a similar code I may simulate your case on my setup.

No, you canā€™t specify the state text on an entity row on a core entity row (outside the text row but I donā€™t think you want that), but you look to be using a custom row so perhaps ask that developer. The other option is to use browser_mod to specify that popup for this row.

1 Like

I still do not understand the whole task.

Thanks Ian. Iā€™ll take a look at that. Iā€™m not using a custom-row BTW - just a standard entities card with your template card to modify the name. I am only having this problem now because I switched to using the Tasmota Integration as MQTT Discovery for HA seems to be deprecated now in Tasmotaā€¦

Donā€™t worry about it. Thanks for trying to help anyway. Itā€™s probably a language barrier as itā€™s reasonably clear what I am trying to do and posting my entity config will only confuse you further.

OK!

So thanks to @iantrich for the idea, I ended up using custom:multiple-entity-row which lets me do pretty much what I wanted while also restoring the state card info for my Tasmota devices before I ā€˜upgradedā€™ to the Tasmota integration.

Here is what the old card looked like and also the code and what I saw when I clicked on the rowā€¦
image image

Card Config:

          - type: 'custom:config-template-card'
            variables:
              - states['sensor.sonoff1_2914_mqtt_connect_count'].state
              - states['sensor.sonoff1_2914_wifi_connect_count'].state
              - states['sensor.sonoff1_2914_rssi'].state
              - states['sensor.sonoff2_3110_mqtt_connect_count'].state
              - states['sensor.sonoff2_3110_wifi_connect_count'].state
              - states['sensor.sonoff2_3110_rssi'].state
              - states['sensor.sonoff5_1083_mqtt_connect_count'].state
              - states['sensor.sonoff5_1083_wifi_connect_count'].state
              - states['sensor.sonoff5_1083_rssi'].state
              - states['sensor.sonoff6_3719_mqtt_connect_count'].state
              - states['sensor.sonoff6_3719_wifi_connect_count'].state
              - states['sensor.sonoff6_3719_rssi'].state
              - states['sensor.nodemcu_lounge_mqtt_connect_count'].state
              - states['sensor.nodemcu_lounge_wifi_connect_count'].state
              - states['sensor.nodemcu_lounge_rssi'].state
              - states['sensor.nodemcu_bedroom_mqtt_connect_count'].state
              - states['sensor.nodemcu_bedroom_wifi_connect_count'].state
              - states['sensor.nodemcu_bedroom_rssi'].state
              - states['sensor.sonoff3_0898_mqtt_connect_count'].state
              - states['sensor.sonoff3_0898_wifi_connect_count'].state
              - states['sensor.sonoff3_0898_rssi'].state
              - states['sensor.sonoff4_0851_mqtt_connect_count'].state
              - states['sensor.sonoff4_0851_wifi_connect_count'].state
              - states['sensor.sonoff4_0851_rssi'].state
              - states['sensor.sonoff1_2914_signal'].state
              - states['sensor.sonoff2_3110_signal'].state
              - states['sensor.sonoff5_1083_signal'].state
              - states['sensor.sonoff6_3719_signal'].state
              - states['sensor.nodemcu_lounge_signal'].state
              - states['sensor.nodemcu_bedroom_signal'].state
              - states['sensor.sonoff3_0898_signal'].state
              - states['sensor.sonoff4_0851_signal'].state
            entities:
              - sensor.sonoff1_2914_rssi
              - sensor.sonoff2_3110_rssi
              - sensor.sonoff5_1083_rssi
              - sensor.sonoff6_3719_rssi
              - sensor.nodemcu_lounge_rssi
              - sensor.nodemcu_bedroom_rssi
              - sensor.sonoff3_0898_rssi
              - sensor.sonoff4_0851_rssi
            card:
              type: 'custom:hui-entities-card'
              title: MQTT & Wifi Connections
              show_header_toggle: false
              entities:
                - entity: sensor.sonoff1_2914_rssi
                  name: "${'Coffee' + '\xa0'.repeat(16) + 'MQTT ' + vars[0] + '\xa0'.repeat(4) + 'WiFi ' + vars[1] + '\xa0'.repeat(3) + vars[24] + '\xa0' + 'dBm' + '\xa0'.repeat(3) + ( vars[2] >= 100 ? 'Excellent' : vars[2] >= 80 ? 'Good' : vars[2] >= 60 ? 'Fair' : 'Weak' )}"
                  icon: "${vars[2] >= 100 ? 'mdi:wifi' : vars[2] >= 80 ? 'mdi:wifi-strength-3' : vars[2] >= 60 ? 'mdi:wifi-strength-2' : 'mdi:wifi-strength-1' }"
                - entity: sensor.sonoff2_3110_rssi
                  name: "${'Toothbrush' + '\xa0'.repeat(7) + 'MQTT ' + vars[3] + '\xa0'.repeat(4) + 'WiFi ' + vars[4] + '\xa0'.repeat(3) + vars[25] + '\xa0' +  'dBm' + '\xa0'.repeat(3) + ( vars[5] >= 100 ? 'Excellent' : vars[5] >= 80 ? 'Good' : vars[5] >= 60 ? 'Fair' : 'Weak' )}"
                  icon: "${vars[5] >= 100 ? 'mdi:wifi' : vars[5] >= 80 ? 'mdi:wifi-strength-3' : vars[5] >= 60 ? 'mdi:wifi-strength-2' : 'mdi:wifi-strength-1' }"
                - entity: sensor.sonoff5_1083_rssi
                  name: "${'Garage' + '\xa0'.repeat(15) + 'MQTT ' + vars[6] + '\xa0'.repeat(4) + 'WiFi ' + vars[7] + '\xa0'.repeat(3) + vars[26] + '\xa0' +  'dBm' + '\xa0'.repeat(3) + ( vars[8] >= 100 ? 'Excellent' : vars[8] >= 80 ? 'Good' : vars[8] >= 60 ? 'Fair' : 'Weak' )}"
                  icon: "${vars[8] >= 100 ? 'mdi:wifi' : vars[8] >= 80 ? 'mdi:wifi-strength-3' : vars[8] >= 60 ? 'mdi:wifi-strength-2' : 'mdi:wifi-strength-1' }"
                - entity: sensor.sonoff6_3719_rssi
                  name: "${'Alarm' + '\xa0'.repeat(17) + 'MQTT ' + vars[9] + '\xa0'.repeat(4) + 'WiFi ' + vars[10] + '\xa0'.repeat(3) + vars[27] + '\xa0' +  'dBm' + '\xa0'.repeat(3) + ( vars[11] >= 100 ? 'Excellent' : vars[11] >= 80 ? 'Good' : vars[11] >= 60 ? 'Fair' : 'Weak' )}"
                  icon: "${vars[11] >= 100 ? 'mdi:wifi' : vars[11] >= 80 ? 'mdi:wifi-strength-3' : vars[11] >= 60 ? 'mdi:wifi-strength-2' : 'mdi:wifi-strength-1' }"
                - entity: sensor.nodemcu_lounge_rssi
                  name: "${'Weather' + '\xa0'.repeat(12) + 'MQTT ' + vars[12] + '\xa0'.repeat(4) + 'WiFi ' + vars[13] + '\xa0'.repeat(3) + vars[28] + '\xa0' +  'dBm' + '\xa0'.repeat(3) + ( vars[14] >= 100 ? 'Excellent' : vars[14] >= 80 ? 'Good' : vars[14] >= 60 ? 'Fair' : 'Weak' )}"
                  icon: "${vars[14] >= 100 ? 'mdi:wifi' : vars[14] >= 80 ? 'mdi:wifi-strength-3' : vars[14] >= 60 ? 'mdi:wifi-strength-2' : 'mdi:wifi-strength-1' }"
                - entity: sensor.nodemcu_bedroom_rssi
                  name: "${'Bedroom' + '\xa0'.repeat(10) + 'MQTT ' + vars[15] + '\xa0'.repeat(4) + 'WiFi ' + vars[16] + '\xa0'.repeat(3) + vars[29] + '\xa0' +  'dBm' + '\xa0'.repeat(3) + ( vars[17] >= 100 ? 'Excellent' : vars[17] >= 80 ? 'Good' : vars[17] >= 60 ? 'Fair' : 'Weak' )}"
                  icon: "${vars[17] >= 100 ? 'mdi:wifi' : vars[17] >= 80 ? 'mdi:wifi-strength-3' : vars[17] >= 60 ? 'mdi:wifi-strength-2' : 'mdi:wifi-strength-1' }"
                - entity: sensor.sonoff3_0898_rssi
                  name: "${'Office' + '\xa0'.repeat(16) + 'MQTT ' + vars[18] + '\xa0'.repeat(4) + 'WiFi ' + vars[19] + '\xa0'.repeat(3) + vars[30] + '\xa0' + 'dBm' + '\xa0'.repeat(3) + ( vars[20] >= 100 ? 'Excellent' : vars[20] >= 80 ? 'Good' : vars[20] >= 60 ? 'Fair' : 'Weak' )}"
                  icon: "${vars[20] >= 100 ? 'mdi:wifi' : vars[20] >= 80 ? 'mdi:wifi-strength-3' : vars[20] >= 60 ? 'mdi:wifi-strength-2' : 'mdi:wifi-strength-1' }"
                - entity: sensor.sonoff4_0851_rssi
                  name: "${'TV' + '\xa0'.repeat(21) + 'MQTT ' + vars[21] + '\xa0'.repeat(4) + 'WiFi ' + vars[22] + '\xa0'.repeat(3) + vars[31] + '\xa0' + 'dBm' + '\xa0'.repeat(3) + ( vars[23] >= 100 ? 'Excellent' : vars[23] >= 80 ? 'Good' : vars[23] >= 60 ? 'Fair' : 'Weak' )}"
                  icon: "${vars[23] >= 100 ? 'mdi:wifi' : vars[23] >= 80 ? 'mdi:wifi-strength-3' : vars[23] >= 60 ? 'mdi:wifi-strength-2' : 'mdi:wifi-strength-1' }"

Here is the new cardā€¦
image
Here is the config:

          - type: 'custom:config-template-card'
            variables:
              coffee: states['sensor.sonoff1_2914_rssi'].state
              toothbrush: states['sensor.sonoff2_3110_rssi'].state
              garage: states['sensor.sonoff5_1083_rssi'].state
              alarm: states['sensor.sonoff6_3719_rssi'].state
              weather: states['sensor.nodemcu_lounge_rssi'].state
              bedroom: states['sensor.nodemcu_bedroom_rssi'].state
              xcy: states['sensor.sonoff3_0898_rssi'].state
              tv: states['sensor.sonoff4_0851_rssi'].state
              coffeesignal: states['sensor.sonoff1_2914_signal'].state
              toothbrushsignal: states['sensor.sonoff2_3110_signal'].state
              garagesignal: states['sensor.sonoff5_1083_signal'].state
              alarmsignal: states['sensor.sonoff6_3719_signal'].state
              weathersignal: states['sensor.nodemcu_lounge_signal'].state
              bedroomsignal: states['sensor.nodemcu_bedroom_signal'].state
              xcysignal: states['sensor.sonoff3_0898_signal'].state
              tvsignal: states['sensor.sonoff4_0851_signal'].state
            entities:
              - sensor.sonoff1_2914_rssi
              - sensor.sonoff1_2914_signal
              - sensor.sonoff1_2914_wifi_connect_count
              - sensor.coffee_maker_firmware
              - sensor.coffee_maker_status
              - sensor.sonoff2_3110_rssi
              - sensor.sonoff2_3110_signal
              - sensor.sonoff2_3110_wifi_connect_count
              - sensor.toothbrush_firmware
              - sensor.toothbrush_status
              - sensor.sonoff5_1083_rssi
              - sensor.sonoff5_1083_signal
              - sensor.sonoff5_1083_wifi_connect_count
              - sensor.garage_door_firmware
              - sensor.garage_door_status
              - sensor.sonoff6_3719_rssi
              - sensor.sonoff6_3719_signal
              - sensor.sonoff6_3719_wifi_connect_count
              - sensor.alarm_firmware
              - sensor.alarm_status
              - sensor.nodemcu_lounge_rssi
              - sensor.nodemcu_lounge_signal
              - sensor.nodemcu_lounge_wifi_connect_count
              - sensor.nodemcu_lounge_firmware
              - sensor.nodemcu_lounge_status
              - sensor.nodemcu_bedroom_rssi
              - sensor.nodemcu_bedroom_signal
              - sensor.nodemcu_bedroom_wifi_connect_count
              - sensor.nodemcu_bedroom_firmware
              - sensor.nodemcu_bedroom_status
              - sensor.sonoff3_0898_rssi
              - sensor.sonoff3_0898_signal
              - sensor.sonoff3_0898_wifi_connect_count
              - sensor.tv_switch_firmware
              - sensor.tv_switch_status
              - sensor.sonoff4_0851_rssi
              - sensor.sonoff4_0851_signal
              - sensor.sonoff4_0851_wifi_connect_count
              - sensor.xcy_mini_pc_firmware
              - sensor.xcy_mini_pc_status
            card:
              type: 'custom:hui-entities-card'
              title: MQTT & Wifi Connections
              show_header_toggle: false
              entities:
                - entity: sensor.coffee_maker_firmware
                  type: 'custom:multiple-entity-row'
                  show_state: false
                  name: "${'Coffee' + '\xa0'.repeat(16) + ( coffee >= 100 ? 'Excellent' : coffee >= 80 ? 'Good' : coffee >= 60 ? 'Fair' : 'Weak' )}"
                  icon: "${coffee >= 100 ? 'mdi:wifi' : coffee >= 80 ? 'mdi:wifi-strength-3' : coffee >= 60 ? 'mdi:wifi-strength-2' : 'mdi:wifi-strength-1' }"
                  entities:
                  - entity: sensor.coffee_maker_status
                    name: MQTT
                  - entity: sensor.sonoff1_2914_wifi_connect_count
                    name: WiFi
                  - entity: sensor.sonoff1_2914_signal
                    name: Signal
                  - entity: sensor.sonoff1_2914_rssi
                    name: RSSI
                - entity: sensor.toothbrush_firmware
                  type: 'custom:multiple-entity-row'
                  show_state: false
                  name: "${'Toothbrush' + '\xa0'.repeat(7) + ( toothbrush >= 100 ? 'Excellent' : toothbrush >= 80 ? 'Good' : toothbrush >= 60 ? 'Fair' : 'Weak' )}"
                  icon: "${toothbrush >= 100 ? 'mdi:wifi' : toothbrush >= 80 ? 'mdi:wifi-strength-3' : toothbrush >= 60 ? 'mdi:wifi-strength-2' : 'mdi:wifi-strength-1' }"
                  entities:
                  - entity: sensor.toothbrush_status
                    name: MQTT
                  - entity: sensor.sonoff2_3110_wifi_connect_count
                    name: WiFi
                  - entity: sensor.sonoff2_3110_signal
                    name: Signal
                  - entity: sensor.sonoff2_3110_rssi
                    name: RSSI
                - entity: sensor.garage_door_firmware
                  type: 'custom:multiple-entity-row'
                  show_state: false
                  name: "${'Garage' + '\xa0'.repeat(15) + ( garage >= 100 ? 'Excellent' : garage >= 80 ? 'Good' : garage >= 60 ? 'Fair' : 'Weak' )}"
                  icon: "${garage >= 100 ? 'mdi:wifi' : garage >= 80 ? 'mdi:wifi-strength-3' : garage >= 60 ? 'mdi:wifi-strength-2' : 'mdi:wifi-strength-1' }"
                  entities:
                  - entity: sensor.garage_door_status
                    name: MQTT
                  - entity: sensor.sonoff5_1083_wifi_connect_count
                    name: WiFi
                  - entity: sensor.sonoff5_1083_signal
                    name: Signal
                  - entity: sensor.sonoff5_1083_rssi
                    name: RSSI
                - entity: sensor.alarm_firmware
                  type: 'custom:multiple-entity-row'
                  show_state: false
                  name: "${'Alarm' + '\xa0'.repeat(17) + ( alarm >= 100 ? 'Excellent' : alarm >= 80 ? 'Good' : alarm >= 60 ? 'Fair' : 'Weak' )}"
                  icon: "${alarm >= 100 ? 'mdi:wifi' : alarm >= 80 ? 'mdi:wifi-strength-3' : alarm >= 60 ? 'mdi:wifi-strength-2' : 'mdi:wifi-strength-1' }"
                  entities:
                  - entity: sensor.alarm_status
                    name: MQTT
                  - entity: sensor.sonoff6_3719_wifi_connect_count
                    name: WiFi
                  - entity: sensor.sonoff6_3719_signal
                    name: Signal
                  - entity: sensor.sonoff6_3719_rssi
                    name: RSSI
                - entity: sensor.nodemcu_lounge_firmware
                  type: 'custom:multiple-entity-row'
                  show_state: false
                  name: "${'Weather' + '\xa0'.repeat(12) + ( weather >= 100 ? 'Excellent' : weather >= 80 ? 'Good' : weather >= 60 ? 'Fair' : 'Weak' )}"
                  icon: "${weather >= 100 ? 'mdi:wifi' : weather >= 80 ? 'mdi:wifi-strength-3' : weather >= 60 ? 'mdi:wifi-strength-2' : 'mdi:wifi-strength-1' }"
                  entities:
                  - entity: sensor.nodemcu_lounge_status
                    name: MQTT
                  - entity: sensor.nodemcu_lounge_wifi_connect_count
                    name: WiFi
                  - entity: sensor.nodemcu_lounge_signal
                    name: Signal
                  - entity: sensor.nodemcu_lounge_rssi
                    name: RSSI
                - entity: sensor.nodemcu_bedroom_firmware
                  type: 'custom:multiple-entity-row'
                  show_state: false
                  name: "${'Bedroom' + '\xa0'.repeat(10) + ( bedroom >= 100 ? 'Excellent' : bedroom >= 80 ? 'Good' : bedroom >= 60 ? 'Fair' : 'Weak' )}"
                  icon: "${bedroom >= 100 ? 'mdi:wifi' : bedroom >= 80 ? 'mdi:wifi-strength-3' : bedroom >= 60 ? 'mdi:wifi-strength-2' : 'mdi:wifi-strength-1' }"
                  entities:
                  - entity: sensor.nodemcu_bedroom_status
                    name: MQTT
                  - entity: sensor.nodemcu_bedroom_wifi_connect_count
                    name: WiFi
                  - entity: sensor.nodemcu_bedroom_signal
                    name: Signal
                  - entity: sensor.nodemcu_bedroom_rssi
                    name: RSSI
                - entity: sensor.xcy_mini_pc_firmware
                  type: 'custom:multiple-entity-row'
                  show_state: false
                  name: "${'Office' + '\xa0'.repeat(16) + ( xcy >= 100 ? 'Excellent' : xcy >= 80 ? 'Good' : xcy >= 60 ? 'Fair' : 'Weak' )}"
                  icon: "${xcy >= 100 ? 'mdi:wifi' : xcy >= 80 ? 'mdi:wifi-strength-3' : xcy >= 60 ? 'mdi:wifi-strength-2' : 'mdi:wifi-strength-1' }"
                  entities:
                  - entity: sensor.xcy_mini_pc_status
                    name: MQTT
                  - entity: sensor.sonoff3_0898_wifi_connect_count
                    name: WiFi
                  - entity: sensor.sonoff3_0898_signal
                    name: Signal
                  - entity: sensor.sonoff3_0898_rssi
                    name: RSSI
                - entity: sensor.tv_switch_firmware
                  type: 'custom:multiple-entity-row'
                  show_state: false
                  name: "${'TV' + '\xa0'.repeat(21) + ( tv >= 100 ? 'Excellent' : tv >= 80 ? 'Good' : tv >= 60 ? 'Fair' : 'Weak' )}"
                  icon: "${tv >= 100 ? 'mdi:wifi' : tv >= 80 ? 'mdi:wifi-strength-3' : tv >= 60 ? 'mdi:wifi-strength-2' : 'mdi:wifi-strength-1' }"
                  entities:
                  - entity: sensor.tv_switch_status
                    name: MQTT
                  - entity: sensor.sonoff4_0851_wifi_connect_count
                    name: WiFi
                  - entity: sensor.sonoff4_0851_signal
                    name: Signal
                  - entity: sensor.sonoff4_0851_rssi
                    name: RSSI

I also started using named variables which wasnā€™t possible with the old cardā€¦ but here is the genius of this approachā€¦

If I click on say Coffee I get this:
image
even though Iā€™m not showing the state it still shows in the state displayā€¦
But what if I click on MQTT? Well it brings up a different state card


Wifi? Uninteresting but:
image
Signal? yep
image
RSSI?? well of courseā€¦
image

This is WAY COOL and much better than I was hoping for!

Yes, this is a very convenient thing - but now we cannot use a "variable_x" to define a "variable_y" unfortunately - like we could use a "vars[x]" to define a "vars[y]" (Variables: use VARIABLE_1 to define VARIABLE_2 Ā· Issue #47 Ā· iantrich/config-template-card Ā· GitHub). Sometimes it is neededā€¦
For example, with using the old notation the code could be something like this:

variables:
  - '''sonoff5_1'''                           #0
  - '''sonoff5_2'''                           #1
  - '''sonoff5_3'''                           #2

  - '''_mqtt_connect_count'''                 #3
  - '''_wifi_connect_count'''                 #4
  - '''_rssi'''                               #5

  - 'states["sensor." + vars[0] + vars[3]]'   #6
  - 'states["sensor." + vars[0] + vars[4]]'   #7
  - 'states["sensor." + vars[0] + vars[5]]'   #8

  - 'states["sensor." + vars[1] + vars[3]]'   #9
  - 'states["sensor." + vars[1] + vars[4]]'   #10
  - 'states["sensor." + vars[1] + vars[5]]'   #11

  - 'states["sensor." + vars[2] + vars[3]]'   #12
  - 'states["sensor." + vars[2] + vars[4]]'   #13
  - 'states["sensor." + vars[2] + vars[5]]'   #14

entities:
  - '${vars[6].entity_id}'
  - '${vars[7].entity_id}'
  - '${vars[8].entity_id}'

  - '${vars[9].entity_id}'
  - '${vars[10].entity_id}'
  - '${vars[11].entity_id}'

  - '${vars[12].entity_id}'
  - '${vars[13].entity_id}'
  - '${vars[14].entity_id}'

But anyway that is a lot of repeating code.
So it could be better to use a decluttering card:

  decl_XXXXXXXXXXXXXX:
    card:
      type: 'custom:config-template-card'
      variables:
        - .............. [[SENSOR_XXXXXXXXXX]]
        - .............. [[SENSOR_YYYYYYYYYY]]
        - .............. [[SENSOR_ZZZZZZZZZZ]]
      entities:
        - '[[SENSOR_XXXXXXXXXX]]'
        - '[[SENSOR_YYYYYYYYYY]]'
        - '[[SENSOR_ZZZZZZZZZZ]]'
      row:
        type: 'custom:multiple-entity-row'
        entity: '[[SENSOR_XXXXXXXXXX]]'
        entities:
          - entity: '[[SENSOR_YYYYYYYYYY]]'
            ....
          - entity: '[[SENSOR_ZZZZZZZZZZ]]'
            ....
        name: .....
        unit: .....
        icon: .....
        toggle: false
        show_state: .....
        state_header: ''
        secondary_info: last-changed

How to use:

entities:
  - type: 'custom:decluttering-card'
    template: decl_XXXXXXXXXXXXXX
    variables:
      - SENSOR_XXXXXXXXXX: ..............
      - SENSOR_YYYYYYYYYY: ..............
      - SENSOR_ZZZZZZZZZZ: ..............
  - type: 'custom:decluttering-card'
    template: decl_XXXXXXXXXXXXXX
    variables:
      - SENSOR_XXXXXXXXXX: ..............
      - SENSOR_YYYYYYYYYY: ..............
      - SENSOR_ZZZZZZZZZZ: ..............
  - type: 'custom:decluttering-card'
    template: decl_XXXXXXXXXXXXXX
    variables:
      - SENSOR_XXXXXXXXXX: ..............
      - SENSOR_YYYYYYYYYY: ..............
      - SENSOR_ZZZZZZZZZZ: ..............
  - type: 'custom:decluttering-card'
    template: decl_XXXXXXXXXXXXXX
    variables:
      - SENSOR_XXXXXXXXXX: ..............
      - SENSOR_YYYYYYYYYY: ..............
      - SENSOR_ZZZZZZZZZZ: ..............

Regarding multiple-entity-row - you may use kind of ā€œstyles: width: 150pxā€ to prevent these misalignment:
image

Regarding using spaces:

'Coffee' + '\xa0'.repeat(16)

This will look nice only in case of using a font with fixed width; for proportional fonts it will cause a misalignment:
image
You may display these ā€œFair, Excellent etcā€ words in the "secondary-info" like it is described here (and even colourize it by card-mod like it is described here):
image

type: 'custom:config-template-card'
entities:
  - sun.sun
card:
  type: entities
  entities:
    - type: 'custom:multiple-entity-row'
      entity: sun.sun
      entities:
        - entity: sun.sun
          name: xxx
          styles:
            width: 60px
        - entity: sun.sun
          name: xxx
          styles:
            width: 60px
      unit: ''
      icon: ''
      toggle: false
      show_state: false
      state_header: ''
      state_color: false
      secondary_info: '${states[''sun.sun''].state === "above_horizon" ? "Rise and shine" : "Sleep well"}'

Actually, I thought that you were already using this card - your first pic looks like multiple-entity-rowā€¦

No itā€™s just an entities card.

Yes one of the issues I had is exactly that but I canā€™t make them form up in columns so open to suggestions for that.

Where would I put that? I see that issue so a solution would be welcomeā€¦ can you supply an edit of one of my rows to demonstrate that?

I dont see any issue with the new variablesā€¦ never used the old ones anyway and it doesnt seem to reduce the number required or make it readable anyway. Iā€™m donā€™t see a point in switching to a decluttering card for thisā€¦

Sorry to jump in, just to comment one thing.

Without the decluttering card youā€™re replicating the same ā€œline codeā€ for each ā€œdeviceā€, thatā€™s the redundancy.

If you use the decluttering card, youā€™ll create a template for the ā€œlineā€ and then youā€™ll use a variable to pass the device name, which will be applied to the whole line.

So, youā€™ll have a big decluttering-card ā€œtemplateā€ and a small ā€œviewā€ for each entry.
If you check @Ildar_Gabdullin code youƬll see that the " decl_XXXXXXXXXXXXXX:" your normal card (with all static config which would remain the same across devices) and then the entities card in the view will only call that newrly created template and pass the sensors name you need for that.

I would highly suggest to give it a try, I started to use it and I have to say it makes things way clearer.

:slight_smile:

1 Like

I will take a look at that. I remember thinking about it.

For displaying these ā€œExcellentā€ etc words you may use 3 options:

  1. Create a template sensor (not a good thing if you are going to use these words in one place only) and display it in a separate column.
  2. Display these words in the "secondary-info" part (as I described above).
  3. Use this method to create something like this:
    image
    The idea is to display ANYTHING instead of some state.
    Look - this code is under "config-template-card" - but this does not need it since the templating is implemented by card-mod:
type: entities
entities:
  - type: 'custom:multiple-entity-row'
    style: |
      :host .entities-row div.entity:nth-child(1) div::before {
        color: orange;
        content: {%if is_state('sun.sun','above_horizon') -%} "Rise and shine\A" {%- else -%} "Sleep well\A" {%- endif %};
        line-height: var(--mdc-typography-body1-line-height, 1.5rem);
      }
      :host .entities-row div.entity:nth-child(1) div {
        color: transparent;
        line-height: 0px;
      }
    entity: sun.sun
    entities:
      - entity: sun.sun
        name: xxx
        styles:
          width: 60px
      - entity: sun.sun
        name: xxx
        styles:
          width: 60px
    unit: ''
    icon: ''
    toggle: false
    show_state: false
    state_header: ''
    state_color: false

Switching to decluttering is not related with ā€œhow to declare & use variablesā€ - it is just about:

  1. Reduce number of lines.
  2. In case of need to change something - change it in the decluttering template only (the basis of using ā€œfunctionā€, ā€œprocedureā€ etc in Programming).

I have already used it in the examples above, please check these lines:

        - entity: sun.sun
          name: xxx
          styles:
            width: 60px

Ok guys Iā€™m officially annoyed of not making it work!! So, i Have a card like the one in the picture at the end. I would like to change the ā€œActivityā€ with the name of the work out that comes from stravaā€¦ How can this be done?
The last one i tried was the code below and i got the ā€œno card or row or element definedā€ā€¦ Any help?

title: Strava
icon: mdi:heart-pulse
cards:
  - type: "custom:config-template-card"
    title: "${states('sensor.strava_0_0')}"
    entities:
      - type: attribute
        entity: sensor.strava_0_0
        attribute: friendly_name
        name: Date
        icon: mdi:calendar-clock
      - entity: sensor.strava_0_1
        name: Duration

1

ā€œ${states[ā€˜sensor.strava_0_0ā€™].state}ā€`

I have tried that as well but the problem as i said is that i get the ā€œNo card or row or element definedā€ errorā€¦

When looking at this:

title: Strava
icon: mdi:heart-pulse
cards:

I do not see any "type: " definition here.

But should i define the ā€œcustom:config-template-cardā€ there? The other yaml files i have iā€™ve never set the type thereā€¦ Also, I tried to put define the type there but no luck

The whole code is wrong.
If it should be Entities card inside the "config-template-card" then it must be kind of this:

type: 'custom:config-template-card'
entities:
  - ..........
card:
  type: entities
  title: .....
  entities:
    - ....

With the code below i get ā€œNo card type definedā€

title: Garmin
icon: mdi:heart-pulse
type: "custom:config-template-card"
entities:
  - entity: sensor.strava_0_1
card:
  - type: entities
    title: "${states['sensor.strava_0_0'].state}"
    entities:
      - type: attribute
        entity: sensor.strava_0_0
        attribute: friendly_name
        name: Date
        icon: mdi:calendar-clock
      - entity: sensor.strava_0_1
        name: Duration```

At least replace this:

card:
  - type: entities

with this:

card:
  type: entities
1 Like

Yeah I saw it after i posted it and i was trying to fix it. Finally it worksā€¦ Thanks a lot!!

@DavidFW1960, sorry for direct mentioning, you wanted to use "config-template-card" for:

  1. Displaying the ā€œExcellent, Fairā€ etc words - may be done by "secondary_info" or "card-mod" (see examples above).
  2. Changing an icon dependingly on state:
  • may by done by specifying an icon ("icon_template") in config (if possible);
  • may be done by using "Custom UI" (never used by myself so far, I am still learning, but I know that it may be used for this);
  • also check about a ready "device_class" for this ("signal_strength" may be? Update: seems NO).

Means - you may not use "config-template-card" at all.