Using Mysql persistence i can’t get items states to restore on startup.I have this problem for a while, but always tought something is wrong with my setup. But after reading and fiddling with all the settings i can’t seem to fix it.
mysql.persist
Strategies {
everyHour : "0 0 * * * ?"
default = everyChange
}
Items {
_grpPersist* : strategy = restoreOnStartup, everyChange
_grpMeterstand* : strategy = restoreOnStartup, everyHour
}
Meterstand.Items
Number verd0_meterkast_stroom_in_laag "Meterstand in laagtarief [%.0f kwh] " <energy> (_grpVerd0,_grpEnergie,_grpMeterstand) { channel="mqtt:topic:lplxvibroker:slimmemeter:stroom_in_stand_laag"}
Number verd0_meterkast_stroom_in_hoog "Meterstand in hoogtarief [%.0f kwh]" <energy> (_grpVerd0,_grpEnergie,_grpMeterstand) { channel="mqtt:topic:lplxvibroker:slimmemeter:stroom_in_stand_hoog"}
Number verd0_meterkast_stroom_uit_laag "Meterstand uit laagtarief [%.0f kwh] " <energy> (_grpVerd0,_grpEnergie,_grpMeterstand) { channel="mqtt:topic:lplxvibroker:slimmemeter:stroom_uit_stand_laag"}
Number verd0_meterkast_stroom_uit_hoog "Meterstand uit hoogtarief [%.0f kwh]" <energy> (_grpVerd0,_grpEnergie,_grpMeterstand) { channel="mqtt:topic:lplxvibroker:slimmemeter:stroom_uit_stand_hoog"}
I checked if the values are persisted and i didn’t find any problem with that:
SELECT * FROM `Items` where ItemName in ('verd0_meterkast_stroom_in_laag','verd0_meterkast_stroom_in_hoog','verd0_meterkast_stroom_uit_laag','verd0_meterkast_stroom_uit_hoog')
// 4 records: Item18, 56, 132 and 135
SELECT * FROM Item18 ORDER BY Time desc LIMIT 1
// did this for all 4 items. They return the same time: '2019-08-01 10:00:00' and similar value (double): '970.072'
Logfile snippet when system startup with log:set DEBUG org.openhab.persistence.mysql
2019-08-01 11:57:50.086 [DEBUG] [sql.internal.MysqlPersistenceService] - mySQL query: item is verd0_meterkast_stroom_in_hoog
2019-08-01 11:57:50.087 [DEBUG] [sql.internal.MysqlPersistenceService] - mySQL: query:SELECT Time, Value FROM Item56 ORDER BY Time DESC LIMIT 0,1
2019-08-01 11:57:50.088 [DEBUG] [sql.internal.MysqlPersistenceService] - mySQL: query returned 1 rows in 2ms
2019-08-01 11:57:50.094 [DEBUG] [sql.internal.MysqlPersistenceService] - mySQL query: item is verd0_meterkast_stroom_uit_laag
2019-08-01 11:57:50.095 [DEBUG] [sql.internal.MysqlPersistenceService] - mySQL: query:SELECT Time, Value FROM Item132 ORDER BY Time DESC LIMIT 0,1
2019-08-01 11:57:50.097 [DEBUG] [sql.internal.MysqlPersistenceService] - mySQL: query returned 1 rows in 2ms
2019-08-01 11:57:50.103 [DEBUG] [sql.internal.MysqlPersistenceService] - mySQL query: item is verd0_meterkast_stroom_uit_hoog
2019-08-01 11:57:50.104 [DEBUG] [sql.internal.MysqlPersistenceService] - mySQL: query:SELECT Time, Value FROM Item135 ORDER BY Time DESC LIMIT 0,1
2019-08-01 11:57:50.105 [DEBUG] [sql.internal.MysqlPersistenceService] - mySQL: query returned 1 rows in 1ms
2019-08-01 11:57:50.112 [DEBUG] [sql.internal.MysqlPersistenceService] - mySQL query: item is verd0_meterkast_stroom_in_laag
2019-08-01 11:57:50.113 [DEBUG] [sql.internal.MysqlPersistenceService] - mySQL: query:SELECT Time, Value FROM Item18 ORDER BY Time DESC LIMIT 0,1
2019-08-01 11:57:50.115 [DEBUG] [sql.internal.MysqlPersistenceService] - mySQL: query returned 1 rows in 2ms
So it looks like eveything works as expected. BUT i don’t see the the values in basicUI or PaperUI:
What else can i do to check?
Edit 1: So i removed the channel declaration from the Item and now the value is restoredOnStartup. So all the persistence stuff is ok. The MQTT binding (or configuration) is now the first suspect for not restoring the values at startup.
Bridge configuration:
Bridge mqtt:broker:lplxvibroker "Bridge Label" [host="192.168.1.10", port=1883, secure="OFF",retainMessages=true] {
Thing topic slimmemeter "MQTT Slimmemeter" {
Channels:
Type number : stroom_in_stand_laag "Meterstand in laag" [ stateTopic="/lplxvi/meterkast/stroom/in/laag" ]
Type number : stroom_in_stand_hoog "Meterstand in hoog" [ stateTopic="/lplxvi/meterkast/stroom/in/hoog" ]
Type number : stroom_uit_stand_laag "Meterstand uit laag" [ stateTopic="/lplxvi/meterkast/stroom/uit/laag" ]
Type number : stroom_uit_stand_hoog "Meterstand uit hoog" [ stateTopic="/lplxvi/meterkast/stroom/uit/hoog" ]
}
}
Edit2: I also set the MQTT binding in debug mode (but that isn’t showing anything usefull:
2019-08-01 20:21:35.171 [INFO ] [panel.internal.HABPanelDashboardTile] - Started HABPanel at /habpanel
2019-08-01 20:21:35.180 [DEBUG] [org.openhab.binding.mqtt.generic ] - BundleEvent STARTING - org.openhab.binding.mqtt.generic
2019-08-01 20:21:35.182 [DEBUG] [org.openhab.binding.mqtt.generic ] - BundleEvent STARTED - org.openhab.binding.mqtt.generic
2019-08-01 20:21:35.187 [DEBUG] [org.openhab.binding.mqtt.generic ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.core.thing.type.DynamicStateDescriptionProvider, org.openhab.binding.mqtt.generic.MqttChannelStateDescriptionProvider}={service.id=482, service.bundleid=240, service.scope=bundle, component.name=org.openhab.binding.mqtt.generic.MqttChannelStateDescriptionProvider, component.id=291} - org.openhab.binding.mqtt.generic
2019-08-01 20:21:35.196 [DEBUG] [org.openhab.binding.mqtt.generic ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.core.thing.type.ChannelTypeProvider, org.eclipse.smarthome.core.thing.type.ChannelGroupTypeProvider, org.openhab.binding.mqtt.generic.MqttChannelTypeProvider}={service.id=483, service.bundleid=240, service.scope=bundle, component.name=org.openhab.binding.mqtt.generic.MqttChannelTypeProvider, component.id=292} - org.openhab.binding.mqtt.generic
2019-08-01 20:21:35.202 [DEBUG] [org.openhab.binding.mqtt.generic ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.core.thing.binding.ThingHandlerFactory}={service.id=484, service.bundleid=240, service.scope=bundle, component.name=org.openhab.binding.mqtt.generic.internal.MqttThingHandlerFactory, component.id=293} - org.openhab.binding.mqtt.generic
2019-08-01 20:21:36.686 [DEBUG] [.MqttChannelStateDescriptionProvider] - Adding state description for channel mqtt:topic:lplxvibroker:slimmemeter:stroom_in_stand_laag
2019-08-01 20:21:36.688 [DEBUG] [.MqttChannelStateDescriptionProvider] - Adding state description for channel mqtt:topic:lplxvibroker:slimmemeter:stroom_in_stand_hoog
2019-08-01 20:21:36.695 [DEBUG] [.MqttChannelStateDescriptionProvider] - Adding state description for channel mqtt:topic:lplxvibroker:slimmemeter:stroom_uit_stand_laag
2019-08-01 20:21:36.696 [DEBUG] [.MqttChannelStateDescriptionProvider] - Adding state description for channel mqtt:topic:lplxvibroker:slimmemeter:stroom_uit_stand_hoog
2019-08-01 20:21:36.778 [DEBUG] [ab.binding.mqtt.generic.ChannelState] - Subscribed channel mqtt:topic:lplxvibroker:slimmemeter:stroom_uit_stand_hoog to topic: /lplxvi/meterkast/stroom/uit/hoog
2019-08-01 20:21:36.780 [DEBUG] [ab.binding.mqtt.generic.ChannelState] - Subscribed channel mqtt:topic:lplxvibroker:slimmemeter:stroom_in_stand_hoog to topic: /lplxvi/meterkast/stroom/in/hoog
2019-08-01 20:21:36.781 [DEBUG] [ab.binding.mqtt.generic.ChannelState] - Subscribed channel mqtt:topic:lplxvibroker:slimmemeter:stroom_uit_stand_laag to topic: /lplxvi/meterkast/stroom/uit/laag
2019-08-01 20:21:36.785 [DEBUG] [ab.binding.mqtt.generic.ChannelState] - Subscribed channel mqtt:topic:lplxvibroker:slimmemeter:stroom_in_stand_laag to topic: /lplxvi/meterkast/stroom/in/laag
2019-08-01 20:21:36.990 [DEBUG] [g.openhab.binding.mqtt.homeassistant] - BundleEvent STARTING - org.openhab.binding.mqtt.homeassistant
2019-08-01 20:21:36.993 [DEBUG] [g.openhab.binding.mqtt.homeassistant] - BundleEvent STARTED - org.openhab.binding.mqtt.homeassistant
2019-08-01 20:21:36.999 [DEBUG] [g.openhab.binding.mqtt.homeassistant] - ServiceEvent REGISTERED - {org.eclipse.smarthome.core.thing.binding.ThingHandlerFactory}={service.id=485, service.bundleid=241, service.scope=bundle, component.name=org.openhab.binding.mqtt.homeassistant.generic.internal.MqttThingHandlerFactory, component.id=294} - org.openhab.binding.mqtt.homeassistant
2019-08-01 20:21:37.139 [DEBUG] [g.openhab.binding.mqtt.homeassistant] - ServiceEvent REGISTERED - {org.eclipse.smarthome.config.discovery.DiscoveryService}={service.id=486, service.bundleid=241, service.scope=bundle, component.name=org.openhab.binding.mqtt.homeassistant.internal.discovery.HomeAssistantDiscovery, component.id=295} - org.openhab.binding.mqtt.homeassistant
2019-08-01 20:21:37.158 [DEBUG] [org.openhab.binding.mqtt.homie ] - BundleEvent STARTING - org.openhab.binding.mqtt.homie
2019-08-01 20:21:37.159 [DEBUG] [org.openhab.binding.mqtt.homie ] - BundleEvent STARTED - org.openhab.binding.mqtt.homie
2019-08-01 20:21:37.165 [DEBUG] [org.openhab.binding.mqtt.homie ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.core.thing.binding.ThingHandlerFactory}={service.id=487, service.bundleid=242, service.scope=bundle, component.name=org.openhab.binding.mqtt.homie.generic.internal.MqttThingHandlerFactory, component.id=296} - org.openhab.binding.mqtt.homie
2019-08-01 20:21:46.957 [DEBUG] [org.openhab.binding.mqtt.homie ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.config.discovery.DiscoveryService}={service.id=488, service.bundleid=242, service.scope=bundle, component.name=org.openhab.binding.mqtt.homie.internal.discovery.Homie300Discovery, component.id=297} - org.openhab.binding.mqtt.homie
2019-08-01 20:21:47.012 [DEBUG] [qtt.generic.AbstractMQTTThingHandler] - Successfully published value 19.5 to topic events/central_heating/otmonitor/setpoint
Edit3:
I noticed that when i set the value for this item in paperUI Control a error is shown in the dev console:
angular.min.js:117 Error: [ngModel:numfmt] http://errors.angularjs.org/1.5.7/ngModel/numfmt?p0=UNDEF
at angular.min.js:6
at Array.<anonymous> (angular.min.js:268)
at angular.min.js:287
at m.$digest (angular.min.js:142)
at m.$apply (angular.min.js:145)
at angular.min.js:158
at e (angular.min.js:45)
at angular.min.js:48