You’re rounding the number 100. The int filter is in the wrong place and you are using a method of obtaining the attribute that will generate errors if the sensor is not ready (like after a restart).
Thanks @tom_l. It’s amazing that with so much wrong with my template it actually produced valid results most of the time! That’s why templates are still a bit of a black art for me.
I’ll keep an eye on it over the day as the heating goes on and off to see how it works out.
Hi @tom_l, just a quick update on this - I noticed that the template was returning 0% a lot and I think it was caused by the integer conversion in the template. The TRV returns the valve opening as a number from 0.0 to 1.0 so I presume anything less than 1 was being returned as 0.
Here is the working version without the integer conversion: