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”
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
})(input)
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.
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.
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.
@dk8pn
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
FAILED
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:
openhab2
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: 35.231.52.82 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: 35.231.52.82 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 8.46.0.225-CA-linux_aarch32hf) (build 1.8.0_252-b225)
OpenJDK Client VM (Zulu 8.46.0.225-CA-linux_aarch32hf) (build 25.252-b225, mixed mode, Evaluation)
OK
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 ;)