I’ve been a programmer essentially all my life and I confess to complete confusion…
Can someone point me to a good description of how template syntax works, specifically with regard to something like config-template-card.
I found the Jinja2 pointer. I’ve read the HA templating section. Neither one seems to discussion structures related to ${x} formats.
Largely by trial and error I got this structure which works:
- type: 'custom:config-template-card'
entities:
- sensor.zone_1_average_temp
- input_number.temp_target_z1_low
- input_number.temp_target_z1_high
card:
type: gauge
entity: sensor.zone_1_average_temp
min: 60
max: 90
segments:
- from: 60
color: Blue
- from: ${states["input_number.temp_target_z1_low"].state }
color: lightgreen
- from: ${states["input_number.temp_target_z1_high"].state }
color: yellow
- from: 80
color: red
I got it mostly from examples posted, but got diverted by using single vs double quotes (and still not sure when you use which as the github documentation for the card shows single but they fail here).
But I wanted to do something simple like add 0.1 to the state (basically a greater vs greater-equal). I can’t find any syntax that works.
Perhaps more to the point, I can’t figure out how to tell what each syntax actually does – if I just stick +0.1 after the state on the “low” line I get all blue, as though the line is just lost. If I put things in parentheses I get a black gauge, presumably an error but no error shown.
I’m not looking for the solution to the 0.1 issue (though I’m happy to hear), but more… how does one learn the real syntax?
I’m tired of trial and error, happy to spend some time reading, but in my search through the template stuff just as a for-example, I can’t find ${x} syntax anywhere.