Item state update delayed


(markus_pfleger) #1

Hi,

I have a Problem with one of my rules, I think it is since the update to 2.2, but I am not absolutely sure. I have an item where I send a command to turn it off. I can see from the event log that the item receives an OFF and also my light goes off. However, another rule (maybe running on a different thread) which is executed 700ms after the event log says that my item received OFF still shows the state to be on.

Has there anything changed? Is there some synchronization/visibility problem?

Here an example from my logs:

openhab.log
2018-01-27 16:40:25.863 [INFO ] [ipse.smarthome.model.script.Abwesend] - Resetting EG_Gang LED group to 2 and turning off light as we are away

Immediately before logging this line I send execute this code: LED_EG_Gang_Switch.sendCommand(OFF)

events.log shows me that the item received this OFF command:
2018-01-27 16:40:25.873 [ome.event.ItemCommandEvent] - Item ‘LED_EG_Gang_Switch’ received command OFF

This is around 10ms after I sent it, this seems appropriate. However, I get the following afterwards:

openhab.log:
2018-01-27 16:40:26.588 [INFO ] [e.smarthome.model.script.Color Scene] - <Scene 1> <Led_Group2> Switch LED_EG_Gang_Switch is ON. Fading with item: LED_EG_Gang_RGB_Fading to color: 328,37,25

In this log message I use LED_EG_Gang_Switch.state and it evalutes to ON.

So to summarize:

2018-01-27 16:40:25.863: LED_EG_Gang_Switch.sendCommand(OFF)
2018-01-27 16:40:25.873: Item ‘LED_EG_Gang_Switch’ received command OFF
2018-01-27 16:40:26.588: LED_EG_Gang_Switch.state returns ON

Of course I checked the event log, the Switch was not turned ON before the state delivered ON. To me this definitely sounds like a bug. Any ideas?

Best regards,
Markus


(Rich Koshak) #2

This posting isn’t too bad, but please How to use code fences for future posts.

Sending a command is independent from changing the state of an Item. When you issue the command it gets picked up by the binding where some work gets done and then when that work is done the Item’s state gets update.

If the command is changing the state of the Item you should also see an “EG_Gang_Switch changed from ON to OFF” in events.log. If you are not seeing this then your Item isn’t changing state as a result of the command.

Look at your Binding’s log and make sure you are not seeing any errors or warnings from it.


(markus_pfleger) #3

Thanks, thats interesting. As I am sending the command to a KNX device there might be something wrong with reading its state. I did not get any log that the state changed from ON to OFF.