Heater control logic example?

Hi

I’m thinking to control my heater (central heating system) in my flat with HA. I have already a relay wired to heater to control it through the kitchen ESP (used also for local temp./hum. measures).
As I’m still pretty beginner with HA logic I was looking for some examples on website to use/reuse/modify to my own needs but found nothing :frowning: If some people have done that, would they mind to share it ?
My ideas are these ones:
-> automatically stop/restart heater based on my in/out status (based on Owntracks tracker)
-> same logic with windows (I have some sensors already linked to HA so I know as soon as one of windows is opened).
-> be able to setup the temperature wanted for day and night (two different settings).
-> switch automatically to night mode based on sensors in flat (if kitchen/living room radars don’t see anyone more than 10 minutes and if it’s night (have a sensor for that already) then switch heating to night mode).
-> general switch between summer/winter mode.

Is it possible to do such thing in HA ? or too complicated ? Not sure where to start with to get best and simplest logic !

Thanks

Vincèn