openHAB 4.0 SNAPSHOT discussion

There actually are some significant changes caused by that move to Java 17.


Some of the changes I am aware of:

  • Java 17 is the base
  • Nashorn is no longer included and needs to be installed from the Marketplace
  • There’s a bug in the JS Scripting file watcher which requires Nashorn to be installed if you have file based JS Scripting files
  • There is no longer a JS transformation which has been replaced with a SCRIPT transformation which can use any rules language. This is part of core now, not separately installable.
  • The SCRIPT transform cannot be used from a Profile so if you have transform profiles that use JS, do not upgrade right now.

Just to report some level of success, 4.0.0 seems to work just fine inside of docker. Official image pulled about an hour ago. Build #3243 for reference. All bindings came up clean.

1 Like

Does that mean - at least today - one needs to install this from the Marketplace to continue using Blockly?

Yes, on the OH 4 snapshot right now that’s true. There is ongoing work to migrate it to JS Scripting but it’s still on Nashorn today.

Is Zwave among them? That can point to something unique in my config if it worked for you and not for me.

All good points.

TBF, SCRIPT transform is available in 3.4.0.

Can you point me to more context on this? jrubyscripting recently implemented its own script file watcher heavily based on the JS scripting one. I’m guessing it’s a Nashorn vs. JS issue, but I want to be sure.

Right, but you could still use the JS transform. Now the JS transform is gone. That’s my point. You have to use SCRIPT now.

I don’t know if there is an issue yet but see JS Scripting filewatcher in automation not working. I’m about a week behind in perusing the github issues. @J-N-K or @florian-h05 should be able to point you in the right direction.

Is inline SCRIPT transformation supported?

Can you define inline?

I’m successfully using it for the state description of an item:

Number:Angle Exterior_WindDirection "Wind Direction [SCRIPT(rb:compass.script):%s]" <wind> (gInflux)  { channel="mqtt:topic:jhatch:weather:winddirection" }


# -*- mode: ruby -*-
# frozen_string_literal: true

input ||= nil

if input.nil? || input == "NULL" || input == "UNDEF"
  cardinal = DIRECTIONS[(input.to_f / 45).round]
  "#{cardinal} (#{input.to_i}°)"

Inline script is where you don’t need to create a script file. Just write the script in the script declaration with a pipe character.

Obv only practical for super short one-liners

I’ve triggered some builds which could help with applying all dependency changes.
Maybe you can try again with 4.0.0-SNAPSHOT build # 3244?
If it does not yet fix your issue, posting some logging may help.

The snapshots are more unstable now than usual with all those changes. :face_with_diagonal_mouth:
But thanks to those who want to help out with testing and providing feedback with these first OH4 builds. :+1:

Will do but won’t get to it tomorrow unfortunately. Logs to follow when I give it a try.

Yep, that’s why I wanted to try it. But I expected to have more problems with Blockly and Nashorn rather than problems with Zwave. Thankfully jumping back and forth is super easy.

That was only supported by the JS transform so I’d guess almost certainly this is not (ever?) supported. SCRIPT is also not supported in Profiles yet.

But, it does support passing additional arguments to the transform using standard URL style which is a huge boon. This opens the possibility of more generic transformation scripts.

1 Like

No, my zwave is on a remote openhab running 3.4 still. Sorry.

It’s telling you to install Java 17. :wink:

I discovered that issue some time ago, @J-N-K explained it here and is also working on a solution: in core Refactor WatchService by J-N-K · Pull Request #3004 · openhab/openhab-core · GitHub and for the addons Adapt addons to core watch service changes by J-N-K · Pull Request #14004 · openhab/openhab-addons · GitHub.
@ccutrer I haven‘t had a closer look at the addon PR yet, but it seems like a fix for JRubyScripting is also part of it.

I‘ve already migrated my JS transformations to SCRIPT, but currently inline scripts and a transformation profile for Items are missing. I can try to ping you when there are PRs for those, but I cannot promise to not forget :wink:

I know what you mean, like JS transform is providing it at the moment.
This is not supported yet, but @J-N-K said that it is not too difficult to add that.

1 Like

@JimT @florian-h05 I created an issue for the inline scripting. It’s not top priority, but I hope to be able to provide a PR latest around new year.


I upgraded to OH 4 #3245 right now and have no problem with zwave.


Note that if you use JDBC MySQL persistence, it’s currently broken (as of 21 Dec). Will be fixed shortly as soon as the mysql connector artifact is uploaded to jfrog.

Just spun up #3245 and Zwave is all good now.


However, I’m still seeing the “ScriptEngine for language ‘application/javascript’ could not be found…”.

After the first clean boot I installed the Nashorn add-on from the marketplace. Despite the errors during boot, the rules appear to work. There might be a race condition where rules are loaded before the add-on is loaded perhaps?

1 Like

I’m currently working on improving the script file watcher to solve the Nashorn missing issue.


Is there a roadmap for 4.0 anywhere?
Great work btw, I jumped into OpenHAB at v3 and it’s been super stable and seems to be having a lot of work done towards making things easier for the end user.