First of all, replace your first rule with this:
rule "Heating_T"
when
Item GHeating_T received command ON
then
var int Heat_T = {Heating_Timer.state as Number}.intValue
createTimer(now.plusMinutes(Heat_T), [ |
GHeating_T.sendCommand(OFF)
Heating_Timer.postUpdate(Heat_T)
])
end
You are running a long, potentially very long while loop and during that time, the rule monopolises 1 thread and you only have 5 in total to run openHAB
This new rule is very simple, it converts Heating_Timer
to an int
That’s because .plusMinutes(x)
takes int
as arguments
Then we create a timer that will execute from now
plus Heating_Timer
minutes.
The body of the timer contains the instructions you want to happen at that time.
Please refer to:
Your second point:
else if(house_heat < (heat_setpoint - offset)) || GHeating_T.state == ON {
GPIO_Heating.sendCommand(ON)
But please use indents in your rules so that they can be read easily:
rule "Heating"
when
Item GF_Hallway_Heating changed or
Item GHeating_T changed
then
var Number house_heat = GF_Hallway_Heating.state as Number
var Number heat_setpoint = Heating_SP.state as Number
val Number offset = 0.5
if (house_heat >= (heat_setpoint + offset)) {
GPIO_Heating.sendCommand(OFF)
} else if (house_heat < (heat_setpoint - offset) || GHeating_T.state == ON) {
GPIO_Heating.sendCommand(ON)
}
end