Error Message when rule is triggered

Hy to everyone!

i createt my first rule

rule "Change all Dimmers"
    Item Master_Volume_Slider changed
    var previousValue = Master_Volume_Slider.previousState as Number
    var newValue = Master_Volume_Slider.state as Number
    var Difference = newValue - previousValue
    Master_Volume.forEach( i | i.sendCommand((i.state as Number) + Difference))

when the rule is triggered by sliding the Master Volume slider, i get this error in the Log.

2018-02-17 23:13:36.097 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule ‘Change all Dimmers’: Could not cast org.openhab.core.persistence.internal.QueryablePersistenceServiceDelegate$1@2abd16 to java.lang.Number; line 5, column 25, length 44

Could someone tell me, what this error is meaning?

Is there an error in my code or in my configuration of openhab?


Hi there,
I seem to recognise this rule!
Have you got persistence set up?
You need this to access the previousState property



I have istalled MySQL Persistence and RRD4j Persistence.

MySql i dont use until now.

Change it to Master_Volume_Slider.previousState().state and it should work

There you go…
Told you I wasn’t very good!!
Worst is, I used this before :slight_smile:

Good luck!

1 Like