How to sort, add and join data in a template

Interesting macro!
But I am not interested in a “block of hours” to run the house heating in this case.