I mean 3-5 minututes is the time after which I need to wait another 8 seconds between trigger and first reaction of rule.
I have full awareness of this and always let the rule load for the first time after edit or restart and my observations starting later.
I removed all my rules file from rules directory, created new file and put inside it part with corridor rule as below. Now the lag after 3-5 min is about 1.2-1.5 second. It’s weird…
rule Pir_Corridor_On
when
Item Corridor_MotionSensor changed to ON
then
logInfo("Pir", "Corridor: Korytarz - ruch, jasnosc: " + Corridor_MotionSensor_Luminance.state)
logInfo("Pir", "Corridor: Aktywacja swiatla w trybie dzien")
sendCommand(Corridor_Ambiance_4, 100)
Thread::sleep(300)
sendCommand(Corridor_Ambiance_3, 100)
Thread::sleep(300)
sendCommand(Corridor_Ambiance_2, 100)
Thread::sleep(300)
sendCommand(Corridor_Ambiance_1, 100)
end
rule Pir_Corridor_Off
when
Item Corridor_MotionSensor changed to OFF
then
logInfo("Pir", "Corridor: Korytarz - koniec ruchu, jasnosc: " + Corridor_MotionSensor_Luminance.state)
Thread::sleep(300)
sendCommand(Corridor_Ambiance_1, 0)
Thread::sleep(300)
sendCommand(Corridor_Ambiance_2, 0)
Thread::sleep(300)
sendCommand(Corridor_Ambiance_3, 0)
Thread::sleep(300)
sendCommand(Corridor_Ambiance_4, 0)
end
And next observation, now I put into my only one rules file two simpler rules as below. In that case there is very small lag, about 250ms. If I fast turn on and off the source item there is no lag at all so the problem still exists.
var String ir_path = "/etc/openhab2/ir_sequences/ir_sequences.sh "
rule "Ir_Music_On"
when
Item IR_Music received command ON
then
logInfo("Pir", "Start of Ir music on rule")
executeCommandLine(ir_path + "JVC-Aux", 5000)
end
rule "Ir_Music_Off"
when
Item IR_Music received command OFF
then
logInfo("Pir", "Start of Ir music off rule")
executeCommandLine(ir_path + "JVC-Power", 5000)
end