OK, my question still stands on the correct way to format within the name statement, and how to use the ‘${ }’ format, but I have worked around this as follows:
- type: conditional
conditions:
- entity: input_boolean.ac_full_auto
state: 'off'
card:
type: custom:config-template-card
entities:
- climate.ac
variables:
ac_mode: states['climate.ac'].state
ac_mode_full: |
msg => {
if (msg == 'off') {
return 'Manual control - off';
}
else if (msg == 'cool') {
return 'Manual control - cooling';
}
else if (msg == 'heat') {
return 'Manual control - heating';
}
else if (msg == 'dry') {
return 'Manual control - drying';
}
else if (msg == 'fan_only') {
return 'Manual control - fan';
}
return 'Manual Control';
}
card:
type: custom:simple-thermostat
entity: climate.ac
header:
name: "${ ac_mode_full(ac_mode) }"
I’d still like to know if there is a better way to achieve this though…
What is that, and is there a guide how to somewhere?
For my knowledge - what are the different template forms called? e.g. I have had to use ${ } for custom:config-template-card as noted above, but I had to use ‘{% if is_state…’ in the ‘style’ definition of the same card to get variable style control. At the moment I’m working it out by trial and error, but knowing what terms to search for would be a help.
The code you are using is Javascript. There are thousands of tutorials on the internet for this. The code isn’t covered here because it’s a basic language used by pretty much every webpage.
Just google “js dictionary tutorial”
That’s jinja. That’s for templating fields outside the template card. You’re using a hard card. The card itself uses JS for it’s templating, while the card you’re modifying may or may not use jinja templates. Do not confuse the 2. They are different syntax and different code.