I'm getting an error while trying to check the router connectivity

The same errors

2019-11-24 15:49:14.655 [INFO ] [lipse.smarthome.model.script.network] - Router is offline

2019-11-24 15:49:16.906 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Network Router OFF': An error occurred during the script execution: Cannot resolve proxy: network.rules#/1

2019-11-24 15:49:16.900 [ERROR] [org.quartz.core.JobRunShell         ] - Job DEFAULT.2019-11-24T15:49:15.714+02:00: Proxy for org.eclipse.xtext.xbase.lib.Procedures$Procedure0: [ | {

  logInfo(<XStringLiteralImpl>,<XBinaryOperationImplCustom>)

  org.eclipse.xtext.xbase.impl.XIfExpressionImpl@35bb1c

  <XFeatureCallImplCustom>.reschedule(<XMemberFeatureCallImplCustom>)

} ] threw an unhandled Exception: 

java.lang.NullPointerException: cannot invoke method public java.lang.String java.lang.Object.toString() on null

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.invokeOperation(XbaseInterpreter.java:1071) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.invokeOperation(XbaseInterpreter.java:1061) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._invokeFeature(XbaseInterpreter.java:1047) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.invokeFeature(XbaseInterpreter.java:992) ~[?:?]

	at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.invokeFeature(ScriptInterpreter.java:151) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:772) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:220) ~[?:?]

	at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:204) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.evaluateArgumentExpressions(XbaseInterpreter.java:1116) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._invokeFeature(XbaseInterpreter.java:1046) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.invokeFeature(XbaseInterpreter.java:992) ~[?:?]

	at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.invokeFeature(ScriptInterpreter.java:151) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:902) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:226) ~[?:?]

	at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:204) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.evaluateArgumentExpressions(XbaseInterpreter.java:1116) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._invokeFeature(XbaseInterpreter.java:1046) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.invokeFeature(XbaseInterpreter.java:992) ~[?:?]

	at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.invokeFeature(ScriptInterpreter.java:151) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:902) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:865) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:224) ~[?:?]

	at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:204) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:447) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:228) ~[?:?]

	at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:204) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.evaluate(XbaseInterpreter.java:190) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.ClosureInvocationHandler.doInvoke(ClosureInvocationHandler.java:46) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.AbstractClosureInvocationHandler.invoke(AbstractClosureInvocationHandler.java:29) ~[?:?]

	at com.sun.proxy.$Proxy149.apply(Unknown Source) ~[?:?]

	at org.eclipse.smarthome.model.script.internal.actions.TimerExecutionJob.execute(TimerExecutionJob.java:49) ~[?:?]

	at org.quartz.core.JobRunShell.run(JobRunShell.java:202) [107:org.eclipse.smarthome.core.scheduler:0.10.0.oh240]

	at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) [107:org.eclipse.smarthome.core.scheduler:0.10.0.oh240]

2019-11-24 15:49:17.238 [ERROR] [org.quartz.core.ErrorLogger         ] - Job (DEFAULT.2019-11-24T15:49:15.714+02:00: Proxy for org.eclipse.xtext.xbase.lib.Procedures$Procedure0: [ | {

  logInfo(<XStringLiteralImpl>,<XBinaryOperationImplCustom>)

  org.eclipse.xtext.xbase.impl.XIfExpressionImpl@35bb1c

  <XFeatureCallImplCustom>.reschedule(<XMemberFeatureCallImplCustom>)

} ] threw an exception.

org.quartz.SchedulerException: Job threw an unhandled exception.

	at org.quartz.core.JobRunShell.run(JobRunShell.java:213) [107:org.eclipse.smarthome.core.scheduler:0.10.0.oh240]

	at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) [107:org.eclipse.smarthome.core.scheduler:0.10.0.oh240]

