Hi Erwin, hi Rich,
thanks for your efforts helping me. Your thoughts are very clever but unfortunately they didn't change the result. But first of all I have to let you know, that I'm no programmer. I'm just copying code snippets from everywhere to create my rules, therefore I fear I'm no adequate sparring partner in discussing such issues.
The result of Erwins suggestion resulted in error messages like
2015-06-18 16:10:05.336 [ERROR] [o.o.c.s.ScriptExecutionThread ] - Error during the execution of rule 'Testrule': Could not invoke method: org.openhab.core.persistence.extensions.PersistenceExtensions.historicState(org.openhab.core.items.Item,org.joda.time.base.AbstractInstant,java.lang.String) on instance: null
2015-06-18 16:10:05.342 [INFO ] [org.openhab.model.script.test ] - previousState:18.06.2015 16:10:05: webserver -> ON State: ON
I tried this procedure also on an influxdb persisted item, with the same result. I need to explain, that mapdb persisted items just store the very last items status. Normally it's used for restoreOnStartup method. Therefore I fear, that there is no historicState method available. What I wanted to have, is the very last status of an item. Not the current state, but the previous state. But it seems, that
webserver.previousState(false, "mapdb") and
webserver.state
have the same result, which makes me wonder for the sense of previousState.
It seems there is always the current state stored before the rules are called (as you already mentioned), so that never the previousState will result. Furthermore the state before the previousState should be the previousState, which would make sense for me.
Well, I will find a workaround in my rule, so that I appreciate your effort, but don't want to waste your time.
Maybe it's worth to update the wiki if someone finds the correct meaning and usage of previousState method.
Thanks a lot and greetings from Germany,
Michael