How Do I know if Persistance is working?

I think I have persistence working but when trying to use persistence in a script it seems to fail.

Is there a way to check if it is working?

Go to habmin and check on the persistence tab if any data is present.

This is something I just struggled with, too. Looking at habmin didn’t help, because at least for me, it isn’t showing the latest data. @chris: I was just about to ask you on that. My habmin downloaded from GitHub (v0.1.4-snapshot or so, I believe that’s still the latest one ?) is 12-24 hours behind time on most values. Some values are current, others are not. So far, I have been unable to decipher what makes the difference here. Any rough idea what to check for ? The values WERE put into the database, as I’ve checked with the method below

@Andrew_Pawelski:
Try adding this to logback.xml (I think you’ll spot the line where to insert it):

<logger name="org.openhab.persistence.db4o" level="DEBUG" />
<logger name="org.openhab.persistence.rrd4j" level="DEBUG" />

This will get you debug output whenever the persistence binding stores values, so you know if they’re in.
You probably know you can also add

<logger name="org.openhab.model.script.rules" level="TRACE" />

to debug rule execution.
Now what to do if the values ARE in and it still doesn’t work, I don’t know. I, too, thought that was a problem of my persistence, but it the end, that just turned out to be an ordinary syntax error in my rule.

Note also the hint in persistence Wiki pages about restoreOnStartup and that it can take some time for item states to restore after startup.

OK well based on Habmin there is nothing in persistence - no items.

It does show the org.openhab.persistance.logging binding as 1.7.0

I have a db4o.persist in configurations/persistence
and it has the stock sample from the wiki

Is there anything else I need to do?

You need to install the binding jar, of course, i.e. put org.openhab.persistence.db4o-<some version>.jar into the addons directory.
Note that IIRC the default is rrd4j (define in openhab.cfg), so eventually change that && restart openHAB.

OK I guess I should have worked that out - wasnt in the wiki under install. OK I have installed the rrd4j binding and created a rrd4j.persist
I have checked the openhab.cfg and is using as you said the default.

I still see nothing in habmin?

Ensure you use habmin display for rrd4j values (it might default to some other mechanism - it’s the icon at the bottom right).
Do you see the items under ‘configuration’ ? If not, your problem might be unrelated to persistence (e.g. file access rights)
If that ain’t it, I’m not sure. Could be anything, then. Means you need to go all the way, step by step, then, to find out what’s missing. Enable debug logs … does the binding start, do you see log lines showing startup and/or errors ? Do you see lines claiming values get stored ? (see my previous post w.r.t logging)

[quote=“Andrew_Pawelski, post:6, topic:2942, full:true”]
I still see nothing in habmin?[/quote]

Habmin is a bit tricky at this point: supposed your setup is correct and data are stored, you need to go to the persistence tab, under “Label” you should see your persisted switches, contacts or whatever, highlight one with your mouse, click on update, go to the right hand side of the screen, click on chart (at the bottom), then click on table … at least NOW you should see your data.
If you can’t see anything under “Labels” your setup is wrong.

Good luck.

OK thanks for clarifying - I am in the right spot in habmin but nothing which means I must have something wrong set up wise. I hope you still have the patience to help? I’m sure its something I have overlooked.

I have the rrd4j binding appearing at the bottom right of habmin and here are my bindings - I’m sure I have more than I need in there but that isn’t the problem is it?

my openhab.cfg file has this line:
persistence:default=rrd4j

my rrd4j.persist file is this:
// persistence strategies have a name and a definition and are referred to in the “Items” section
Strategies {
everyHour : “0 0 * * * ?”
everyDay : “0 0 0 * * ?”

// if no strategy is specified for an item entry below, the default list will be used
default = everyChange

}

/*

  • Each line in this section defines for which item(s) which strategy(ies) should be applied.

  • You can list single items, use “" for all items or "groupitem” for all members of a group

  • item (excl. the group item itself).
    */
    Items {
    // persist all items once a day and on every change and restore them from the db at startup
    // careful, this might result in huge databases - that’s why it is in comment here :wink:

    • : strategy = everyChange, everyDay, restoreOnStartup

    // persist all temperature and weather values at every change and every hour
    //Temperature*, Weather* : strategy = everyChange, everyHour
    }

and in ${openhab_home}/etc/rrd4j it seems to be listing all my items with .rrd extensions

Have I missed anything?

Thanks in advance

For rr4jd to work you need to persist every minute.

(That isn’t the same with other persistence just a quirk of rr4jd)

Does that help?

OK i changed the openhab.cfg file to use db4o, created a db4o.persist file, and actually removed the rr4j persistance file and binding but still no good. based on the bindings above there is an exec and a logging binding is there any others needed?
in etc there is a db4o folder and inside that store.db4o with a recent date stamp and I have a sensor that is updating and the date stamp is changing but nothing in habmin?

