'state' not getting resolved on an item in openHAB2 rules

Hi,

I’m using Eclipse Smart Home Designer for editing rules as openHAB Designer doesn’t work for openHAB2.
In this IDE, using .state in ‘if’ condition under ‘then’ section of the rule is showing error. Is it some openHAB2 change? The sample rules which I saw on GitHub shows the stuff which I mentioned.

Regards,
Abin

Your post is very vague. Which error are you receiving? Can you post your rule and/item definition here so we might see what is the possible cause?

rule "sample rule"
when
Item item1 changed from OFF to ON or
Item item1 changed from NULL to ON
then
if(item2.state == 0){

}

end

The above script is my sample rule. I can’t resolve state of item2 (auto code complete not working). It is being shown as an error in eclipse smart home designer. The items are dynamically created items.

Can you also post your .items file please?

Also try to log out the state of item2

logInfo(“Test”,item2.state)

If you downloaded ESH Designer in the past 30 days or so it currently has a bug where Designer no longer recognizes Items. There is an issue opened for this but until this time it is going to act like it doesn’t recognize your Items. I find that Actions and Joda classes are also not recognized.

Thanks Rich and Jean.