I am new to Openhab and have two number items to measure temperature from two different locations. I want to create a rule to compare the value of the two sensors and the create an action if there is a difference of say 5 degrees.
Hi,
not exactly what you need - but I hope it helps you to create our own rule. This is one of my rules I use to control the temperature (soll: target, ist: actual):
rule "HeizungEingang"
when
Time cron "0 0/30 * * * ?"
or Item heizungEingangTargetTemperatur changed
then
zWaveValve48Mode.sendCommand(0x1F)
var double soll = (heizungEingangTargetTemperatur.state as DecimalType).doubleValue
var double ist = (zWaveSensor25Temperature.state as DecimalType).doubleValue
if ((mqttPresencePatrik.state == OFF)
&& (mqttPresenceKarin.state == OFF)) {
soll = soll - 1.5
}
if ((ist + 2) < soll) { heizungEingangEG.sendCommand(100) }
else if ((ist + 1) < soll) { heizungEingangEG.sendCommand( 75) }
else if ((ist + 0.5) < soll) { heizungEingangEG.sendCommand( 50) }
else if (ist == soll) { heizungEingangEG.sendCommand( 25) }
else { heizungEingangEG.sendCommand(0) }
end
Thanks Patrik, that works for me