[SOLVED] Unknown variable or command '>' in rules

I’ve got that error running the rule: "Unknown variable or command ‘>’ "
There is an wallPlug wich sent watt number (decimals) to OH2.

My steps:

  1. I have installed the Persistance MySql (on RaspbberyPi 2),
  2. I made MySql the default persistance (follow the instruction from here: https://www.openhab.org/docs/configuration/persistence.html#persistence-configuration), then mysql.persist file looks like that:
Strategies {
        everyHour : "0 0 * * * ?"
        everyDay  : "0 0 0 * * ?"

       default = everyChange
}


Items {
        bathroom_power: strategy = everyChange

}
  1. I run this rule:

rule "FULL"
when Item bathroom_power received update
then
    logInfo("Alert: ", "START RUNNING")
    if
    ((bathroom_power.previousState() > 10) && (bathroom_power.previousState() < 50))
    {
    logInfo("Alert: ", "Condition = OK")
    }
    else logInfo("Alert: ", "Condition = NOT"    )
end

The error:

2018-07-08 20:42:52.605 [INFO ] [lipse.smarthome.model.script.Alert: ] - START RUNNING

2018-07-08 20:42:52.621 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'FULL': Unknown variable or command '>'; line 7, column 7, length 35

Any ideas how to fix that code, pls?

Solved:
just exchanged .previousState() with .state()
and it works well.

I had the same error message with this with OpenHAB 2.4 snapshot. I used .maximumSince(), which returns a HistoricItem, on which I had to call .getState() for getting to something that was comparable to an integer.