Caused by: java.lang.NullPointerException: cannot invoke method public java.lang.String java.lang.Object.toString() on null

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.invokeOperation(XbaseInterpreter.java:1071) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.invokeOperation(XbaseInterpreter.java:1061) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._invokeFeature(XbaseInterpreter.java:1047) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.invokeFeature(XbaseInterpreter.java:992) ~[?:?]

	at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.invokeFeature(ScriptInterpreter.java:151) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:772) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:220) ~[?:?]

	at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:204) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.evaluateArgumentExpressions(XbaseInterpreter.java:1116) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._invokeFeature(XbaseInterpreter.java:1046) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.invokeFeature(XbaseInterpreter.java:992) ~[?:?]

	at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.invokeFeature(ScriptInterpreter.java:151) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:902) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:226) ~[?:?]

	at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:204) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.evaluateArgumentExpressions(XbaseInterpreter.java:1116) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._invokeFeature(XbaseInterpreter.java:1046) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.invokeFeature(XbaseInterpreter.java:992) ~[?:?]

	at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.invokeFeature(ScriptInterpreter.java:151) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:902) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:865) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:224) ~[?:?]

	at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:204) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:447) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:228) ~[?:?]

	at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:204) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.evaluate(XbaseInterpreter.java:190) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.ClosureInvocationHandler.doInvoke(ClosureInvocationHandler.java:46) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.AbstractClosureInvocationHandler.invoke(AbstractClosureInvocationHandler.java:29) ~[?:?]

	at com.sun.proxy.$Proxy149.apply(Unknown Source) ~[?:?]

	at org.eclipse.smarthome.model.script.internal.actions.TimerExecutionJob.execute(TimerExecutionJob.java:49) ~[?:?]

	at org.quartz.core.JobRunShell.run(JobRunShell.java:202) ~[?:?]

	... 1 more

Are you actually turning the router off or using a proxy item and switch to simulate for testing?

Under what circumstances, please?

Three seconds between logInfo and error, hence my question.
Also of interest, looking at timestamp not order in log, the timer blows up a few milliseconds before the rule that creates it.

do you mean the rules code ?

var Timer BlinkingTimer = null



rule "Network Router OFF"
when
    Item Router changed to OFF
then
    logInfo("network", "Router is offline")

    if(BlinkingTimer !== null){
        logInfo("network", "old timer " + BlinkingTimer.toString)
        BlinkingTimer.cancel()
        BlinkingTimer = null
    }
        // it's always null if we get this far
    BlinkingTimer = createTimer(now.plusSeconds(1), [ |
        logInfo("timer", "my handle is " + BlinkingTimer.toString)
            if(GPIO_OKLed.state == ON){
                GPIO_OKLed.sendCommand(OFF)
            }else{
                GPIO_OKLed.sendCommand(ON)
            }
            BlinkingTimer.reschedule(now.plusMillis(1000))
        ])
end

Okay, useful to confirm, but interested in the circumstances around your log sample. You’ve just rebooted, or just edited the rules file, or just turned your router off, or operated a dummy switch in your UI, or?

Providing all the info helps prevent such a mess.:wink:

I just restart openhab via
sudo systemctl restart openhab2.service

sorry for the whole topic, I made a mess here and I’ve exhausted you all with me
Thanks I really appreciate it

Okay, it broke during the stress and timing chaos of a bootup.

Now, do it again during normal service.

Things you haven’t said yet -
Any imports in that rules file?
Is the global var Timer above any rules in that file?
Do you see any LED activity?
Do you see just one xxx.rules file loaded message?

Can we see the events.log around an error incident?

Things you haven’t said yet -
Any imports in that rules file? NO
Is the global var Timer above any rules in that file? YES
Do you see any LED activity? NO
Do you see just one xxx.rules file loaded message? YES it load once

Can we see the events.log around an error incident? I’m not sure I understand this

Key logs that openHAB produces are openhab.log, which shows you messages and errors from code, and events.log that shows you commands and state changes to Items.
I would like to see events associated with (at the time of) your rule errors.

Do you want me to upload events.log ?

No really, I don’t want the whole thing. You’ve managed to post snippets from your openhab.log, I would think the same process would do.

2019-11-24 16:19:56.788 [.ItemChannelLinkAddedEvent] - Link 'Router-network:pingdevice:Router:online' has been added.
2019-11-24 16:19:56.811 [.ItemChannelLinkAddedEvent] - Link 'InternetConnection-network:pingdevice:InternetConnection:online' has been added.
2019-11-24 16:19:57.051 [hingStatusInfoChangedEvent] - 'network:pingdevice:Router' changed from UNINITIALIZED to INITIALIZING
2019-11-24 16:19:57.256 [hingStatusInfoChangedEvent] - 'network:pingdevice:Router' changed from INITIALIZING to ONLINE
2019-11-24 16:19:57.318 [me.event.ThingUpdatedEvent] - Thing 'network:pingdevice:Router' has been updated.
2019-11-24 16:19:57.338 [hingStatusInfoChangedEvent] - 'network:pingdevice:InternetConnection' changed from UNINITIALIZED to INITIALIZING
2019-11-24 16:19:57.428 [hingStatusInfoChangedEvent] - 'network:pingdevice:InternetConnection' changed from INITIALIZING to ONLINE
2019-11-24 16:19:57.455 [me.event.ThingUpdatedEvent] - Thing 'network:pingdevice:InternetConnection' has been updated.
2019-11-24 16:20:00.606 [vent.ItemStateChangedEvent] - Router changed from NULL to OFF
2019-11-24 16:20:00.615 [GroupItemStateChangedEvent] - Network changed from NULL to ON through Router
2019-11-24 16:20:00.619 [vent.ItemStateChangedEvent] - InternetConnection changed from NULL to OFF
2019-11-24 16:20:00.625 [GroupItemStateChangedEvent] - Network changed from ON to OFF through InternetConnection

