Hello
Really like this frontend customisation.
I’m wondering if someone could assist please. I’m trying to use an attribute as a name, specifically show time as name and value as the value. It looks like the template is getting parsed but something is not working and I don’t know what. Maybe it’s just not possible.
- type: custom:multiple-entity-row
entity: sensor.env_lounge_humidity_cal
name: Humidity
show_state: false
entities:
- entity: sensor.template_env_lounge_humidity_cal_min_today
name: {{ sensor.template_env_lounge_humidity_cal_min_today', 'ts_updated') }}
Configuration errors detected:
missed comma between flow collection entries (20:82)
17 | ...
18 | ...
19 | ... _cal_min_today
20 | ... y_cal_min_today', 'ts_updated') }}
-----------------------------------------^
21 | ... _cal_max_today
22 | ...
Thanks in advance
tom_l
June 9, 2024, 8:48am
2
name: "{{ state_attr('sensor.template_env_lounge_humidity_cal_min_today', 'ts_updated') }}"
That’s assuming the card supports templates in the name. Which it probably doesn’t.
I don’t believe name:
will accept a template.
tom_l
June 9, 2024, 8:51am
5
Yeah I was just looking it up:
So the only way to do it is with this:
Lovelace Templates
I’ve gone and made a crazy card that allows you to pretty much template anything in Lovelace for your card configurations using any information available on the frontend; states, attributes, user, etc.
Want state/attribute-based icons? DONE!
Want dynamic stacks; vertical vs horizontal based on user? DONE!
Want OR conditionals? DONE!
The list is pretty much endless and I’m sure you all will come up with some crazy stuff. Be sure to share.
Go nuts! Enjoy!
It’s possible via a pseudo element and card_mod, but your suggestion is less convoluted
Thanks everyone.
That config-template-card integration worked perfectly. Awesome.
type: custom:config-template-card
entities:
- sensor.template_env_lounge_temperature_cal_min_today
variables:
TS_TEMP_MIN: >-
new Date(states['sensor.template_env_lounge_temperature_cal_min_today'].attributes.ts_updated).toLocaleTimeString().replace(/(.*)\D\d+/, '$1')
card:
type: entities
entities:
- type: custom:multiple-entity-row
entity: sensor.env_lounge_temperature_cal
name: Temperature
show_state: false
entities:
- entity: sensor.template_env_lounge_temperature_cal_min_today
name: ${TS_TEMP_MIN}