with say 21, the button works changing the temperature to 21. Which makes me think the problem is within the {{ }} line. I recently added the '| float' but it still didn’t resolve the issue.
Ive tested the {{ }} line in dev-tools > template and all works.
The error is coming from the fact that lovelace does not support templates. No matter what you place in there, it has to be a number and only a number. The easiest way to accomplish your goal is to make a script and call the script.
Thanks Emphyrio, I had tried swopping float around without success. Hadn’t seen the fact regarding javascript templates.
‘Not an expert’??? well you solved my problem thank you browetd, worked perfectly.
Thank you petro, but the javascript above worked. Im still glad of your input because it will help me in script writing. I’ve been focusing too much on Jinja and need to understand other methods.
Well the custom button card is unique in the fact it allows JS templating in every field. So this solution will only work in that card, where as a script will work everywhere
@splinter You can try to use the following Javascript functions: “Math.min” and “Math.max” to keep the variable “temp” between the max and the min values… I have not tested so not sure it will work in HA…