Hello ALL,
I have been using OpenHAB for several years but I used it only for the presentation of my home,
For some time I have been trying to go with the whole control to control from the OpenHAB level and here I have a problem,
I wrote a few rules that work for me but I also wanted to write rules with numerical conditions and unfortunately they do not work, despite the fact that they work well
Example of a working rule:
rule “CH pump - ON control”
when
Time cron “0 0/5 * 1/1 *? *” Or // every 5 minutes
Item piec changed
then
// logInfo (“CH pump”, “CH pump operation check”)
// logInfo (“CO”, “TempMinCO:” + TempMinCO.state)
// logInfo (“CO”, “TempMinWieca:” + tempMinPieca.state)
// logInfo (“CO”, “Outdoor Temp:” + TempZew.state)
if (Temperature.state <TempTrend.state && furnace.state> = tempMinPieca.state && TempZew.state <= TempMinCO.state) {
pompaCO.sendCommand (ON)
logInfo (“Pump CO”, “Pump CO ON”)
}
else {
pompaCO.sendCommand (OFF)
logInfo (“Pump CO”, “Pump CO OFF”)
}
end
and here the rule that does not work
rule “Switching off the central heating pump at low furnace temperature”
when
Item piec changed
then
logInfo (“PumpCO”, “Furnace temperature:” + furnace)
if (piec.state <TempMinCO.state) {
pompaCO.sendCommand (OFF)
logInfo (“Pump CO”, “Pump CO OFF”)
}
end
First, when you post rules, code fences are really helpful for readability.
rule “Switching off the central heating pump at low furnace temperature”
when
Item piec changed
then
logInfo (“PumpCO”, “Furnace temperature:” + furnace)
if (piec.state <TempMinCO.state) {
pompaCO.sendCommand (OFF)
logInfo (“Pump CO”, “Pump CO OFF”)
}
end
How exactly is the rule “not working”? Are you seeing any errors in the log? If so, can you post them?
Is furnace an item or a variable? If an item, it should be furnace.state
> Number piec "Piec [%.2f °C]" <fire> (garaz) {mqtt="<[openhabian:/Kotlownia/Piec/T:state:default]"}//{mqtt="<[openhabian:dom/PiecT:state:default]"}
I know that the rule is run, but it never enters the “if” condition, the OFF command is not issued, and logInfo is not published
The variables I have displayed and are valid
Confirm you get the first logInfo (“Furnace temperature”)?
In this case the second logInfo will not show if/because piec.state is never lower then TempminCO.state
I’m sorry, I did not have time to insert the code`
rule "Wylaczenie pompy CO przy niskiej temp. pieca"
when
Item piec changed
then
logInfo("PompaCO", "Temperatura pieca: " + piec.state)
logInfo("PompaCO", "Temperatura min CO: " + tempMinPieca.state)
if (piec.state < tempMinPieca.state) {
pompaCO.sendCommand(OFF)
logInfo("PompaCO", "Pompa CO OFF od pieca")
}
end