Intermittant Rule Issue

I have a rule that sets color for Hue lights. One minute it works, the next it doesn’t. The error in the log:

“Error during the execution of rule ‘Color Scenes’: Script interpreter couldn’t be obtain”

Items:
Group gHueColor
Color BedroomLampGuest_C “Bedroom Guest Color” (gHueColor) {channel=“hue:LCT007:001788252018:2:color”}
Color BedroomLampBL_C “Bedroom BL Color” (gHueColor) {channel=“hue:LCT007:001788252018:1:color”}
Number vHueColorScene

The rule:

rule “Color Scenes”
when
Item vHueColorScene received command
then

    var PercentType sat1 = new PercentType(100) 
    var PercentType bright1 = new PercentType(50)
    var DecimalType hue1 = new DecimalType(90) 
    var hsbSet1 = new HSBType(hue1,sat1,bright1)   
    
    /* green */
    if(receivedCommand==1) {
        hsbSet1.hue = 120            
        sendCommand(gHueColor, hsbSet1);
    {
    /*blue*/
    else if(receivedCommand==2)  {
        hsbSet1.hue = 240  
        sendCommand(gHueColor, hsbSet1);
    }

end

Help please! What does that error mean?

Seems to be a known issue. See here and here.

Thanks. More info, this is not the only rule I have gotten this error with. It happened with couple of rules I was playing with last night. What was common between them? They were the only rules that involved the Hue Binding. I posted here about some Hue issue https://community.openhab.org/t/oh2-hue-binding-white-vs-color-mode-issues/11634/2. I concluded it was me, but now I am changing my mind. The brightness “sync” issue I mentioned came back today. Right now, nothing is working, all the Hue Things are hanging on “INITIALIZING”. Not the first time I have seen that. They are all working fine in the default Hue Android app.

If I were to take a guess: The “Script interpreter couldn’t be obtain” is an unhandled exception. In my case, it’s steming from the Hue Binding…but just a guess :slight_smile:

I just tried firing some rules with the Hue Items while they are sitting in the “INITIALIZING” state. “Script interpreter couldn’t be obtain” every time, not intermittent anymore. Insteon rules run just fine.

Ok, I need to let anyone know who has come across this post that my issues have NOTHING to do with the Hue Binding, it’s an issue with Rules in general.

In my case, if I have a mistake in the Rule code, even a simple syntax error, sometimes I get a informative error in the log, but a lot of times I get “Script interpreter couldn’t be obtain”. Here is the part that drove me nuts for the last two days, once you see that in the log, you MUST restart OH. Even after you fix the error, you will get “Script interpreter couldn’t be obtain” every time you try to run that Rule, but only that rule. All other rules will run fine.

A note to all this: There may be some Hue binding issues. I have seen the Hue Things definitely have been hung on “INITIALIZING” a couple of times. I also find that if you connect the color picker directly to a Hue Item Color channel, the bulbs don’t also respond properly.

It’s worse then I thought, It’s just seems random at this point. OH2 is pretty much unusable for me. I took the posts that @dominicdesu mentioned. The discussion over there is above my head at this point. Any suggestions @Kai?

I spent quite some time today to reproduce those rule startup issues, but I was only partially successful, see my comment here.

That issue isn’t exactly about “Script interpreter couldn’t be obtain” though. If you have a VERY basic rule, which makes your error appear (at least in some cases), please enter another issue at https://github.com/eclipse/smarthome/issues.
If you can even make it appear on a PC/Mac and not just on a RasPi, it would be even better for getting it analyzed.

Hi Kai, @Kai
I have the same problem, i posted on
https://github.com/eclipse/smarthome/issues/1393.

My script is very very easy.

“For the first day it was working, then they give this error.” -> This does not sounds too easy to reproduce then… Is there any way to force it happening?

Hi @Kai, thank you for your reply.

  • tryed reboot
  • tryed rename file of rule
  • tryed to delete the code Inside the rule
  • tryed to delete all the code --> Strange ( the error was always the same…)
  • tryed to delete the file
  • reboot
    -> Here the error is gone ( but my rules too :slight_smile: )
  • tryed to create the rule another time (the coded posted that give the error)
    -> at first time nothing was wrote on log(like… all ok), but nothing happen. I checked the variable VoiceCommand was updated
    after some change of code
    -> 2016-09-04 18:18:22.053 [ERROR] [.script.engine.ScriptExecutionThread] - Rule ‘Voice’: Script interpreter couldn’t be obtain

Ok, I try to chnge the name of the rule in “testVoice”, but error is still
2016-09-04 18:21:58.679 [ERROR] [.script.engine.ScriptExecutionThread] - Rule ‘Voice’: Script interpreter couldn’t be obtain

-> Strange, the rule has another name now…

this is my test.items
Number Scena “Scena”
String VoiceCommand

Then, with new Rule v2.0 I trigger the Scena value and I turn on my hue…
:frowning: sigh was working and for me was enough

Seem that the rule is saved on memory and when you update the rule something happen… :slight_smile: When a rule is updated, the old one is still in memory?

It shouldn’t. If it does, it is a bug worth to be reported!

I have the same problem - and my rules are breaking in the same way and I can’t find the system in this one… but yes I have had the same though that something happens when you update the rule…

When I reboot to will work for some time - but I dont need to modify my rules for it to break after being run a few time…

if after I reboot from command line add a file Activity.rules with this content

"rule "ActivityOutsideTSNearby"
when
Item TSiPhone changed to ON
then

		sendCommand(AlarmActiveOutside, OFF)
		sendCommand(AlarmActiveInside, OFF)

end

rule "ActivityOutsidePRNearby"
when
Item PRiPhone changed to ON
then

		sendCommand(AlarmActiveOutside, OFF)
		sendCommand(AlarmActiveInside, OFF)

end

rule "ActivityOutsideCheckiPhoneLocation"
when
Item TSiPhoneLocation changed or PRiPhoneLocation changed
then
if ((TSiPhoneLocation.state > 0) && (PRiPhoneLocation.state > 0)) {
if(TSiPhone.state != ON && PRiPhone.state != ON) {
sendCommand(AlarmActiveOutside, ON)
sendCommand(AlarmActiveInside, ON)
}
}
end

rule “ActivityOutsideNotifyAlarmISOn”

when
	Item AlarmActiveInside changed to ON
then
	sendBroadcastNotification("Alarm on")

end

rule “ActivityOutsideNotifyAlarmISOff”

when
	Item AlarmActiveInside changed to OFF
then
	sendBroadcastNotification("Alarm off")

end
"

2016-09-04 20:59:14.162 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'Activity.rules’
2016-09-04 20:59:14.349 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'Activity.rules’
2016-09-04 20:59:36.379 [ERROR] [alization.ZWaveNodeInitStageAdvancer] - NODE 5: Node advancer: Retries exceeded at STATIC_VALUES

Then I test and everything is working…

2016-09-04 20:59:40.026 [INFO ] [del.script.PingBluetooth_ts_NOT_home] - 2016-09-04 20:59:40
2016-09-04 21:00:00.030 [INFO ] [e.model.script.PingBluetooth_ts_home] - 2016-09-04 21:00:00
2016-09-04 21:00:20.019 [INFO ] [del.script.PingBluetooth_ts_NOT_home] - 2016-09-04 21:00:20
2016-09-04 21:00:30.031 [INFO ] [del.script.PingBluetooth_pr_NOT_home] - 2016-09-04 21:00:30
2016-09-04 21:01:00.243 [ERROR] [alization.ZWaveNodeInitStageAdvancer] - NODE 5: Node advancer: Retries exceeded at STATIC_VALUES
2016-09-04 21:02:00.021 [INFO ] [e.model.script.PingBluetooth_ts_home] - 2016-09-04 21:02:00

I then from command line add an item file FibaroMotionSensor.items

with this content
"Group MotionSensors “Entre” (Security)
Switch Motion_Sensor_Motion “Motion detected in entre [%s]” (MotionSensors) { channel=“zwave:device:43fabe5f:node3:sensor_binary” }
Number Motion_Sensor_battery “Motion sensor entre battery [%s %%]” (MotionSensors) { channel=“zwave:device:43fabe5f:node3:battery-level” }
Number Motion_Sensor_temp “Entre temperature [%.1f C]” (MotionSensors) { channel=“zwave:device:43fabe5f:node3:sensor_temperature” }
Number Motion_Sensor_lux “Entre lux [%.1f]” (MotionSensors) { channel=“zwave:device:43fabe5f:node3:sensor_luminance” }
"

2016-09-04 21:02:26.457 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'FibaroMotionSensor.items’
2016-09-04 21:02:26.503 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model ‘FibaroMotionSensor.items’

Then I test and it breaks …

2016-09-04 21:02:30.916 [INFO ] [.model.script.PingBluetooth_pr__home] - 2016-09-04 21:02:30
2016-09-04 21:02:37.765 [ERROR] [.script.engine.ScriptExecutionThread] - Rule ‘ActivityOutsideNotifyAlarmISOn’: Script interpreter couldn’t be obtain

Perfect Thomas,
Try to rename your rule name and see if the error contain the old name of the rule (This is the main proof).
I try to read classes org.eclipse.smarthome.model.script but it’s too much without undestand the structure :stuck_out_tongue:

@Kai : I create the issue on https://github.com/eclipse/smarthome/issues/2117

1 Like

I changed the name of the rule to “ActivityOutsideNotifyAlarmISOnTest” saved and testet - and yes it is the old rule name. I am not sure if this is the entire scope of the bug - but its at start :slight_smile:

2016-09-04 21:37:52.347 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model ‘Activity.rules’
2016-09-04 21:38:00.052 [INFO ] [e.model.script.PingBluetooth_ts_home] - 2016-09-04 21:38:00
2016-09-04 21:38:02.021 [ERROR] [.script.engine.ScriptExecutionThread] - Rule ‘ActivityOutsideTSNearby’: Script interpreter couldn’t be obtain
2016-09-04 21:38:02.368 [ERROR] [.script.engine.ScriptExecutionThread] - Rule ‘ActivityOutsideNotifyAlarmISOn’: Script interpreter couldn’t be obtain

My system is a Pi3 with an OpenHAB build downloaded today

Ok guys, I have spent quite some time today to look into this and I very much hope that I have found a solution with this PR. I’ll make sure that this flows to the openHAB distro in the next days, so you can test it.

1 Like

Actually already today: Voilà, Build #469 contains the fix - please go and test it, thanks!

Build #469 fixes the issues for me with the rules. Only been running for an hour or so but no errors so far for some astro rules calculating if its dark/ligth outdoors and for a rule triggering when a master switch is updated.