@Frantisek I've moved this post to it's own topic, as you posted it in a topic about 'how to control a heating system'.
ALSO, please see this post about posting code or flows in the forum.
I've edited your post above, so that it is readable in the forum.