Hi,
I’m having problems with a simple rule I want to use to change the volume on my receiver using a python script.
The issue I’m having is with the volume variable. I read it from the receiver and print it to the log (-47). However when I try to use it in my if-statement I get a null pointer. How is this possible??
rule NadVolume
when
Item nadVolume received command
then
lock.lock()
try {
var Number volume = executeCommandLine("python/nad.py volume ?", 2000)
logInfo("volume", "volume changed " + volume)
if(volume < 7 && volume > -99) {
switch (receivedCommand){
case 1: volume = volume + 1
case 2: volume = volume - 1
}
executeCommandLine("python/nad.py volume " + volume)
}
finally {
lock.unlock()
}
end
from the log:
2016-09-01 21:12:39.166 [INFO ] [rg.openhab.model.script.volume] - volume changed -47
2016-09-01 21:12:40.189 [ERROR] [o.o.c.s.ScriptExecutionThread ] - Error during the execution of rule 'NadVolume': Could not invoke method: org.openhab.model.script.lib.NumberExtensions.operator_lessThan(java.lang.Number,java.lang.Number) on instance: null