// Persistence strategies have a name and a definition and are referred to in the “Items” section
Strategies {
everyMinute : “0 * * * * ?”
everyHour : “0 0 * * * ?”
everyDay : “0 0 0 * * ?”
// If no strategy is specified for an item entry below, the default list will be used.
default = everyChange
}
/*
Each line in this section defines for which item(s) which strategy(ies) should be applied.
You can list single items, use “" for all items or "groupitem” for all members of a group
rule "Update max and min temperatures"
when
Item Netatmo_Outdoor_Temperature changed or
Item Netatmo_Indoor_Temperature changed or
Time cron "0 0 0 * * ?" or
System started
then
postUpdate(Netatmo_Indoor_Temp_Max, Netatmo_Indoor_Temperature.maximumSince(now.toDateMidnight).state)
postUpdate(Netatmo_Indoor_Temp_Min, Netatmo_Indoor_Temperature.minimumSince(now.toDateMidnight).state)
postUpdate(Netatmo_Outdoor_Temp_Max, Netatmo_Outdoor_Temperature.maximumSince(now.toDateMidnight).state)
postUpdate(Netatmo_Outdoor_Temp_Min, Netatmo_Outdoor_Temperature.minimumSince(now.toDateMidnight).state)
end
During startup of openhab i get the following:
2015-11-21 17:15:11.762 [WARN ] [.o.c.p.e.PersistenceExtensions] - There is no queryable persistence service registered with the name ‘rrd4j’
2015-11-21 17:15:11.780 [ERROR] [m.r.internal.engine.RuleEngine] - Error during the execution of startup rule ‘Update max and min temperatures’: cannot invoke method public abstract
org.openhab.core.types.State org.openhab.core.persistence.HistoricItem.getState() on null
It looks like your rules are executing before your persistence has loaded. Change the polling periods at the top of openhab.cfg so your rules are loaded last. I use these settings:
I tried that, but it seems it doesn’t help, same result. Here is a excerpt from my startup log:
root@cubietruck:/opt/openhab# ./start.sh
Launching the openHAB runtime…
osgi> 2015-11-22 09:36:39.739 [INFO ] [.o.core.internal.CoreActivator] - openHAB runtime has been started (v1.8.0).
2015-11-22 09:36:45.734 [INFO ] [o.o.i.s.i.DiscoveryServiceImpl] - mDNS service has been started
2015-11-22 09:36:45.982 [INFO ] [o.o.i.s.i.DiscoveryServiceImpl] - Service Discovery initialization completed.
2015-11-22 09:36:57.564 [INFO ] [penhab.io.rest.RESTApplication] - Started REST API at /rest
2015-11-22 09:37:03.291 [INFO ] [.o.u.w.i.servlet.WebAppServlet] - Started Classic UI at /openhab.app
2015-11-22 09:37:03.789 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model ‘default.items’
2015-11-22 09:37:07.289 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model ‘rrd4j.persist’
2015-11-22 09:37:10.759 [INFO ] [o.b.f.internal.FritzboxBinding] - Fritzbox conditional deActivate: true
2015-11-22 09:37:10.756 [INFO ] [.service.AbstractActiveService] - FritzBox refresh Service has been started
2015-11-22 09:37:10.784 [INFO ] [o.b.f.internal.FritzboxBinding] - Attempting connection to FritzBox on 192.168.119.1:1012…
2015-11-22 09:37:10.805 [INFO ] [o.b.f.internal.FritzboxBinding] - Connected to FritzBox on 192.168.119.1:1012
2015-11-22 09:37:11.272 [INFO ] [.service.AbstractActiveService] - Netatmo Refresh Service has been started
2015-11-22 09:37:12.815 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model ‘default.sitemap’
2015-11-22 09:37:15.066 [INFO ] [.service.AbstractActiveService] - Tinkerforge Refresh Service has been started
2015-11-22 09:37:17.224 [INFO ] [.myopenhab.internal.MyOHClient] - Connected to my.openHAB service (UUID = 4d50c274-5468-4fea-9d21-58fca5af6b59, base URL = http://localhost:8080)
2015-11-22 09:37:18.892 [INFO ] [.o.io.habmin.HABminApplication] - Started HABmin REST API at /services/habmin
2015-11-22 09:37:19.403 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model ‘temp_min_max.rules’
2015-11-22 09:37:23.072 [WARN ] [.o.c.p.e.PersistenceExtensions] - There is no queryable persistence service registered with the name ‘rrd4j’
2015-11-22 09:37:23.088 [ERROR] [m.r.internal.engine.RuleEngine] - Error during the execution of startup rule ‘Update max and min temperatures’: cannot invoke method public abstract org.openhab.core.types.S
tate org.openhab.core.persistence.HistoricItem.getState() on null
2015-11-22 09:37:23.114 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model ‘inddor_weather_conditions.rules’
2015-11-22 09:37:23.614 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model ‘netatmo_battery_status.rules’
2015-11-22 09:37:23.985 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model ‘last_update_time.rules’
2015-11-22 09:37:24.158 [INFO ] [runtime.busevents ] - Netatmo_Indoor_Noise state updated to 43
2015-11-22 09:37:24.163 [INFO ] [runtime.busevents ] - Netatmo_Rain_Batteryvp state updated to 97
2015-11-22 09:37:24.169 [INFO ] [runtime.busevents ] - Netatmo_Rain_Rfstatus state updated to 1
2015-11-22 09:37:24.171 [INFO ] [runtime.busevents ] - Netatmo_Outdoor_Rfstatus state updated to 2
2015-11-22 09:37:24.183 [INFO ] [runtime.busevents ] - Netatmo_Indoor_CO2 state updated to 530
2015-11-22 09:37:24.185 [INFO ] [runtime.busevents ] - Netatmo_Indoor_Humidity state updated to 46
2015-11-22 09:37:24.194 [INFO ] [runtime.busevents ] - Netatmo_Outdoor_Humidity state updated to 86
2015-11-22 09:37:24.226 [INFO ] [runtime.busevents ] - Netatmo_Indoor_Temperature state updated to 20.2
2015-11-22 09:37:24.230 [INFO ] [runtime.busevents ] - Netatmo_Indoor_wifi state updated to 2
2015-11-22 09:37:24.242 [INFO ] [runtime.busevents ] - Netatmo_Rain_Gauge state updated to 0
2015-11-22 09:37:24.247 [INFO ] [runtime.busevents ] - Netatmo_Indoor_altitude state updated to 51
2015-11-22 09:37:24.253 [INFO ] [runtime.busevents ] - Netatmo_Indoor_longitude state updated to 13.2715270000000007399876267299987375736236572265625
2015-11-22 09:37:24.288 [INFO ] [runtime.busevents ] - Netatmo_Outdoor_Temperature state updated to 1.8
2015-11-22 09:37:24.291 [INFO ] [runtime.busevents ] - Netatmo_Indoor_latitude state updated to 52.45821699999999765395841677673161029815673828125
2015-11-22 09:37:24.292 [INFO ] [runtime.busevents ] - Netatmo_Indoor_Pressure state updated to 993.4
2015-11-22 09:37:24.294 [INFO ] [runtime.busevents ] - Netatmo_Outdoor_Batteryvp state updated to 100
2015-11-22 09:37:24.295 [WARN ] [.o.c.p.e.PersistenceExtensions] - There is no queryable persistence service registered with the name ‘rrd4j’
2015-11-22 09:37:24.330 [INFO ] [runtime.busevents ] - Netatmo_Indoor_Temp_Max state updated to 20.2
2015-11-22 09:37:24.333 [WARN ] [.o.c.p.e.PersistenceExtensions] - There is no queryable persistence service registered with the name ‘rrd4j’
2015-11-22 09:37:24.358 [INFO ] [runtime.busevents ] - Netatmo_Indoor_Temp_Max state updated to 20.2
2015-11-22 09:37:25.248 [INFO ] [o.harmonyhub.HarmonyHubGateway] - HarmonyHub gateway activated
2015-11-22 09:37:25.270 [INFO ] [runtime.busevents ] - Netatmo_LastUpdate state updated to 2015-11-22T09:37:25
2015-11-22 09:37:25.578 [WARN ] [.o.c.p.e.PersistenceExtensions] - There is no queryable persistence service registered with the name ‘rrd4j’
2015-11-22 09:37:25.585 [WARN ] [.o.c.p.e.PersistenceExtensions] - There is no queryable persistence service registered with the name ‘rrd4j’
2015-11-22 09:37:25.605 [INFO ] [runtime.busevents ] - Netatmo_Indoor_Temp_Min state updated to 20.2
2015-11-22 09:37:25.609 [INFO ] [runtime.busevents ] - Netatmo_Indoor_Temp_Min state updated to 20.2
2015-11-22 09:37:25.890 [INFO ] [.z.internal.ZWaveActiveBinding] - Update config, port = /dev/ttyUSB0
2015-11-22 09:37:25.893 [INFO ] [.z.internal.ZWaveActiveBinding] - Update config, healtime = 2
2015-11-22 09:37:25.914 [INFO ] [.service.AbstractActiveService] - ZWave Refresh Service has been started
2015-11-22 09:37:26.096 [INFO ] [b.z.i.protocol.ZWaveController] - Starting Z-Wave controller
2015-11-22 09:37:26.112 [INFO ] [b.z.i.protocol.ZWaveController] - Z-Wave timeout is set to 5000ms. Soft reset is false.
2015-11-22 09:37:26.114 [INFO ] [b.z.i.protocol.ZWaveController] - Connecting to serial port /dev/ttyUSB0
RXTX Warning: Removing stale lock file. /var/lock/LCK…ttyUSB0
2015-11-22 09:37:26.291 [WARN ] [i.internal.GenericItemProvider] - Attempted to register a second BindingConfigReader of type ‘zwave’. The primaraly reader will remain active!
2015-11-22 09:37:26.477 [WARN ] [.o.c.p.e.PersistenceExtensions] - There is no queryable persistence service registered with the name ‘rrd4j’
2015-11-22 09:37:26.503 [INFO ] [runtime.busevents ] - Netatmo_Outdoor_Temp_Max state updated to 1.8
2015-11-22 09:37:26.490 [WARN ] [.o.c.p.e.PersistenceExtensions] - There is no queryable persistence service registered with the name ‘rrd4j’
2015-11-22 09:37:26.517 [INFO ] [runtime.busevents ] - Netatmo_Outdoor_Temp_Max state updated to 1.8
What is your default persistence set to in openhab.cfg?
Does this error appear every time that the rule executes or only during startup? If it is only during startup then the error really isn’t causing a problem. The min/max gets updated the next time the rule gets run.
I don’t really have any suggestions. When I had this exact same error doing exactly the same thing (getting the max/min temperature) delaying the loading of the rules made the error go away.