Hi guys,
I’m facing some lags on my rules. The rule is very simple and the lag happens only on the first time the rule is used.
The rule is very simple:
rule "Incrementa Cena: Staff"
when
Item scLight_Staff received command
then
if (nuLight_StaffPos.state == 1)
{
sendCommand(nuLight_StaffPos, 2)
sendCommand(swLight_Staff1, ON)
sendCommand(swLight_Staff2, ON)
sendCommand(swLight_Staff3, OFF)
}
else if (nuLight_StaffPos.state == 2)
{
sendCommand(nuLight_StaffPos, 3)
sendCommand(swLight_Staff1, ON)
sendCommand(swLight_Staff2, OFF)
sendCommand(swLight_Staff3, OFF)
}
else if (nuLight_StaffPos.state == 3)
{
sendCommand(nuLight_StaffPos, 0)
sendCommand(swLight_Staff1, OFF)
sendCommand(swLight_Staff2, OFF)
sendCommand(swLight_Staff3, OFF)
}
else
{
sendCommand(nuLight_StaffPos, 1)
sendCommand(swLight_Staff1, ON)
sendCommand(swLight_Staff2, ON)
sendCommand(swLight_Staff3, ON)
}
end
Basically I have an item named scLight_Staff that every time a push button is pressed, it’s value is updated (using MQTT). I use this rule to change the configuration of the lights on every press. Every day on the morning, the first time I press the push button, OH takes 2 seconds to process this rule. Here is the events log:
2017-01-12 07:26:04 - scLight_Staff received command 1
2017-01-12 07:26:06 - nuLight_StaffPos received command 1
2017-01-12 07:26:07 - swLight_Staff1 received command ON
2017-01-12 07:26:07 - swLight_Staff1 state updated to ON
2017-01-12 07:26:07 - swLight_Staff2 received command ON
2017-01-12 07:26:08 - swLight_Staff2 state updated to ON
2017-01-12 07:26:08 - swLight_Staff3 received command ON
2017-01-12 07:26:08 - swLight_Staff3 state updated to ON
Note that it took 3 seconds to turn the lights on. After the first time, if I press the pushbutton again it does process the rule on the same second and even if I wait one or two hours the rule is processed on the same second. The lag only happens after a long period without doing anything.
About my system:
I’m using OH 1.8.3 with jdk1.8.0_101 on a BeagleBone Black with Ubuntu 13.10. OH and mosquitto are the only services running on the board and the CPU usage is around 2% and memory at 21% (looking at java process on top).
Any ideias?
Thanks