Problems with OH2 and mqtt-persistence

Hi all,

I’m facing some problems trying to get mqtt persistence running with OH2 (online snapshot a day old). Here is my config:

mqtt.cfg
broker.url=tcp://medienkiste:1883
broker.clientId=openhab

mqtt-persistence.cfg
topic=openhab/
message=%1$s, %3$s

I have mosquitto running on a Synology Diskstation (medienkiste). Using e.g. MQTT.fx, I can subscribe to the topic “openhab/” and see state changes of all items being reported. So far so good…

But in habmin, when trying to have a look at persisted data, all i get is an error msg: “error getting list of items supported by the persistence service”. And indeed, looking up persisted items in REST API, i get “Persistence service not queryable: null”. MQTT is set as default persistence service in habmin.

Any helpful thought is highly appreciated!

Cheers,
wickedP

I assume that you installed MQTT persistence. Have you created a persistence file? I use MQTT, but log data to standard rrd4j and also to mysql. your mqtt.persist should contain something like:

// persistence strategies have a name and a definition and are referred to in the “Items” section
Strategies {

everyMinute : "0 * * * * ?"

}

Items {

*: strategy = everyMinute, restoreOnStartup

}

Yep, my mqtt.persist looks like this:

Strategies {
        everyMinute : "0 * * * * ?"
        default = everyChange
}

Items {
        // persist all items every minute and on every change
        * : strategy = everyChange, everyMinute
}

For testing I set it to everyMinute and this seems to work, since I can subscribe to an mqtt topic and see updates every minute. Only problem is getting access to the mosquitto-db to plot some persistence data. I chose to persist using mqtt becausse it seemed like an easy way to store data externally (my pi got entirely frozen once because the rrd4j-db became too big and i wasn’t able to restrict its size).

From the source code of the MQTT persistence service:

It can be used to persist item states through MQTT messages. The service only supports sending of data, not receiving.

So openHAB cannot query MQTT-persisted states, only publish them.

oops, could have found that myself. thanks for your help! will switch to rrd4j instead.

No worries! For future reference, the wiki page “Persistence” should be kept up to date on which persistence services are queryable.