[RESOLVED] Openhab2 : Problem with persistence

Hi,

I have recently installed OpenHab2 on my Raspberry in following the openhab2 tutorial (http://docs.openhab.org/installation/linux.html).

I have installed the exec binding and the JDBC persitent via PaperUI.

I have configured 2 two things which use the exec binding (execution of Python Script) and 2 items which store the result of the execution of Python Script in a number.

I would like to store the values items in the mysql server.

I have configured the jdbc parameters :

url = jdbc:mysql://localhost:3306/openhab
user = openhab_rw
password = rasperry

and the persistence strategy :

pi@raspberrypi:/etc/openhab2/persistence $ cat jdbc.persist
Strategies {
everyHour : "0 0 * * * ?"
everyDay : "0 0 0 * * ?"
everyMinute : “0 * * * * ?”

    default = everyChange

}

Items {
DHT22Temperature_Output : strategy = everyMinute, restoreOnStartup
}

The logs indicates the value of DHT22Temperature_Output is not stored due of a undefined type :

2016-12-27 10:43:44.556 [INFO ] [ore.internal.i18n.LocaleProviderImpl] - Locale set to en_FR
2016-12-27 10:43:50.016 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘jdbc.persist’

==> /var/log/openhab2/events.log <==
2016-12-27 10:43:54.498 [ItemAddedEvent ] - Item ‘DHT22Humidity_Output’ has been added.
2016-12-27 10:43:54.505 [ItemAddedEvent ] - Item ‘DHT22Temperature_Output’ has been added.
2016-12-27 10:43:54.523 [ItemChannelLinkAddedEvent ] - Link ‘DHT22Humidity_Output-exec:command:50117513:output’ has been added.
2016-12-27 10:43:54.525 [ItemChannelLinkAddedEvent ] - Link ‘DHT22Temperature_Output-exec:command:c62f17bf:output’ has been added.
2016-12-27 10:43:54.656 [ThingAddedEvent ] - Thing ‘exec:command:50117513’ has been added.
2016-12-27 10:43:54.691 [hingStatusInfoChangedEvent] - ‘exec:command:50117513’ changed from UNINITIALIZED to INITIALIZING
2016-12-27 10:43:54.698 [ThingAddedEvent ] - Thing ‘exec:command:c62f17bf’ has been added.
2016-12-27 10:43:54.709 [hingStatusInfoChangedEvent] - ‘exec:command:c62f17bf’ changed from UNINITIALIZED to INITIALIZING
2016-12-27 10:43:54.803 [hingStatusInfoChangedEvent] - ‘exec:command:50117513’ changed from INITIALIZING to ONLINE
2016-12-27 10:43:54.803 [hingStatusInfoChangedEvent] - ‘exec:command:c62f17bf’ changed from INITIALIZING to ONLINE

==> /var/log/openhab2/openhab.log <==
2016-12-27 10:43:56.010 [INFO ] [.dashboard.internal.DashboardService] - Started dashboard at /start
2016-12-27 10:43:56.480 [INFO ] [basic.internal.servlet.WebAppServlet] - Started Basic UI at /basicui/app
2016-12-27 10:43:56.612 [INFO ] [arthome.ui.paper.internal.PaperUIApp] - Started Paper UI at /ui
2016-12-27 10:43:56.777 [INFO ] [panel.internal.HABPanelDashboardTile] - Started HABPanel at /habpanel
2016-12-27 10:43:57.044 [INFO ] [persistence.jdbc.internal.JdbcMapper] - JDBC::openConnection: Driver is available::Yank setupDataSource
2016-12-27 10:44:00.022 [WARN ] [jdbc.internal.JdbcPersistenceService] - JDBC::store: ignore Item ‘DHT22Temperature_Output’ because it is UnDefType
2016-12-27 10:45:00.006 [WARN ] [jdbc.internal.JdbcPersistenceService] - JDBC::store: ignore Item ‘DHT22Temperature_Output’ because it is UnDefType

On Mysql side, all is ok :

mysql> use openhab
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> show tables
-> ;
±------------------+
| Tables_in_openhab |
±------------------+
| item0001 |
| items |
±------------------+
2 rows in set (0.00 sec)

mysql> select * from items;
±-------±------------------------+
| ItemId | itemname |
±-------±------------------------+
| 1 | DHT22Temperature_Output |
±-------±------------------------+
1 row in set (0.00 sec)

mysql> select * from item0001;
Empty set (0.00 sec)

mysql> desc item0001;
±------±----------±-----±----±------------------±----------------------------+
| Field | Type | Null | Key | Default | Extra |
±------±----------±-----±----±------------------±----------------------------+
| time | timestamp | NO | PRI | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP |
| value | double | YES | | NULL | |
±------±----------±-----±----±------------------±----------------------------+
2 rows in set (0.01 sec)

My configuration seems OK. So I don’t understand what is the problem.

After research on the forum, I have found there is a bug with the exec binding and the persistence for the number type.

The solution to work around the problem, I have changed the item type in String type.

1 Like