Comparing states in rules DSL in OH3

Hi.
I’ve found another strange thing that works if written in a .rules file but that doesn’t seem to work when using the rules DSL in the GUI, and that is comparing states of Items. I have two Items that both are Number:Temperature. I’m trying to compare them like this:

if(item1.state < item2.state)

This works fine if it’s in a .rules file (read by OH3). However when I put the exact same line of code into the GUI editor I get the following in the log:

cannot convert from State to Number

I fixed it using this instead:

(item1.state as QuantityType<Number>).doubleValue < (item2.state as QuantityType<Number>).doubleValue

…but it feels like something that shouldn’t be needed for just comparing two states of the same type, or am I wrong?

I’m running RC1.

1 Like

You could try RC2 and if there is still an issue. open an Issue on GitHub.
I think things are pretty frozen now for the 3.0 release.

I got the same problem in RC2.

1 Like

I might have a similar problem here. but i trie to compare two dimmer states. i dont get an error in the logs and i dont think its a conversion problem.

if (item1.getState() == item2.getState()