Okeydoke, may we see the openhab.log that goes with the 16:20 changes? The previous errors were arond 15:44. You’l understand we want to see the two views of the same overall incident.

sorry

2019-11-24 15:42:31.031 [temChannelLinkRemovedEvent] - Link 'Router => network:pingdevice:Router:online' has been removed.
2019-11-24 15:42:31.071 [temChannelLinkRemovedEvent] - Link 'InternetConnection => network:pingdevice:InternetConnection:online' has been removed.
2019-11-24 15:43:57.675 [.ItemChannelLinkAddedEvent] - Link 'Router-network:pingdevice:Router:online' has been added.
2019-11-24 15:43:57.696 [.ItemChannelLinkAddedEvent] - Link 'InternetConnection-network:pingdevice:InternetConnection:online' has been added.
2019-11-24 15:43:57.873 [hingStatusInfoChangedEvent] - 'network:pingdevice:Router' changed from UNINITIALIZED to INITIALIZING
2019-11-24 15:43:58.084 [hingStatusInfoChangedEvent] - 'network:pingdevice:Router' changed from INITIALIZING to ONLINE
2019-11-24 15:43:58.151 [me.event.ThingUpdatedEvent] - Thing 'network:pingdevice:Router' has been updated.
2019-11-24 15:43:58.162 [hingStatusInfoChangedEvent] - 'mqtt:topic:systemBroker:WirelessUnit01_Thing' changed from UNINITIALIZED to UNINITIALIZED (BRIDGE_UNINITIALIZED)
2019-11-24 15:43:58.166 [hingStatusInfoChangedEvent] - 'network:pingdevice:InternetConnection' changed from UNINITIALIZED to INITIALIZING
2019-11-24 15:43:58.268 [hingStatusInfoChangedEvent] - 'network:pingdevice:InternetConnection' changed from INITIALIZING to ONLINE
2019-11-24 15:43:58.276 [me.event.ThingUpdatedEvent] - Thing 'network:pingdevice:InternetConnection' has been updated.
2019-11-24 15:44:01.453 [vent.ItemStateChangedEvent] - InternetConnection changed from NULL to OFF
2019-11-24 15:44:01.476 [vent.ItemStateChangedEvent] - Router changed from NULL to OFF

no worries, this is what the forum is for, we’ll get this working and you (and others) will learn.

First, funny stuff happens when you restart. Due to the nature of how this application works, when you restart it, how stuff loads is not in a particular order and it usually takes a few minutes to stabilize. Unless you have a need to reboot the system don’t do it.

Second, every time you make a change to the rules file, watch the log and make sure the rules file successfully loaded and that there were no errors in the files. If your rules files loaded properly, as Ross said, you will see a message in the log. If there are errors in the rules file, you will see an entry about that telling you the file had errors and where the error is located in the file.

And lastly, every time you reload a rule file that has a timer in it, if you have recently tried to run the rule, the timer may well be running when you reload the rule. If that happens, problems ensue.Test with timers that run out quickly so not to strand running timers and wait a few minutes to let it run out first before reloading the rules file

good luck, just keep trying and we’ll get you going. This is a some what complex rule for a beginner but keep trying. The log you posted looks like it is everything starting up again. Let it run for a few minutes, then test your rule, then post both logs from just before you start your test

1 Like

I think this what is my problem
How can I delay the rule untill system stabilized ?

when
Item Router changed to OFF

There are some ways to do that but don’t worry about it right now.
Lets get this working.

can you answer this please

No I’m just restarting openhab via ssh
sudo systemctl restart openhab2.service
I actually turned the router off physically , and reboot
Led will help a lot to find the problem later

I’m emulating that scenario, My openhab just rebooted and the router is off