Problems with operators < / > no viable alternative at input '>'

Hiho,

after updating to 2.1 I have a problem with the following rule:

rule "Temperature to high"
when
Item TEMP_CORRIDOR changed to > 25
then
sendTelegram(“bot1”, “Temperature in corridor higher then 25”)
end

Here is the error:
2017-07-09 17:37:02.461 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model ‘corridor.rules’ has errors, therefore ignoring it: [16,35]: no viable alternative at input ‘>’

Do you have an idea what is wrong with the rule?

Thanks!
/chris

Pretty clear that it doesn’t like the “>”. Have you tried removing it?

Why that might have changed from 2.0 to 2.1, I have no idea…

Hi, yeah I removed it and the error was gone.

But my rule is no longer working. Do you have an idea how I can use operators like greather than etc. ?

You cannot do this as a trigger condition in a rule. You will have to simply trigger on “changed”, and then write an if-statement testing for the condition that you want.

Something like this should do the trick:

rule "Temperature to high"
when
  Item TEMP_CORRIDOR changed
then
  if TEMP_CORRIDOR.state > 25 {
    sendTelegram("bot1", "Temperature in corridor higher then 25")
  }
end
1 Like

Hi, thank you! Thats it!

rule "Temperature to high"
when
  Item TEMP_CORRIDOR changed
then
  if (TEMP_CORRIDOR.state > 25) {
    sendTelegram("bot1", "Temperature in corridor higher then 25")
  }
end

There was just a missing ( ) in the if statement.

//chris

1 Like