Created atolls section with the custom-ui , I have a set of tiles with heights that adjust to the info being displayed dynamically. I want to have the tiles only show 2 lines (instead of possible 3 when the value is too long to fit and needs the 3d row) because the image resizing causes problems. pleas have a look at this code
example:
- entity: switch.sw_tester_template
label_sec_template: >
if (state === 'on') return 'Tester' +
entities['sensor.tester_actueel'].state;
return 'Tester off';
icon_template: >
if (state === 'on') return 'mdi:test-tube';
return 'mdi:test-tube-off';
this shows the Tester tile with name Tester and its value.
Trying to take the word Tester out only to show the value, I tested this:
- entity: switch.sw_tester_template
label_sec_template: >
if (state === 'on') return entities['sensor.tester_actueel'].state;
return 'Tester off';
icon_template: >
if (state === 'on') return 'mdi:test-tube';
return 'mdi:test-tube-off';
But that wouldn’t show any text nor value. This however does work:
- entity: switch.sw_tester_template
label_sec_template: >
if (state === 'on') return '' +
entities['sensor.tester_actueel'].state;
return 'Tester off';
icon_template: >
if (state === 'on') return 'mdi:test-tube';
return 'mdi:test-tube-off';
Why do i need to show the empty text ‘’ and doesnt the entities[‘sensor.tester_actueel’].state (also tried states.sensor.tester_actueel.state ) show when on its own?
Thanks for you help,
Marius