Coffee is just text for the entity and the 90% RSSI state belongs to that. I want tapping on coffee to pull up the second entity more info which isnāt currently on that coffee line at all. Basically the different Tasmota entities for the sonoff switch (provided by the integration) make up the Coffee Line and I am writing a status command from MQTT to a Sensor which provides all the more infoā¦ so the rssi entity is the entity for the 90% but when I tap it I want it to show the status sensor instead of the RSSI graph.
So Iād likt to use a template to override the state with a state from a different entityā¦ them more info would be the bit I want but the state would still be the RSSIā¦
Maybe I need to do a collapsed fold-entity-row for the second entity and then tap that to display the more infoā¦
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:
There is a multiple-entity-row.
The primary item (the first one) is some entity (āprimary entityā).
Other items (āsecondary itemsā) are either another entities or attributes of some entity.
Every item (primary & secondary) has a ātap_actionā which is āmore-infoā.
What you may want is:
Disable the āmore-infoā for some item (ātap_action: action: noneā).
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.
iantrich
(Ian)
April 12, 2021, 2:21pm
461
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ā¦
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ā¦
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:
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:
Signal? yep
RSSI?? well of courseā¦
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:
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:
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 ):
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ā¦
SeLLeRoNe
(Andrea Iannucci)
April 13, 2021, 8:50am
467
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.
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:
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.
Display these words in the "secondary-info"
part (as I described above).
Use this method to create something like this:
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:
Reduce number of lines.
In case of need to change something - change it in the decluttering template only (the basis of using āfunctionā, āprocedureā etc in Programming).
DavidFW1960:
Where would I put that?
I have already used it in the examples above, please check these lines:
- entity: sun.sun
name: xxx
styles:
width: 60px
Stefos
(Stefanos)
April 13, 2021, 9:10am
471
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
ā${states[āsensor.strava_0_0ā].state}ā`
Stefos
(Stefanos)
April 13, 2021, 9:28am
473
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.
Stefos
(Stefanos)
April 13, 2021, 10:01am
475
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:
- ....
Stefos
(Stefanos)
April 13, 2021, 10:15am
477
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```
Stefos
(Stefanos)
April 13, 2021, 10:23am
479
Yeah I saw it after i posted it and i was trying to fix it. Finally it worksā¦ Thanks a lot!!