Dear all,
I have a problem with 2.3.0
My openhab works very well and suddenly it’s bug.
2018-08-14 09:07:44.359 [ERROR] [ab.binding.exec.internal.ExecBinding] - transformation throws exception [transformation=JS(parseEpson.js), response=]
org.openhab.core.transform.TransformationException: An error occurred while loading script.
at org.openhab.core.transform.TransformationHelper$TransformationServiceDelegate.transform(TransformationHelper.java:67) [222:org.openhab.core.compat1x:2.2.0]
and few days later :
2018-09-17 15:17:33.923 [ERROR] [ab.binding.exec.internal.ExecBinding] - transformation throws exception [transformation=JS(parseEpson.js), response=]
org.openhab.core.transform.TransformationException: An error occurred while loading script.
at org.openhab.core.transform.TransformationHelper$TransformationServiceDelegate.transform(TransformationHelper.java:67) [222:org.openhab.core.compat1x:2.2.0]
at org.openhab.binding.exec.internal.ExecBinding.transformResponse(ExecBinding.java:159) [225:org.openhab.binding.exec:1.11.0]
at org.openhab.binding.exec.internal.ExecBinding.execute(ExecBinding.java:128) [225:org.openhab.binding.exec:1.11.0]
at org.openhab.core.binding.AbstractActiveBinding$BindingActiveService.execute(AbstractActiveBinding.java:144) [222:org.openhab.core.compat1x:2.2.0]
at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:166) [222:org.openhab.core.compat1x:2.2.0]
Do you have any idea ?
Thanks a lot
edit
my json
// Wrap everything in a function
(function(i) {
//var array = i.split(i);
//return array[0].length;
if (input == 'video: muted\naudio: muted')
return "ON";
else if (input == 'on')
return "ON";
else
return "OFF";
})(input)
// input variable contains data passed by openhab
//JSON.parse(input).outputs[0].state;
In *.items, with my first openhab i don’t have %s, in my second openhab with the bug I have %s.
Maybe sometimes parse json do a bug with %s of the item ?
// Wrap everything in a function
(function(i) {
//var array = i.split(i);
//return array[0].length;
if (i == 'video: muted\naudio: muted')
return "ON";
else if (i == 'on')
return "ON";
else
return "OFF";
})(input)
// input variable contains data passed by openhab
//JSON.parse(input).outputs[0].state;
// Wrap everything in a function
(function(i) {
//var array = i.split(i);
//return array[0].length;
if (i === 'video: muted\naudio: muted')
return "ON";
else if (i === 'on')
return "ON";
else
return "OFF";
})(input)
// input variable contains data passed by openhab
//JSON.parse(input).outputs[0].state;
I try it, I will tell you in 10 days if I have the same problem. Very strange, each 10 days…
2018-10-01 07:58:45.251 [ERROR] [ab.binding.exec.internal.ExecBinding] - transformation throws exception [transformation=JS(parseEpson.js), response=]
org.openhab.core.transform.TransformationException: An error occurred while loading script.
I’m lost
I try to add try catch in my parse JSON : Do you think it’s right ?
// Wrap everything in a function
(function(i) {
//var array = i.split(i);
//return array[0].length;
if (i === 'video: muted\naudio: muted')
try {
return "ON";
} catch(e) {
alert(e);
}
else if (i === 'on')
try {
return "ON";
} catch(e) {
alert(e); // error in the above string (in this case, yes)!
}
else
try {
return "OFF";
} catch(e) {
alert(e); // error in the above string (in this case, yes)!
}
})(input)
// input variable contains data passed by openhab
//JSON.parse(input).outputs[0].state;
I have this bug with OH Build 2.2 and 2.2.0 Javascript Transformation and after with
2.3 and 2.3.0 Javascript Transformation. I can try but i’m not sure that it corrects the problem.
Maybe I will try to downgrade java runtime.
(function(i) {
if (i === 'on')
return "ON";
else if (i === 'off')
return "OFF";
})(input)
there is nothing in rules for this
all this “copy past” is the last version of my code, this code generate always the same error since the start
sometimes this error happen in 4 days, sometimes in 10 days.
2018-10-06 02:37:03.040 [ERROR] [ab.binding.exec.internal.ExecBinding] - transformation throws exception [transformation=JS(parseEpson.js), response=]
org.openhab.core.transform.TransformationException: An error occurred while loading script.
Since it happens intermittently, it could be that you have a time out and that would generate an error in the transformation.
Have you tried increasing the timeout to 10 seconds or maybe more?