adamsw
1
There is any way for the below template:
{{ states('sensor.012110518400021093_selected_program') }}
which returns:
Dishcare.Dishwasher.Program.Eco50
to get friendly name as below (the same sensor via tile or entity control):
My target is to get user friendly names in the button-card, as of now it looks like below:
pedolsky
(Pedolsky)
2
Is there any information in the sensor’s attributes which can be used?
adamsw
3
Unfortunately not, but how it works then in the other controls?
pedolsky
(Pedolsky)
4
No guarantee because I don’t use Home Connect:
type: custom:button-card
entity: sensor.012110518400021093_selected_program
name: |
[[[
let base = entity?.state,
str = base.substring(base.lastIndexOf('.') + 1),
num = str.match(/\d+/),
p = str.split(num)[0];
return num
? p + ' ' + num + '°C'
: p;
]]]
1 Like
adamsw
5
@pedolsky Thank you for the code, I ended up using JavaScript in that part, somehow I missed this option before.