I have a some strange behavior in an ECMAScript. Can anyone tell me why this is happening?
The rule is triggered by: TestItem
received a command. TestItem
is a switch.
The rule looks simplified as follows:
this.logger = (this.logger === undefined) ? Java.type('org.slf4j.LoggerFactory').getLogger('org.openhab.core.model.script.' + ctx.ruleUID) : this.logger;
logger.info("GetState: " + ir.getItem("TestItem").getState());
logger.info("Command: " + command);
I would always expect the two statements to be either ON or OFF. So like this:
GetState: ON
Command: ON
or
GetState: OFF
Command: OFF
From time to time, however, it comes into the state that the two values differ.
GetState: OFF
Command: ON
How can this be? command
always shows the correct value, .getState()
is sometimes not updated.