sorry if I ask a rather stupid question, but my logs are full of lines like this
[ERROR] [.script.engine.ScriptExecutionThread] - Rule 'Light on PIR': null
and I have no idea, where in the script the null occurs, neither what the reason is for it. Is it possible to somehow find out where exactly in the script the “null” has been, similar to the NullPointerException in Java, where it’s pretty easy to figure out the reason?
maybe we can combine it with this topic:
I had a rule which crashed because of an not existing command to an item. This exception causes the rule to not run to the end.
Is there a way to prevent this, so that the rules runs to the end
rule "PresistenceWiederherstellen" when Item SW_PresistenceWiederherstellen changed to ON then gRestoreState.members.forEach[item | item.sendCommand(item.previousState(false,"mapdb").state.toString) ]
This rule crashed on contact…
Not really the same but goes in the same direction.
How to debug rules?
How to identify exceptions?
I’m interesting is this too.
Some guidance here
I'm very new to openhab2 and I have troubles writing my rules. I edit the rule file manually, test run and check in the events.log and openhab.log what's happening. However it seems as if a rule has a syntax error, it just isn't executed at all. No error in the logs. So how do I debug my rules in a better way then trial and error?
One of my rules is not having the expected result and I'd like to be able to monitor the debugging for this rule but am unsure how to get Karaf to log rules as I was able to see in the console when running start_debug.sh from OH1. Please bear in mind I'm SSHing into a headless machine which is running OH2.
In essence, add logInfo lines to Rules to record progress and values of interest, and find out how to view the logs
thanks for your reply. Oh - okay, so I really have to do logging before each statement, which is, however when using multiple statements in a line not possible, so I have to split up a line like
val pir = gPIRLight.allMembers.filter[s|s!=null].sortBy[lastUpdate].last
to see what’s happening (I currently suspect this line to produce a null as the next line is just a log output and sending a email with pir.label).