[SOLVED] OpenHab too slow?

  • Platform information:
    • Hardware: Intel Atom N2800 1,9GHz 4Core / 4GB RAM
    • OS: Windows 7 Pro 64 Bit
    • Java Runtime Environment: jvm 1.8.0_191-b12
    • openHAB version: 2.4.0

The situation now: I have a KNX-Bus-System with Windows PC. The PC controll the Units.
Befor I had the Software “EisBär 1.8.0”, but since several years no updates launched and a lot of features are missing. Now my wife is not at home, so I used the time to install openHab and programm all my used features.
In openHab I installed the KNX and the Astro Binding only.

In openHab I installed the KNX and the Astro Binding only. Not changed something else.

The Things-File have 200 KNX-Things.
The Item-File have about 450 Items.
I have 81 Rules with 1500 code lines in 4 Files.

Is openHab running, it uesd 500MB RAM and the CPU-Usage is lower than 10%.

Now the problem:
If I change a Value of an Item, the Item state changed to late.

  • The Value changed from ON to OFF
  • The rule startet (with “Item Test received command”)
  • I make a Log Entry (with "logInfo(“Test”,“Test: " + Test.state)”)
  • In the Log is written “Test: ON”
09:36:27.499 [INFO ] [pse.smarthome.model.script.Test] - Test: ON
09:36:27.551 [INFO ] [pse.smarthome.model.script.Test] - Test 1: OFF
09:36:27.531 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'Test' received command OFF

The Code is:

rule "Test"
	Item Test received command
	logInfo("Test","Test: " + Test.state)
	if (Test.state == ON) {
		logInfo("Test","Test 1 " + Test.state)
	else {
		logInfo("Test","Test 0 " + Test.state)

3 interessting Details:

  1. During the IF-query, the status is ON. So in the rule openHab select the first branch. But during execute the Log-command, the state has now the right Value OFF.
  2. The timestamp show, that the rule is start before the value of Test.state is changed.
  3. In the Log, the timestamp “xxx.531” ist behind “xxx.551”.

This not not so every time. In 20% of execudes, the Value changed to late. Than the rules starts before the right value is available on item.state.

Now the question: why? If the PC to slow? Is that to much items? (I hae only 2 rooms finished!). What can I do?
Who can help me? in 5 days my wife come back and she would like that the lights go on if she push the switch,

I have read in an other forum that it can help to deactivate the LSP. I tried it but no help. Same before.

Bin mir nicht ganz sicher, aber ich glaube du brauchst ein “received update” statt “received command”. Wenn ich mich nicht täusche wird “received update” getriggered wenn der state aktualisiert wurde.


das ist nicht ganz richtig. “received command” reagiert auf .sendCommand (welches ich verwende) und nicht auf “.postUpdate”. “received update” reagiert auf beides. Das Problem ist ja auch nicht, dass es nicht aufgerufen wird, sondern dass der geänderte Wert zu spät zur Verfügung steht.

Guys, please, this is an international forum, please carry on en English or move to:


Das ist ein und das selbe Problem, da hat Markus schon recht. openHAB informiert dich bei “received command” schon bevor intern der Wert richtig verarbeitet worden ist, also bevor das Item Test den State korrekt gesetzt bekommen hat. Und das kann dann zu jeder Zeit innerhalb der Rule passieren.

Original Post now in english.

The default behaviour of openHAB is to autoupdate an item after it has received a command.
The sequence goes like this:

  1. Item receives command
  2. OH posts item update on the event bus
  3. Item is updated

So the item’s state is update AFTER the command it received. Sometimes it can take a while (up to 20ms in my case).

So in your rule, when you check for the state of the item immediately after the command is received, the state of the item hasn’t updated yet.

You could add a little delay in the rule, Thread::sleep(30) OR you could change the rule trigger to received update or changed depending on what you want to do.

Why? How I can wait for the new value?
If I send a command, so i want to use THIS command (state) and not the command (state) before!?

rule "Test"
	Item Test received command
    logInfo("Test","Test 1: " + Test.state)
    logInfo("Test","Test 2: " + Test.state)
    if (Test.state == ON) {
        logInfo("Test","Test 1 " + Test.state)
    } else {
        logInfo("Test","Test 0 " + Test.state)

You can use the implicit receivedCommand variable for that, see:

Choose your rule trigger carefully. If you are interested in a device changing state, trigger from that.
when Item xxxx changed

You can have rules that listen for commands separately from rules listening for updates, or changes.

1 Like

Thank you. I try this later

I know. This is the reason why I used receivedCommand.

That’s not what the OP wants to do, he wants to check the state of the item before doing something.
BUT, if the receivedCommand implicit variable is good enough and the OP assumes that the the items state WILL change then by all mean, use it.