Complicated Heating Rule

You are right. The rule syntax is correct. Also correct are the calculations. Due to your tip to add some logging to the rule I could manage to find where the problem resides. It is in the presence (FritzTR064) bindning which has detection problems with their new wifi-mesh system. I hope they figure it out so it doesn’t come to interupts anymore.

I am posting the final working rule code for everyone who needs heating calculations based on hysteresis, vacation, sleeptime, presence and logging info.

rule "Wohnen Heizen"
when
	Item Temp_Wohnen received update or
    Item gAnwesenheit changed or
    Item Schlafen_Wochentage changed or
    Item Urlaub changed
then
        var Number hysteresis = 1
        var Number solltempanwesend = 17
        var Number solltempschlafen = 18
        var Number solltempnichtanwesend = 16
        var Number solltempurlaub = 12
        var Number isttemp = Temp_Wohnen.state as DecimalType
        var Number zusatz = Heizung_Zusatz.state as DecimalType
    /* Heizung Anwesend Wach */
    if (gAnwesenheit.state == ON && Schlafen_Wochentage.state == OFF){
	   	if (isttemp <= (solltempanwesend - hysteresis)) {logInfo("wohnen.rules", "Condition1/1") Soll_Temp_Wohnen.sendCommand(solltempanwesend + hysteresis + zusatz)}
        if (isttemp > (solltempanwesend + hysteresis)) {logInfo("wohnen.rules", "Condition1/2") Soll_Temp_Wohnen.sendCommand(solltempanwesend - hysteresis + zusatz)}
        if ((isttemp >= (solltempanwesend - hysteresis)) && (isttemp <= (solltempanwesend + hysteresis))) {logInfo("wohnen.rules", "Condition1/im Hysteresebereich")}
    } 
    /* Heizung Anwesend Schlafen */
    if (gAnwesenheit.state == ON && Schlafen_Wochentage.state == ON){
    	if (isttemp <= (solltempschlafen - hysteresis)) {logInfo("wohnen.rules", "Condition2/1") Soll_Temp_Wohnen.sendCommand(solltempschlafen + hysteresis + zusatz)}
        if (isttemp > (solltempschlafen + hysteresis)) {logInfo("wohnen.rules", "Condition2/2") Soll_Temp_Wohnen.sendCommand(solltempschlafen - hysteresis + zusatz)}
        if ((isttemp >= (solltempschlafen - hysteresis)) && (isttemp <= (solltempschlafen + hysteresis))) {logInfo("wohnen.rules", "Condition2/im Hysteresebereich")}
    }
    /* Heizung nicht Anwesend */
    if (gAnwesenheit.state == OFF && Urlaub.state == OFF){
    	if (isttemp <= (solltempnichtanwesend - hysteresis)) {logInfo("wohnen.rules", "Condition3/1") Soll_Temp_Wohnen.sendCommand(solltempnichtanwesend + hysteresis + zusatz)}
        if (isttemp > (solltempnichtanwesend + hysteresis)) {logInfo("wohnen.rules", "Condition3/2") Soll_Temp_Wohnen.sendCommand(solltempnichtanwesend - hysteresis + zusatz)}
        if ((isttemp >= (solltempnichtanwesend - hysteresis)) && (isttemp <= (solltempnichtanwesend + hysteresis))) {logInfo("wohnen.rules", "Condition3/im Hysteresebereich")}
    }
    /* Heizung Urlaub */
    if (gAnwesenheit.state == OFF && Urlaub.state == ON){
    	if (isttemp <= (solltempurlaub - hysteresis)) {logInfo("wohnen.rules", "Condition4/1") Soll_Temp_Wohnen.sendCommand(solltempurlaub + hysteresis + zusatz)}
        if (isttemp > (solltempurlaub + hysteresis)) {logInfo("wohnen.rules", "Condition4/2") Soll_Temp_Wohnen.sendCommand(solltempurlaub - hysteresis + zusatz)}
        if ((isttemp >= (solltempurlaub - hysteresis)) && (isttemp <= (solltempurlaub + hysteresis))) {logInfo("wohnen.rules", "Condition4/im Hysteresebereich")}
    }
end

Thank you Garry for pointing me to the right direction.

1 Like