Different temperature sensor for heating trigger depending on time of day

Hi
Trying to automate my heating controls
I have 3 modes - Home Away Night with switches to switch between them
Each mode can have it’s own temperature, which can be changed
I can change the value of the required temperature using rules (which I will share later as although they work am sure could be done better)
What I need to do is to change the thermostat/thermometer I use to switch the heating off and on
ie Home/Away use ground floor or living room
Night - use main bedroom
Not helpful that each temperature has a different item name - they are grouped though.
Some general pointers would be most welcome.

It seems you can add and remove items from a Group. When your Mode Item changes, add or remove the necessary Temperature Items to a specific Group, and use this Group for your calculations in your Rules.

rule "Set Initial Heating Virtuals"

when 
     System started
then     
     if (Heating_Temp.state == NULL){
     Heating_Temp.postUpdate(16)
     }
     else if(Heating_Monitoring_Temp.state == NULL){
     Heating_Monitoring_Temp.postUpdate(15)
     } 
end

rule "Heat Mode Change"
when
    Item Heat_Mode_Home changed to ON
then
    Heating_Type.postUpdate("Home")
    Heat_Mode_Away.postUpdate(OFF)
    Heat_Mode_Night.postUpdate(OFF)
end

rule "Heat Temp Change"
when
    Item Heat_Mode_Home_Temp changed or
    Item Heating_Type changed
then
    if (Heating_Type.state == "Home")
    Heating_Temp.postUpdate(Heat_Mode_Home_Temp.state as Number)
end

rule "Heat Mode Change 1"
when
    Item Heat_Mode_Away changed to ON
then    
    Heat_Mode_Home.postUpdate(OFF)
    Heat_Mode_Night.postUpdate(OFF)
    Heating_Type.postUpdate("Away")
end

rule "Heat Temp Change1"
when
    Item Heat_Mode_Away_Temp changed or
    Item Heating_Type changed
then
    if (Heating_Type.state == "Away")
    Heating_Temp.postUpdate(Heat_Mode_Away_Temp.state as Number)
end

rule "Heat Mode Change2"
when
    Item Heat_Mode_Night changed to ON
then
    Heat_Mode_Home.postUpdate(OFF)
    Heat_Mode_Away.postUpdate(OFF)
    Heating_Type.postUpdate("Night")
end

rule "Heat Temp Change2"
when
    Item Heat_Mode_Night_Temp changed or
    Item Heating_Type changed
then
    if (Heating_Type.state == "Night")
    Heating_Temp.postUpdate(Heat_Mode_Night_Temp.state as Number)
end



rule "Heating Governor"

when
    Item Heating_Monitoring_Temp changed or
    Item Heating_Temp changed
then
    var Number house_heat = (Heating_Monitoring_Temp.state as Number)
    var Number heat_setpoint = (Heating_Temp.state as Number)
    val Number offset = 0.5
    if (house_heat >= (heat_setpoint + offset)) {
        ZWaveNode016SSR302TwoChannelBoilerActuator_Switch.sendCommand(OFF)
    } else if (house_heat < (heat_setpoint - offset)) {
        ZWaveNode016SSR302TwoChannelBoilerActuator_Switch.sendCommand(ON)
    }
end

This all works as it should - although am sure there are better ways of putting it

rule "Heating Monitoring Temperature"
when
    Member of gHeatingMode changed or
    Member of gHeatingMonitoring changed
    
then
    if (Heating_Mode.state == "Home" || Heating_Mode.state == "Away" ){
       Heating_Monitoring_Temp.postUpdate(ZWaveNode020010101PoppWirelessThermostaticValveTRV_SensorTemperature.state as Number)
    }
    else if (Heating_Mode.state == "Night"){
        Heating_Monitoring_Temp.postUpdate(mqtt_topic_7a78da2f_masterbedroom_temperature.state as Number)
    }
end

This bit doesn’t work - I used the DP from the reply above. If an Item is a member of more than 1 group does that matter - or is it only if a group is part of another group rules dont work?

Actually think there is a logic error here
I need change Member of etc to the 2 variables - ie if they change then update the Heat_Monitoring_Temp item

Edit - Heating_Mode should say Heating_Type

Not quite sure I can follow everything, maybe edit or repost, so that it is clear what you exactly mean.

No that does not matter

Not sure, but I don’t think that you can go recursive into groups and find the member of groupA, when groupA is part of groupB and groupB is used as a rule trigger. With such a construct, you may also experience difficulties to find the correct rule trigger (for example if you define your groupA with AND, then all members will need the same state before groupA will change its state). But maybe I misunderstood.

Yes that’s exactly what I meant - thank you