Sure.
The system contains multiple rulesets. First one is for controlling the target temperature. This is manly done via Outlook and the CalDAV binding in combination with motion sensors to adjust the temperature if someone is present. The so given target temp is stored in the item “SolltemperaturXX” (XX for the respective room).
The second ruleset is for actual temperature regulation. At first there is calculated es mixed temperature from all sensor (two Spirits an external Sensor). I’m not using the average, as the temperature from the external sensor is more weighted than the information from the Spirits. The result is stored in the item “MixedTempXX”
rule "Externe Temperatur für Thermostate erzeugen"
when
Member of Temperatur changed
then
var Temp_SensorMixXX = MultisensorDachgeschoss_Temperatur.state as Number
Temp_SensorMixXX = Temp_SensorMixXX * 2
Temp_SensorMixXX = Temp_SensorMixXX + TH_XX1_TempIST.state as Number
Temp_SensorMixXX = Temp_SensorMixXX + TH_XX2_TempIST.state as Number
Temp_SensorMixXX = Temp_SensorMixXX / 4
MixedTempXX.sendCommand(Temp_SensorMixXX) as Number
end
And at last the actual temperature regulation. At first the thresholds are defined depending on the item “Heizungssteuerung”. It from the first ruleset and codes scenario information. “3” stands for “resident is absent, but will come soon, so start heating up”. “4” is “resident at home”. Plus, distinction between someone being present in the room or not. The two variables Comparator1 and 2 are upper and limit, where the heating is switched off, and lower limit where the heating is forced to 100% vent opening.
rule "Heizungsregelung XX"
when
Item SolltemperaturXX changed or
Item MixedTempXX changed or
Item Heizungssteuerung changed or
Member of MotionPresence changed or
Time cron "0 */5 * * * ?"
then
var PositiveThreshold = 0.2 // Grenze zum abschalten bei Überschreitung Soll-Wert
var NegativeThreshold = 12.0 // Grenze zum anschalten bei Unterschreitung Soll-Wert
// Anpassung der Variablen je nach Heizungszustand
if(Heizungssteuerung.state == 3) {
PositiveThreshold = 0.2
NegativeThreshold = 1.0
}
if(Heizungssteuerung.state == 4 && AnwesenheitXX.state == OFF) {
PositiveThreshold = 0.2
NegativeThreshold = 0.6
}
if(Heizungssteuerung.state == 4 && AnwesenheitXX.state == ON) {
PositiveThreshold = 0.2
NegativeThreshold = 0.4
}
//Dachgeschoss
var Comparator1 = SolltemperaturXX.state as Number //Oberer Grenzwert
Comparator1 = Comparator1 + PositiveThreshold
var Comparator2 = SolltemperaturXX.state as Number //Unterer Grenzwert
Comparator2 = Comparator2 - NegativeThreshold
ObererGrenzwertXX.sendCommand(Comparator1) as Number
UntererGrenzwertXX.sendCommand(Comparator2) as Number
First of the three if-blocks is for the case when the MixedTemp is in between the two comparators. The item “HeizungsmodusXX” is linked of the heating-state-channel off the spirits. “KomforttemperaturXX” is the channel “Setpoint Heat”. So in this mode the actual target temp is given to the spirits and their internal regulation can do it’s job. External Temperature is sending every five minutes (with “TempUpdateXX” the expire-binding is used) or a temp update is forced when coming from another state.
Second if-block is for turning off. External temp is set to 50°C a target temp to 10°C. Additionally there is some kind of “shutdown sequence”, where the spirits are set to “Energy heat state” first, before turning them off. Without this, I had the problem that the valve channel showed 0% opening but was still open for 100%, which was pretty annoying.
Last Block is for forcing 100% valve opening. External temperature is set to 0°C and target temp to 28°C.
//Heizkörper XX bei Messwert über Hysteresegrenze ausschalten
if(MixedTempXX.state >= Comparator1) {
ForceTempXX.sendCommand(ON)
// Externe Temperatur auf 50°C setzen
if(TH_XX1_ExTemp.state != 50 || TH_XX2_ExTemp.state != 50 || TempUpdateXX.state == ON) {
ExTempXX.sendCommand(50)
TempUpdateXX.sendCommand(OFF)
}
// Solltemperatur auf 10°C schalten
if(TH_XX1_Heat_Hi.state != 10 || TH_XX2_Heat_Hi.state != 10) {
Thread::sleep(5000)
KomforttemperaturXX.sendCommand(10)
Thread::sleep(10000)
}
// Heizung Ausschalten
if(TH_XX1_Mode.state != 0 || TH_XX2_Mode.state != 0) {
HeizungsmodusXX.sendCommand(11)
Thread::sleep(10000)
HeizungsmodusXX.sendCommand(0)
}
}
//Heizkörper XX bei Messwert unter Hysteresegrenze Einschalten und auf 28°C setzen (Vollast)
if(MixedTempXX.state < Comparator2) {
ForceTempXX.sendCommand(ON)
//Heizung Einschalten
if(TH_XX1_Mode.state != 1 || TH_XX2_Mode.state != 1) {
HeizungsmodusXX.sendCommand(1)
}
// Solltemperatur auf 28°C schalten
if(TH_XX1_Heat_Hi.state != 28 || TH_XX2_Heat_Hi.state != 28) {
KomforttemperaturXX.sendCommand(28)
}
//Externe Temperatur auf 0°C setzen
if(TH_XX1_ExTemp.state != 0 || TH_XX2_ExTemp.state != 0 || TempUpdateXX.state == ON) {
ExTempXX.sendCommand(0)
TempUpdateXX.sendCommand(OFF)
}
}
end
Hope I could help!
Greets
Alex