Dual persistence problem/question

I have two persistence services running:

  • influxdb (for use with grafana) (default)

  • mysql

The default is set to influxdb (in paperui) but I also want to store some (string) data using the mysql persistence.
In the mysql.persist I’ve setup a strategy to store the data on everyUpdate, checking the sql database I see the correct data is stored, so no worries about that part.
However when executing a rule, it doesn’t find the item I try to use :

Error during the execution of rule test: cannot invoke method public java
.lang.String org.joda.time.base.AbstractInstant.toString() on null

It looks like the rule checks the (default) influxdb database rather then mysql database.
How can I let my rule know that it needs to ‘get’ the item from mysql ?

-ben

Could you post more of the Log?

I think I found the solution on http://tinyurl.com/k8t8kxa

These extensions use the default persistence service that is configured 
in openhab.cfg. If the default service should not be used, all 
extensions accept a String as a further parameter for the persistence 
service to use (e.g. "rrd4j" or "sense").

Where do I add which persistence service to use ?

-ben


Is this whats you`r looking for?

Thanks for you ‘support’ but this is not what I was looking for.
After carefully reading the lines again, this solved it :

if (Light1.updatedSince(now.minusSeconds(90),"mysql") == false ) {    // more then 90 seconds ago
        logInfo("Light", "offline")

Added the “mysql” line with comma.

Thanks everyone with suggestions!

-ben

2 Likes