Hi,
Have been trying to get the persistence service working. In short I do get openHAB to connect to the mySQL db, creating the items table, but that is it.
I have tried a number of verions of mysql.persist (originslly openhab.perist, but I read in one of the posts rename it to mysql. On mySQL server the schema name I used is openhab.
Currently my mysql.persist file looks like this.
#Strategies {
# default = everyChange
#}
#
#Items {
# * : strategy = default, restoreOnStartup
#}
Strategies {
_ everyMinute : “0 * * * * ?”_
_ default = everyChange_
_ }_
Items {
_ Multisensor_Temperature : strategy = everyChange, everyMinute_
_ Multisensor_Motion : strategy = everyChange, everyMinute_
_ Door_Brown_Contact : strategy = everyChange, everyMinute_
_ * : strategy = default, everyMinute, restoreOnStartup_
}
and my items file looks like this:
Group All
Group Battery (All)
Number Multisensor_Temperature “Temperature [%.1f C]” { zwave=“6:command=SENSOR_MULTILEVEL,sensor_type=1” }
Number Multisensor_Illuminance “Illuminance [%.0f Lux]” (Door) { zwave=“6:command=SENSOR_MULTILEVEL,sensor_type=3” }
Contact Multisensor_Motion “Motion [MAP(motion.map):%s]” <wifi_logo> (Door) { zwave=“6:command=SENSOR_BINARY,sensor_type=12,respond_to_basic=true” }
Contact Multisensor_Contact “Contact [MAP(en.map):%s]” (Door) { zwave=“6:command=SENSOR_BINARY,sensor_type=10,respond_to_basic=true” }
Number Multisensor_Battery “Bateria Multisensor Taras [%s %%]” (Door, Battery) { zwave=“6:command=BATTERY” }
Contact Multisensor_Tamper “Multisensor Tamper [%s]” (Door) { zwave=“6:command=SENSOR_BINARY,sensor_type=12,respond_to_basic=true” }
Switch Arming_Switch “Armed [%s]”
Contact Door_Brown_Contact “Contact [MAP(en.map):%s]” (Door) { zwave=“3:command=SENSOR_BINARY,sensor_type=10,respond_to_basic=true” }
Number Door_Brown_Battery “Bateria Drzwi Wejsciowe [%s %%]” (Door, Battery) { zwave=“3:command=BATTERY” }
Contact Door_Brown_Sensor_Tamper “Front Door Sensor Tamper [%s]” (Door) { zwave=“3:command=SENSOR_BINARY,sensor_type=12,respond_to_basic=true” }
Contact Drzwi_Taras_Contact “Contact [MAP(pl2.map):%s]” (Door) { zwave=“7:command=SENSOR_BINARY,sensor_type=10,respond_to_basic=true” }
Number Drzwi_Taras_Battery “Bateria Taras [%s %%]” (Door, Battery) { zwave=“7:command=BATTERY” }
Contact Drzwi_Taras_Tamper “Multisensor Tamper [%s]” (Door) { zwave=“7:command=SENSOR_BINARY,sensor_type=12,respond_to_basic=true” }
My config file:
persistence:default=mysql
############################ SQL Persistence Service ##################################
# the database url like ‘jdbc:mysql://:/’ (without quotes)
mysql:url=jdbc:mysql://localhost:3306/openhab
mysql:user=root
mysql:password=veryimportant password.
#mysql:reconnectCnt=1
#mysql:waitTimeout=10
#mysql:url=
# the database user
#mysql:user=
# the database password
#mysql:password=
# the reconnection counter
#mysql:reconnectCnt=
# the connection timeout (in seconds)
#mysql:waitTimeout=
mysql:sqltype.string=VARCHAR(20000)
#tried without the line above, too
The bindings I used are org.openhab.persistence.mysql-1.8.0-SNAPSHOT, as well as the 1.7 one.
I cannot find anything obvious in the logs, except for the “Note] Aborted connection 6 to db: ‘openhab’ user: ‘root’ host: ‘localhost’ (Got an error reading communication packets)” entry sometimes in the mysql error log.
Sometimes I also ger the “Unable to find table for query” message, but as I mentioned I do get the Items table created by openHAB. Running out of clues. Any ideas are welcome.
I run both the openHab and MySQL server on one PC running Windows 7.