[Solved] Reading state of Number Item always return null

Hello everybody,

after updating to 2.2.0 I’m expiriencing an error when I try to read the state of a Number Iterm in a rule. It always returns null :


                logError("LogMSG", HeizungSZTargetTemp.label)
                logError("LogMSG", HeizungSZTargetTemp.state)


00:28:52.915 [ERROR] [eclipse.smarthome.model.script.LogMSG] - Solltemp. Schlafzimmer
00:28:52.926 [ERROR] [untime.internal.engine.RuleEngineImpl] - Rule 'Balkontuer': An error occurred during the script execution: Could not invoke method: org.eclipse.smarthome.model.script.actions.LogAction.logError(java.lang.String,java.lang.String,java.lang.Object[]) on instance: null

The state of this numberitem is definity not null, but contains the current bedroom temperature. With other NumberItems I get the same error. Is it possible that 2.2.0 introduced this as a new bug? Or am I just too stupid to see the reason for this error? :wink:


I do not believe this is a bug. Number Items will hold a number value and you should be able to do comparisons in a rule. If you want to print it, you could use this…

val Number num = 2312
logInfo("Value of number :",num.toString())

On my OpenHab 2.2 the result is

2017-12-29 01:49:04.753 [INFO ] [thome.model.script.Value of number :] - 2312

Hi Martin,

I just found the problem in my config: I defined a variable which should get filled with the state of a Number item. Later, when I look into the content of that variable it’s null. Now I saw that I forget to add the type of “Number” to the variable. Adding this seems to fix the issue. Thanks for helping.