I just tried to get persistance working, but I’m not sure, what goes wrong.
ok here’s my steps:
(1) addons.cfg
# A comma-separated list of persistence services to install (e.g. "rrd4j,jpa")
persistence = mysql
(2) mysql.cfg
############################ mySQL Persistence Service ##################################
# the database url like 'jdbc:mysql://<host>:<port>/<database>'
mysql:url=jdbc:mysql://192.168.xx.xx/openHAB
# the database user
mysql:user=xxx
# the database password
mysql:password=xxx
# the reconnection counter
#mysql:reconnectCnt=
# the connection timeout (in seconds)
#mysql:waitTimeout=
# optional tweaking of mysql datatypes
# example as described in https://github.com/openhab/openhab/issues/710
# mysql:sqltype.string=VARCHAR(20000)
# Use MySQL Server time to store item values (=false) or use openHAB Server time (=true).
# For new installations, its recommend to set "mysql:localtime=true".
# (available since 1.9, optional, defaults to false)
#mysql:localtime=true
(3) sensoren.persist
Strategies {
everyMinute : "0 * * * * ?"
every5Minutes : "0 */5 * * * ?"
everyHour : "0 0 * * * ?"
everyDay : "0 0 0 * * ?"
everyWeek : "0 0 0 0 * ?"
everyMonth : "0 0 0 0 0 ?"
default = everyChange
}
Items {
* : strategy = everyMinute, everyHour, everyDay, restoreOnStartup
}
After saving, I’ve got a new table in MySQL “Items” like this
CREATE TABLE `Items` (
`ItemId` int(11) NOT NULL AUTO_INCREMENT,
`ItemName` varchar(200) NOT NULL,
PRIMARY KEY (`ItemId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf16;
But this table stays empty, and there’s no other tables being created despite time strategies everyMinute
and default strategy everyChange
The mySQL Persistance bündle is live (obviously):
208 | Active | 80 | 1.9.0.201611210210 | openHAB mySQL Persistence bundle
I don’t get something out of the logs (even after log:set trace org.openhab.binding.mysql
).
only thing I get:
2016-11-30 22:36:22.848 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'sensoren.persist'
2016-11-30 22:36:22.947 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'sensoren.persist'
the odd thing is the double entry of refreshing - but I get those on every occasion, should be another issue…?