The rule fires as soon as it’s after 22 o’clock even though Abus_Motion changed 2 minutes ago (the string contains the time stamp of the jpg generated by an IP cam).
I store all items in mapdb and additionally strings and switches in jcdb-h2.
I might still have problems with JCDB, because it seems that my db (/var/lib/openhab2/persistence/jdbc-h2.trace.db) is not updated very often.
Beside that I find a file named jdbc-h2.mv.db, which was modified the last time several weeks ago).
JDBC errors:
2016-12-02 11:30:11.022 [DEBUG] [ence.jdbc.internal.JdbcConfiguration] - No jdbc:user parameter defined in openhab.cfg
2016-12-02 11:30:11.024 [DEBUG] [ence.jdbc.internal.JdbcConfiguration] - No jdbc:password parameter defined in openhab.cfg.
and
Failed to initialize pool: Wrong user name or password [28000-191]
But for JDBC h2 there is no user name required but optional, right?
This user / pwd is for a (real) SQL DB only I guess!?
EDIT:
I used the default user / pwd (sa / “”) and I am a step further.
But I still get: Failed creating the component instance; see log for reason
With Switches I get:
rule "previousState monitoring"
when
Item Z_WoZiLicht changed
then
logInfo(“lights.rules: >”, "Z_WoZiLicht state / previousState = " + Z_WoZiLicht.state + " / " + G_Lights.previousState)
end
As a result in the log: Z_WoZiLicht state / previousState = OFF / org.openhab.core.persistence.internal.QueryablePersistenceServiceDelegate$1@149457f
However: Z_WoZiLicht.previousState.state.toString did the job:
But:
state is always = previousState ??? Z_WoZiLicht state / previousState = ON / ON
I know it’s confusing how I jump from changedSince to previousState, but both are persistence related.
And I hope it helps someone stuggling with this topic a little
I found that this doesn’t work:
if (WoZiLicht.previousState == OFF)
But this one does:
if (WoZiLicht.previousState(true,“jdbc”).state == OFF)
(jdbc is not my default persistence, just used for everything but numbers)
Analog to previousState the following works for changedSince now:
if (Abus_Motion.changedSince(now.minusMinutes(30),“jdbc”)) {
I tried all persistences (JDBC, mapdb, …etc.) it was working sometimes and sometimes not.
The one with more probability to work correctly was the influxDB persistence, but still was not reliable.
I ended up doing different workarounds like creating other items to store changed datetime, variables within the rules, hashmap variables to store the name of the item and the last change datetime, …etc.
Either i’m so stupid with persistence or there is something really not working and i can’t find it.
Anyway i spent several days on it to decide that is enough, and my workarounds works more reliably now