Problem with historicState function NullPointerException

Hi.

Yesterday I’ve switched to OH2.
Almost all good. One problem occured in the night when a rule triggered.
This rule calculates a delta value from an historic state.
This has worked OK in OH1 but not in OH2.
This is the exception stacktrace:

2015-10-05 09:59:00 [DEBUG] [.o.p.j.i.JpaPersistenceService:192  ] - Retrieving result list...done
2015-10-05 09:59:00 [DEBUG] [.o.p.j.i.JpaPersistenceService:194  ] - Retrieved 1 items.
2015-10-05 09:59:00 [DEBUG] [.o.p.j.i.JpaPersistenceService:199  ] - Convert to HistoricItem: 1
2015-10-05 09:59:00 [ERROR] [.m.r.r.i.engine.ExecuteRuleJob:62   ] - Error during the execution of rule EtaOpHoursWeekjava.lang.NullPointerException: null
	at java.math.BigDecimal.compareTo(BigDecimal.java:2625)
	at org.eclipse.smarthome.model.script.lib.NumberExtensions.operator_equals(NumberExtensions.java:170)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.invokeOperation(XbaseInterpreter.java:1084)
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.invokeOperation(XbaseInterpreter.java:1059)
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._invokeFeature(XbaseInterpreter.java:1045)
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.invokeFeature(XbaseInterpreter.java:990)
	at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.invokeFeature(ScriptInterpreter.java:112)

I’ve added some more debug to the JPA binding as I thought it doesn’t for some reason retrieve an item but it does.
I’m not exactly certain where the problem is, looking at the code all seems actually fine.

Any idea?

P.S.: in OH1 we had the deltaSince extension method which seems to be gone in OH2.

Manfred

More weird: changing from historicState() to minimumSince() seems to be working.
This might do as a workaround. But it’s strange still.

I’ve tried to replicate this in a test environment with a clean OH2.
But all is working OK there.
So it must be something related to my items or persistence.

What could possibly be the cause that it works with minimumSince but not historicState?

Manfred

Hi Manfred,
I have noticed the same issue (OH2 on ReadyNAS, mySQL persistence).
In OH1 deltaSince wokrs fine. In OH2 it gives now an error (command not found?).
So it really semans that this extension method is gone in OH2.

However, also your proposed change to minimumSince() / historicState() does not work (java lang exception).

For the moment I have switched back to OH1 as I cannot find a solution.

Cheers
Björn

It’s unfortunate. I like the architecture of OH2 better.
Unfortunately it takes too much time to get behind this error.
If nothing helps I might need to switch back to OH1 as well.

Manfred

It isn’t gone, but it was missed to sync it to ESH/OH2 when this method was introduced.
The good news is: It will soon also be available there, see https://github.com/eclipse/smarthome/pull/500.

FTR, the NPE is further followed up on at https://github.com/openhab/openhab2/issues/423

Thx.

Hi there Extrabannies,

I have a ReadyNAS 102 (running OS 6.5.2) and would very much like to install OpenHAB 2.
However there are no repositories or standard debian packages available which I can use to easily install OpenHAB 2 on my NAS via the front end.

So I would very much like to ask for your help how you installed OpenHAB 2 on your ReadyNAS. Is there any tutorial or maybe a repository with packages I can use to install it?

Please let me know.

Thank you in advance.

Cheers,
Fremske

Hi Fremske,

After much trial and error with my ReadyNas 102 (running OS 6.5.x), I finally gave up because of a stupid Signal 11 error (see also here: https://github.com/openhab/openhab/issues/1504). I changed to a Raspberry Pi wchih saves the data on a mySQL Server running on the NAS.

However, I tried to put some instructions together - see attachment.

Note, that you will need to copy paste via zip file all necessary data to your readynas and change/adopt the cfg file as well as the sitemap, etc. manually.

In case of questions, feel free to ask.OpenHab Installation.pdf (369.2 KB)

Cheers

Björn

Hi Bjorn,

Thank you for your reply and support!!
Does this signal 11 error only happen on OpenHAB 2.0 or also on the latest production version?
Please let me know.

Because I think it did running perfectly before on your RN102? Since you reported this on the Readynas forum.

Cheers,
Fremske

Hi Fremske,

I still run OpenHAB on the 1.x Version. Reason is (although I do not know whether it has been solved by now) that using mySQL as Server in compbination with a Historic State call produced the error described here.

Secondly I encountered - after using the Option 1 of the solution described here:
http://blog.timmattison.com/archives/2014/08/29/deal-with-os-linux-zero-dot-cpp-related-jvm-crashes-without-using-the-oracle-jvm/ - that although OpenHab was running over a much longer period, the Signal 11 error came back.

Currently I am to lazy to try again whether OpenHAB 2.x might work on the ReadyNAS 102.

Cheers
Björn

Hi Bjorn,

I am just starting out with home automation and was very excited when I found out about OpenHab.

I have a ReadyNAS102 (running OS 6.6.1) and have tried to follow your instructions in the OpenHab Installation PDF and created the database permissions etc.

I am stuck on the next step with the provided php script. This step seems to indicate an INSERT into the
Tabelle table (not yet created) but I can’t seem to get it working. I get a 500 error when running the php file from the OpenHab dir via the browser. PHP is installed and I have tested basic php echo commands which work.

Should the Tabelle table be created before this? If so, can you provide some guidance as to the data types and other parameters required for the columns so I can create with phpMyAdmin:

Date (I assume DATETIME)
$Parameter2 (Are these empty variables?)
$Parameter3 (Are these empty variables?)

Also given that the post is a little old the download links no longer work. I have looked at the “openHAB 2 on Linux > Package Repository Installation” (http://docs.openhab.org/installation/linux.html) but I am not sure which is the appropriate installation instructions.

I would very much appreciate any assistance you may be able to provide.

Thanks in advance :slight_smile:
Aaren

Hi Aaren,
Pls advise what php script you mean.
Normally the tables should be automatically created when openhab saves data in the database.
Cheers
Björn

Hi Bjorn,

Thank you for your reply.

The script is the last part of step 3 (page 4). Based on your reply I will assume this is not required and an empty DB is all that is required here. Thanks.

I have followed the steps in the above mentioned PDF

  1. SSH using PuTTY on Win10 to install jre7 on NAS
  2. I have created OpenHab share and set permissions via the ReadyNas web console
  3. MySQL & PHP (previously installed) - OpenHab DB created

Can you help/guide me with OpenHab2 installation? which repo Apt Based Systems, Yum or Dnf Based Systems, manual or can I download on PC and copy to share dir on NAS?

I can’t seem to find much info about setting up OpenHab2 on ReadyNAS. Should I be pursuing this approach or move to another platform such as Raspbery Pi. I just thought the ReadyNAS would be best if I could get it working.

Thanks again for getting back to me. I really appreciate your assistance.

Aaren

Hi Aaren,

To be honest: I ran into many problems and troubles with my ReadyNAS102 because I experienced many times a stack overflow. I figured out it had something to do with the kernel an the processor.
So in the end I have now a raspberry pi in use for OpenHab but mysql runs on the ReadyNAS102.

Hope this answer helps.

Cheers

Björn

Hi Bjorn,

I appreciate your comments. I will give the Raspberry Pi go.

Thanks again.

Aaren