I think this should be ready to use in your value_template then, using the most recent code I posted.
Is your temp sensor above 12.8?
And just so we’re all on the same page please repost your latest automation and make sure you format it properly.
Okay all. Now its working. Guess it was my own mistake because i had made a misspelling.
Thank you all, and thanks for your patience