[SOLVED] OH2: errors after migrating rule file from v1

I am getting these errors, after migrating a rule file from v1 to v2 :

2018-12-25 12:46:02.068 [INFO ] [el.core.internal.ModelRepositoryImpl] - Validation issues found in configuration model 'max01.rules', using it anyway:
2018-12-25 12:46:02.198 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'max01.rules'
2018-12-25 12:46:21.948 [INFO ] [ipse.smarthome.model.script.maxe01.0] - initialise state(s)
2018-12-25 12:46:21.957 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Error during the execution of startup rule 'Update shed KDL max and min humidity': cannot invoke method public abstract org.eclipse.smarthome.core.types.State org.eclipse.smarthome.core.persistence.HistoricItem.getState() on null
2018-12-25 12:46:21.962 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Error during the execution of startup rule 'Update shed KDL max and min temperatures': cannot invoke method public abstract org.eclipse.smarthome.core.types.State org.eclipse.smarthome.core.persistence.HistoricItem.getState() on null

Since there is no historic data, this could be the problem.
rrdj4 has a .persist file, with the items being a part of.
However, the items get their update via MQTT which is not yet configured.
Maybe once I get data coming in, this could resolve itself?!

Yes. When there is no data the persistence calls will return null.

Yes, I think it will, though this could be a good opportunity to make your Rules a bit more robust to test for this type of problem and log an error or post an alert.

1 Like