UI refreshed after having template sensor configured

Hi,

I have home assistant installed and configured a lot, after a while I noticed my UI (dashboard, energy dashboard) keeps refreshing every second. I read on the internet that is has something to do with the template sensors. I removed those and restarted. After the restart, the issue disappeared. To dubbelcheck I reinstated my configuration and the refreshing returns. I need the template sensors because of data I want to put into Grafana (the values needs to be transformed otherwise I can’t use the data in the graphs), so I hope someone can give me a solution.