as I had already asked once: do you see any items under ‘configuration’ ?
If no, your habmin setup is bad (maybe in addition to a bad persistence setup, but then, either way, you need to debug habmin first).
If so, check jetty server logs, and if the openHAB config files can be accessed by the UNIX user that your webserver/habmin runs as.

Yes all my items are in configuration - everything else seems to work in habman I can see my zwave devices and configure their parameters

I will see if I can locate those logs (I put this in beginner because I am)

Thanks for your patience

I would like to hijack this thread if i may.

My situation is similar to OP. I am running Openhab on RPi2 and my persistence is setup with mysql. I am able to draw graphs via “Chart item=” in the classic UI. I even see the data in mysql.
In Habmin i can see the items in configuration but in the persistence tab there are no items. I have the mysql selected in bottom right.
I have selected default persistence service to mysq in openhab.conf.

Maybe im missing something in the addons folder ? :
-rw-r–r-- 1 root root 19558 Sep 22 14:58 org.openhab.binding.http-1.7.1.jar
-rw-r–r-- 1 root root 325425 Oct 10 10:45 org.openhab.binding.weather-1.7.1.jar
-rw-r–r-- 1 root root 8271 Sep 26 16:11 org.openhab.binding.wol-1.7.1.jar
-rw-r–r-- 1 root root 1618966 Sep 9 14:12 org.openhab.binding.xbmc-1.7.1.jar
-rw-r–r-- 1 root root 1077404 Sep 8 14:16 org.openhab.binding.zwave-1.7.1.jar
-rw-r–r-- 1 root root 1123714 Jun 20 2014 org.openhab.io.habmin-1.5.0-SNAPSHOT.jar
-rw-r–r-- 1 root root 322391 Oct 9 23:57 org.openhab.io.myopenhab-1.7.1.jar
-rw-r–r-- 1 root root 833229 Oct 9 18:10 org.openhab.persistence.mysql-1.7.1.jar

I have tried to add more persistence jars (exec and logging) but they only added more options in bottom right in habmin.

Thanks for any input.

Typically, this would indicate that while you have items configured, the mysql.persist file is not configured? Have you enabled the items persistence in this file (or in HABmin, which will result in the file being updated).

Hey Chris, thanks for the quick reply.
I have the items configured in mysql.persist :

Strategies {
default = everyChange
}

Items {
// * : strategy = default, restoreOnStartup
QubinoPlug_1_Energy : strategy = default, restoreOnStartup
QubinoPlug_2_Energy : strategy = default, restoreOnStartup
Temp : strategy = default, restoreOnStartup
Lux : strategy = default, restoreOnStartup
Movement : strategy = default, restoreOnStartup
Scene_LivingRoom : strategy = default, restoreOnStartup
Total_energy : strategy = default, restoreOnStartup
Weather_Temperature : strategy = default, restoreOnStartup
//Weather_LastUpdate : strategy = default, restoreOnStartup
}

this is my default.items file :
Number QubinoPlug_1_Energy “Switch #1 consumption [%.1f W]” (Energy_Chart) { zwave=“3:command=meter” }
Number QubinoPlug_2_Energy “Switch #2 consumption [%.1f W]” (Energy_Chart) { zwave=“5:command=meter” }
Number Temp “Inside Temperature [%.1f °C]” (Weather_Chart) {zwave=“4:command=Sensor_multilevel,sensor_type=1”}
Number Lux “Lux: [%.2f Lux]” {zwave=“4:command=Sensor_multilevel,sensor_type=3”}
Number Movement “Movement: [%s]” {zwave=“4:command=sensor_binary”}

Data get populated in the mysql database and i am even able to draw graphs from them in classicUI via Item graph.
Is there some other config i should set them up for Habmin to see them ?
Thanks

Maybe this JAR is too old? I would make sure you’re using the latest version just to be sure since I don’t remember when the persistence features to read items was added.

The latest JAR is from 1.7 so I would definitely change to this version.

Cheers
Chris

thanks will try the jar
I am also getting this in the output not sure if its related or something different but problematic

[o.o.c.s.ScriptExecutionThread ] - Error during the execution of rule ‘Lights off when Play Starts’: The name ‘.historic_state()’ cannot be resolved to an item or type.

This almost certainly won’t be related, but you probably want to change historic_state to historicState.

Ok that might explain the rule not firing!

I was also running 1.5.0 have grabbed 1.7.0 noticed it is only 35kb?

the web interface runs but never goes to online status- I just dropped the jar into addons was there anything else I needed to do (also rebooted) to get that running?