JS Transformation stopped working after upgrade to 2.5.6 snapshot #131

Ran snapshot #111 (v2.5.5) and JS transformation within a sitemap item label. Worked always fine.
After upgrading to 2.5.6, snapshot #131, this stopped working. A sitemap failure is not shown. But if i choose the group with the irem label containing the JS transformation, this Group doesn’t open. Openhab log file shows some errors with “JS Transformation helper”

Has anybody an idea what i could do?

Best regards,


Can you tell us what you expected, and what you see instead?

And, may we see this?

My sitemap item is:

Text item=WassermesserSensor_1_GasEnergyCounter label=“Wasserzähler Stand [JS(Wasseruhr_offset.js):%s]” icon=“wasserzaehler”

My JS file adds the watermeter offset to the actual water counter value and the unit m3. This worked out fine with snapshot #111 (the last i had running).

Here is the JS file:

(function(i) {
var scale = " m3"; //workaround for display of the unit m3
var total = parseFloat(i) + 623.162; //sum of the water meter offset and the HomeMatic counter
var new_total = total.toFixed(3); //limits the digits after the dot to 3
return new_total.replace(’.’, ‘,’) + scale; //replaces dot by comma and adds the unit m3

The error log shows:

2020-05-28 23:51:09.058 [ERROR] [b.core.service.AbstractActiveService] - Error while executing background thread HTTP Refresh Service
java.lang.NullPointerException: null
at org.openhab.transform.javascript.internal.JavaScriptEngineManager.getScript(JavaScriptEngineManager.java:68) ~[?:?]
at org.openhab.transform.javascript.internal.JavaScriptTransformationService.transform(JavaScriptTransformationService.java:74) ~[?:?]
at org.openhab.core.transform.TransformationHelper$TransformationServiceDelegate.transform(TransformationHelper.java:69) ~[bundleFile:?]
at org.openhab.binding.http.internal.HttpBinding.execute(HttpBinding.java:218) ~[?:?]
at org.openhab.core.binding.AbstractActiveBinding$BindingActiveService.execute(AbstractActiveBinding.java:146) ~[bundleFile:?]
at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:169) [bundleFile:?]

For snapshot #111 and enabled sitemap line item as above the output is e.g.: 629,632 m3
For snapshot #131, i need to disable the sitemap line item in order to make at least the other members of the group working. With enabled item, the whole Group doesn’t open.

Hope that this Information helps?

Do you have any hint for me what is going wrong?

I don’t know what might have changed with the javascript engine.

I think I would force the number to string before doing string operations to it, just in case.
return new_total.toString().replace(’.’, ‘,’) + scale;

Have you other JS transforms still working?

Thanks for your hints. Tried it with latest snapshot #139 but it doesn’t help. Other JS transformations (e.g. devide by 100 or 1000) work as usual. Thus, i also believe that JS syntax violations might be the root cause. But i am not an expert on this.

Or it has something to do with execution of JS transfrom from the sitemap item label? Other JS transforms which i run are from items file.

I faced the same issue after upgrading to 2.5.6 build #139 on javascript transform. I used the somewhere else referenced on this forum windrose.js that now generate the same NPE.

This one?

If used as suggested, that is in the label [state presentation] field as well.
Perhaps that is the common factor.

Bear in mind snapshots are intended to shake out bugs, so thanks for reporting!
As this post doesn’t seem to have attracted developer attention, I suggest creating a Github issue for this.

yes, this one, used in a transformation profile.

Okay, so in a channel profile, not a [state presentation]. Two different environments, something more fundamental.

Have created an issue in Github. https://github.com/openhab/openhab-addons/issues/7880
Hope that i did it right because i am not trained on this :-).

@glhopital @dk8pn would you guys report host operating system and Java version please? It’s likely to be relevant for a JS problem.

Ubuntu 19.04
openjdk version “1.8.0_252”
OpenJDK Runtime Environment (Zulu (build 1.8.0_252-b14)
OpenJDK 64-Bit Server VM (Zulu (build 25.252-b14, mixed mode)

Windows10 64bit, Java 1.8.0_251

IMHO I’m on the same error ([Transformation JavaScript] Getting an error after moving to openHAB 2.5.6~S147-1 (Build #147))
RasPI 3B / openHABian installation

 openjdk version "1.8.0_252"
OpenJDK Runtime Environment (Zulu (build 1.8.0_252-b225)
OpenJDK Client VM (Zulu (build 25.252-b225, mixed mode, Evaluation)

Additionally this topic is also caused by a JavaScript failure.

Same error here:
RasPI 3B / openHABian installation

 openjdk version "1.8.0_252"
OpenJDK Runtime Environment (Zulu (build 1.8.0_252-b225)
OpenJDK Client VM (Zulu (build 25.252-b225, mixed mode, Eva

Issue has been rectified now and openHAB 2.5.7 snapshot #152 works out again. Thanks a lot!

Thanks for the report. How did you do the update? I just tried it via openhabian-config option 02, but that failed

2020-06-22_14:03:22_CEST [openHABian] Switching to branch  ... fatal: empty string is not a valid pathspec. please use . instead if you meant to match all paths
2020-06-22_14:03:30_CEST [openHABian] Updating Linux package information ...
2020-06-22_14:03:30_CEST [openHABian] Updating repositories and upgrading installed packages...
$ apt-get --yes upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
  rpi-eeprom-images triggerhappy
Use 'sudo apt autoremove' to remove them.
The following packages have been kept back:
  binutils binutils-arm-linux-gnueabihf binutils-common libbinutils
The following packages will be upgraded:
1 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.
Need to get 83.0 MB of archives.
After this operation, 6,144 B disk space will be freed.
Err:1 https://openhab.jfrog.io/openhab/openhab-linuxpkg unstable/main armhf openhab2 all 2.5.6-1
  Unknown date format Bad header data [IP: 443]
E: Failed to fetch https://openhab.jfrog.io/openhab/openhab-linuxpkg/pool/main/2.5.6/openhab2_2.5.6-1_all.deb  Unknown date format Bad header data [IP: 443]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

$ java_install_or_update

$ java_zulu_update_available Zulu8-32

$ java -version
openjdk version "1.8.0_252"
OpenJDK Runtime Environment (Zulu (build 1.8.0_252-b225)
OpenJDK Client VM (Zulu (build 25.252-b225, mixed mode, Evaluation)
2020-06-22_14:04:09_CEST [openHABian] Checking for default openHABian username:password combination... OK
2020-06-22_14:04:10_CEST [openHABian] We hope you got what you came for! See you again soon ;)

Use option 3 and check for latest OH version, which is 2.5.6-2 meanwhile. This one will download 83 MB and gets installed afterwards

Updated also to 2.5.6-2, issue is fixed.

Thanks a lot