How to correctly set up MongoDB Persistence?

I tried to configure MongoDB persistence to store temperatures in the following way.

  1. I defined MongoDB’s url, db and collection name

$ grep mongodb configurations/openhab.cfg

mongodb:url=mongodb://127.0.0.1:27017
mongodb:database=openhab
mongodb:collection=openhab

  1. I defined a persistence model (copied from rrd4j.persist present in the demo)

$ cat configurations/persistence/mongodb.persist

Strategies {
everyMinute : “0 * * * * ?”
}

Items {
DemoSwitch,NoOfLights,Window_GF_Toilet,Heating* : strategy = everyChange, everyMinute, restoreOnStartup

Temperature*,Weather_Chart* : strategy = everyMinute, restoreOnStartup

}

  1. the rule is defined by:

rule “Update max and min temperatures”
when
Item Weather_Temperature changed or
Time cron “0 0 0 * * ?” or
System started
then
postUpdate(Weather_Temp_Max, Weather_Temperature.maximumSince(now.toDateMidnight, “mongodb”).state)
postUpdate(Weather_Temp_Min, Weather_Temperature.minimumSince(now.toDateMidnight, “mongodb”).state)

logInfo("Weather", "Temperature evolved of " + Weather_Temperature.deltaSince(now.minusMinutes(2)) + " degrees in 2 minutes.")
logInfo("Weather", "Midnight: " + now.toDateMidnight.toString)

end

The item Weather_Temperature gets temperature via a MQTT topic, the UI is properly updated, but I don’t have any values in the MongoDB instance.

At startup I have:

2015-08-18 16:09:51.835 [WARN ] [.o.c.p.e.PersistenceExtensions] - There is no queryable persistence service registered with the name ‘mongodb’

and while running I get several:

2015-08-18 16:11:00.013 [WARN ] [.m.i.MongoDBPersistenceService] - MongoDB not initialized

I tested MongoDB with its client and it works properly, I also tried to insert some test data and everything is ok. Why am I not able to “convince” OpenHab to insert data in MongoDB?

Hi,

I just wanted to try mongodb and ran into exact the same issue only I have not the MongoDB not initialized message, but the There is no queryable persistence service registered with the name ‘mongodb’.
Did you get this going somehow?

Thanks

Nico

Have you verified that the binding .jar for it is in your addons folder?