Virtual Thermostat for single heater but multiple TRVs

Hi, I am relatively new to HA (coming from domoticz) and I am having problem setting up a virtual thermostat. I searched the forum and read the doc with no success.

I have a single heater (controlled by a zwave switch) and one zwave TRV for each room. I created a thermostat card in lovelace for each TRV so that each room temp can be set independently.
I want to turn off the heater when all the TRVs have reached the desired temp and turn it on when at least one has not.
I read the Generic thermostat doc and I tried it out, but it cannot work since it requires a single temp sensor reading while I need it to check the above conditions.

More formally what I want is something like this:

  • turnON HeaterSwitch
    IF
    HeaterSwitch = Off AND
    ( TRV-Study.temp < TRV-Study-Comfort - 0,3 OR
    TRV-Bedroom.temp < TRV-Bedroom-Comfort - 0,3 OR
    TRV-Bedroom2.temp < TRV-Bedroom2-Comfort - 0,3 OR
    LivingRoom.temp < LivingRoom-Comfort -0,3)

  • turnOFF HeaterSwitch
    IF
    HeaterSwitch = On AND
    ( TRV-Study.temp > TRV-Study-Comfort + 0,3 AND
    TRV-Bedroom.temp >TRV-Bedroom-Comfort + 0,3 AND
    TRV-Bedroom2.temp > TRV-Bedroom2-Comfort + 0,3 AND
    LivingRoom.temp > LivingRoom-Comfort + 0,3)

Thanks in advance for any help!