openHAB 4.0 SNAPSHOT discussion

Hi,
Yeah, I appreciate it is in early stages, but I’ve been using the snapshots to ensure I get some of the newer fixes, as opposed to the latest stable/milestone releases.
I think i’ve got the JS Transform and JSON transform confused - I presume the JSON Transform is still in use?
I didn’t intend for it to come across as “rude” - I think my confusion of JS and JSON transform made it not make sense to me :frowning: Sorry
On further investigation it turned out that one of my Tasmota devices was misbehaving - rebooted it to resolve the JSONPATH error.

Thanks,
Richie

Yes.

When using the snapshots there is no guarantee that they will work from day to day. You must always be willing to spend some time investigating when things go wrong (and filing issues where appropriate) and backing out an upgrade as necessary. This is always true but even more so when OH switches to a new major release (i.e. from 3.x to 4.x). The snapshots are going to be a bit rough over the next few months and there will be breaking changes along the way.

Hi,
Thanks for replying.
I think I’d not been expecting a 4.0 release (I’ve not had a lot of time recently to focus on the community).
My own fault for just thinking there’d be a latest 3.4 snapshot that wouldn’t have major changes.
I’ve got it installed and working now, but will be a bit more careful before installing the next few.

Thanks,
Richie

FYI: If you want to use the SCRIPT Transformation with JS, the docs are here: GitHub - openhab/openhab-js: openHAB JavaScript Library for JavaScript Scripting Automation.

I wonder why they aren’t on the openHAB Addons website, seems like we are missing docs updates for the 3.4.0 release @Confectrician.

23 posts were split to a new topic: OH4 on buster

It comes from add-ons. dbquery, influxdb and watsonstt declare a dependency to 2.8.x. This should be fixed in add-ons (preferably by using the one provided from core).

1 Like

:+1:

Does it makes sense to open an issue for these addons then to let the owners know that this need to be done? How is this usually handled? Do the codeowners have to take care of that?

None of these I have actually installed or it is telling me because it didn’t startup correctly.

i DO know, that my backup which I restored contains INFLUXDB.
Therefore I removed influxdb in /srv/openhab-userdata/config/org/openhab/addons.config

Note that I also did a clean-cache before the restart.

and now it is starting up!

Btw, I found another one that uses gson 2.9.0 : org.openhab.binding.bluetooth.generic

UPDATE:

Unfortunately it gets further but I still have the following errors in the log

2022-12-26 23:28:00.177 [ERROR] [ipt.internal.ScriptEngineManagerImpl] - ScriptEngine for language 'application/javascript' could not be found for identifier: fb6c8e18-252f-4e8c-9f06-882824c744a7

2022-12-26 23:28:00.223 [ERROR] [ipt.internal.ScriptEngineManagerImpl] - ScriptEngine for language 'application/javascript' could not be found for identifier: 97ee8cff-60f2-49ca-a99f-437beb9d39dd

2022-12-26 23:28:05.807 [ERROR] [core.karaf.internal.FeatureInstaller] - Failed installing 'openhab-package-standard': Error:

	Error downloading mvn:com.google.code.gson/gson/2.8.9

2022-12-26 23:28:07.264 [ERROR] [core.karaf.internal.FeatureInstaller] - Failed installing 'openhab-binding-hue, openhab-persistence-mapdb, openhab-binding-deconz, openhab-misc-openhabcloud, openhab-binding-network, openhab-ui-habpanel, openhab-binding-nanoleaf, openhab-binding-jeelink, openhab-automation-jsscripting, openhab-binding-shelly, openhab-binding-chromecast, openhab-binding-mqtt, openhab-transformation-map, openhab-binding-ipcamera, openhab-binding-lgwebos, openhab-binding-systeminfo, openhab-binding-icalendar, openhab-binding-mail, openhab-voice-googletts, openhab-transformation-regex, openhab-binding-yamahareceiver, openhab-transformation-jsonpath, openhab-binding-homeconnect, openhab-binding-zwave, openhab-persistence-rrd4j, openhab-ui-basic, openhab-binding-ntp, openhab-binding-openweathermap, openhab-binding-gardena, openhab-binding-http, openhab-binding-astro, openhab-binding-unifi, openhab-binding-squeezebox, openhab-binding-gpstracker, openhab-binding-onkyo': Error:

	Error downloading mvn:com.google.code.gson/gson/2.8.9

2022-12-26 23:28:08.503 [ERROR] [core.karaf.internal.FeatureInstaller] - Failed to refresh bundles after processing config update

org.apache.karaf.features.internal.util.MultiException: Error:

	Error downloading mvn:com.google.code.gson/gson/2.8.9

	at org.apache.karaf.features.internal.download.impl.MavenDownloadManager$MavenDownloader.<init>(MavenDownloadManager.java:91) ~[?:?]

I installed the NASHORN addon and at least "ScriptEngine for language ‘application/javascript’ could not be found " has gone away.

I’ve been away from screens for a few days.

It looks like you have the Buster issue taken care of for the most part. At least you are on the latest base OS and are sorting out missing dependencies which is progress.

See above. This is know and a fix is in work. You should only see those during startup and you’ll have to run your start level triggered rules manually until the PR gets merged. There is a timing issue where the rules are trying to load before Nashorn is ready.

But after the boot the rules will work as expected.

1 Like

But still there are issues:

gson needs to be fixed for these addons

→ Should I create an issue for that and ping the code owners or how should this be handled?

And why isn’t it not loading the bundles even though none of the bundles is related to gson 2.8.9?

At least create the issue. I don’t know if it’s best to create one global issue or one for each add-on. Probably one global issue on the openhab-addons repo.

:person_shrugging: I don’t know how all these dependency things are managed in OH that well. But often when it can’t install just one add-on it won’t install any add-ons.

Ok, done

Upgraded to the newest snapshot and the first boot was a little odd.

First I got a lot of warnings that my ItemStateTriggers and ItemStateConditions won’t work because the Items do not exist followed by corresponding INFO level messages saying the Item was added and they will now work.

Following that, my events.log remained empty of all Item events though I could see they were updating because I have my rule events logged to events.log and I could see the rules triggering.

A restart returned everything to normal.

I’m guessing there was a delay in startup caused by the steps taken during an upgrade which caused the rules to be loaded before the Items were loaded.

It’s not a problem as far as I can tell, I’m just reporting this for those who may see the same thing.

This is known and it is worked on, see Prevent executing (almost) all rules until start level 50 is reached · Issue #3073 · openhab/openhab-core · GitHub.

2 Likes

That’s a different issue. The message is printed during rule creation if the item is not available. This has nothing to do with the execution of a rule.

I’m going to watch it but I suspect the changes you have going on for the many rule startup issues will fix this problem as well.

I did my weekly update and all all my JS Scripting rules are failing complaining that “log” and “items” doesn’t exist.

I tried importing them with a requires explicitly with no luck. It complained that the library didn’t exist.

So I installed the latest using npm. It’s no longer complaining about the requires nor about log not existing but it is still insisting that items doesn’t exist. Weird.

The settings on the add-on still have “Use built in variables” selected as well as “Use included library” selected (that one’s new right?).

Based on a comment on another thread I even cloned the repo and pulled over the latest from “main”. No change.

I’m still experimenting but would love to know if I’ve missed something in the PRs.

UPDATE 1:

I went back to a clean slate. I uninstalled openhab-js from node_modules.
First I went to the JavaScript Scripting add-on settings and changed the selections there top not use the library and variables, saved, and then changed it back and saved just in case the new(?) setting to use the library defaulted to off or something.

Returned to my rules (disabled a few of the noisier ones) and the errors persist.

Here’s the log I get when I try to require openhab when it’s not separately installed.

hI│2023-01-03 10:49:33.879 [ERROR] [b.automation.script.javascript.stack] - Failed to execute script:                                                                      │
  │org.graalvm.polyglot.PolyglotException: TypeError: Cannot load CommonJS module: 'openhab'                                                                               │
  │        at com.oracle.truffle.polyglot.PolyglotMapAndFunction.apply(PolyglotMapAndFunction.java:46) ~[?:?]                                                              │
  │        at org.openhab.automation.jsscripting.internal.OpenhabGraalJSScriptEngine.lambda$7(OpenhabGraalJSScriptEngine.java:251) ~[?:?]                                  │
  │        at java.util.Optional.orElseGet(Optional.java:364) ~[?:?]                                                                                                       │
  │        at org.openhab.automation.jsscripting.internal.OpenhabGraalJSScriptEngine.lambda$5(OpenhabGraalJSScriptEngine.java:251) ~[?:?]                                  │
  │        at <js>.:program(<eval>:1) ~[?:?]                                                                                                                               │
  │        at org.graalvm.polyglot.Context.eval(Context.java:399) ~[?:?]                                                                                                   │
  │        at com.oracle.truffle.js.scriptengine.GraalJSScriptEngine.eval(GraalJSScriptEngine.java:458) ~[?:?]                                                             │
  │        at com.oracle.truffle.js.scriptengine.GraalJSScriptEngine.eval(GraalJSScriptEngine.java:426) ~[?:?]                                                             │
  │        at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:262) ~[java.scripting:?]                                                                    │
20│        at org.openhab.automation.jsscripting.internal.scriptengine.DelegatingScriptEngineWithInvocableAndAutocloseable.eval(DelegatingScriptEngineWithInvocableAndAutoc│ined│loseable.java:53) ~[?:?]                                                                                                                                                │
00│        at org.openhab.automation.jsscripting.internal.scriptengine.InvocationInterceptingScriptEngineWithInvocableAndAutoCloseable.eval(InvocationInterceptingScriptEng│4320│ineWithInvocableAndAutoCloseable.java:78) ~[?:?]                                                                                                                        │  20│        at org.openhab.automation.jsscripting.internal.scriptengine.DelegatingScriptEngineWithInvocableAndAutocloseable.eval(DelegatingScriptEngineWithInvocableAndAutoc│ Sto│loseable.java:53) ~[?:?]                                                                                                                                                │
20│        at org.openhab.automation.jsscripting.internal.scriptengine.InvocationInterceptingScriptEngineWithInvocableAndAutoCloseable.eval(InvocationInterceptingScriptEng│ Sna│ineWithInvocableAndAutoCloseable.java:78) ~[?:?]                                                                                                                        │
20│        at org.openhab.core.automation.module.script.internal.handler.ScriptActionHandler.lambda$0(ScriptActionHandler.java:71) ~[?:?]                                  │ Sto│        at java.util.Optional.ifPresent(Optional.java:178) ~[?:?]                                                                                                       │
20│        at org.openhab.core.automation.module.script.internal.handler.ScriptActionHandler.execute(ScriptActionHandler.java:68) ~[?:?]                                   │
20│        at org.openhab.core.automation.internal.RuleEngineImpl.executeActions(RuleEngineImpl.java:1180) ~[?:?]                                                          │ Sna│        at org.openhab.core.automation.internal.RuleEngineImpl.runNow(RuleEngineImpl.java:1031) ~[?:?]                                                                  │
20│        at org.openhab.core.automation.rest.internal.RuleResource.runNow(RuleResource.java:328) ~[?:?]                                                                  │ Sto│        at org.openhab.core.automation.rest.internal.RuleResource.runNow(RuleResource.java:342) ~[?:?]                                                                  │
20│        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]                                                                                  │
20│        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]                                                                │ Sna│        at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]                                                        │
20│        at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]                                                                                                      │  20│        at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:179) ~[bundleFile:3.4.5]                                               │
20│        at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96) ~[bundleFile:3.4.5]
hI│        at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:201) ~[bundleFile:3.4.5]                                                                          │
  │        at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:104) ~[bundleFile:3.4.5]                                                                          │ab
le│        at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59) ~[bundleFile:3.4.5]                                            │
  │        at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96) ~[bundleFile:3.4.5]                                    │ithI│        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308) ~[bundleFile:3.4.5]                                                   │
  │        at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) ~[bundleFile:3.4.5]                                             │
  │        at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:265) ~[bundleFile:3.4.5]                                           │
  │        at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234) ~[bundleFile:3.4.5]                                         │
  │        at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208) ~[bundleFile:3.4.5]                                                    │
  │        at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160) ~[bundleFile:3.4.5]                                                    │
  │        at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:225) ~[bundleFile:3.4.5]                                                │
  │        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:298) ~[bundleFile:3.4.5]                                         │
  │        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:217) ~[bundleFile:3.4.5]                                                │
  │        at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) ~[bundleFile:3.1.0]                                                                             │
  │        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:273) ~[bundleFile:3.4.5]                                               │
20│        at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799) ~[bundleFile:9.4.46.v20220331]                                                        │ined│        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:550) ~[bundleFile:9.4.46.v20220331]                                                    │
00│        at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:74) ~[bundleFile:?]                               │1120│        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) ~[bundleFile:9.4.46.v20220331]                                                 │ Sto│        at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:600) ~[bundleFile:9.4.46.v20220331]                                                   │
20│        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) ~[bundleFile:9.4.46.v20220331]                                               │ Sna│        at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235) ~[bundleFile:9.4.46.v20220331]                                             │
20│        at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624) ~[bundleFile:9.4.46.v20220331]                                            │
20│        at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233) ~[bundleFile:9.4.46.v20220331]                                             │
20│        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1440) ~[bundleFile:9.4.46.v20220331]                                            │  20│        at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:294) ~[bundleFile:?]                                            │  20│        at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188) ~[bundleFile:9.4.46.v20220331]                                              │ Sto│        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:501) ~[bundleFile:9.4.46.v20220331]                                                     │
20│        at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594) ~[bundleFile:9.4.46.v20220331]                                             │ Sna│        at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186) ~[bundleFile:9.4.46.v20220331]                                              │
20│        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1355) ~[bundleFile:9.4.46.v20220331]                                             │
20│        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) ~[bundleFile:9.4.46.v20220331]                                                 │
20│        at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:90) ~[bundleFile:?]                           │ Sto│        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) ~[bundleFile:9.4.46.v20220331]                                               │
20│        at org.eclipse.jetty.server.Server.handle(Server.java:516) ~[bundleFile:9.4.46.v20220331]                                                                       │ Sna│        at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:487) ~[bundleFile:9.4.46.v20220331]
hI│        at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:732) [bundleFile:9.4.46.v20220331]                                                            │
  │        at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:479) [bundleFile:9.4.46.v20220331]                                                              │able│        at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277) [bundleFile:9.4.46.v20220331]                                                    │
  │        at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311) [bundleFile:9.4.46.v20220331]                                    │ithI│        at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105) [bundleFile:9.4.46.v20220331]                                                              │
  │        at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104) [bundleFile:9.4.46.v20220331]                                                           │
  │        at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338) [bundleFile:9.4.46.v20220331]                                         │
  │        at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315) [bundleFile:9.4.46.v20220331]                                       │
  │        at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173) [bundleFile:9.4.46.v20220331]                                      │
  │        at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131) [bundleFile:9.4.46.v20220331]                                             │
  │        at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:409) [bundleFile:9.4.46.v20220331]                       │
  │        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883) [bundleFile:9.4.46.v20220331]                                               │
  │        at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034) [bundleFile:9.4.46.v20220331]                                          │
  │        at java.lang.Thread.run(Thread.java:833) [?:?]                                                                                                                  │
  │2023-01-03 10:49:33.887 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID 'humidifiers' failed: org.graalvm.polyglot.PolyglotException:│
20│ TypeError: Cannot load CommonJS module: 'openhab'                                  

Sorry for the weird artifacts, my logs are scrolling fast so I’m grabbing this from a raw multitail screen.

An example “not defined” exception:

  │2023-01-03 10:49:39.269 [ERROR] [b.automation.script.javascript.stack] - Failed to execute script:                                                                      │
  │org.graalvm.polyglot.PolyglotException: ReferenceError: "items" is not defined                                                                                          │
  │        at <js>.:program(<eval>:1) ~[?:?]                                                                                                                               │
  │        at org.graalvm.polyglot.Context.eval(Context.java:399) ~[?:?]                                                                                                   │
  │        at com.oracle.truffle.js.scriptengine.GraalJSScriptEngine.eval(GraalJSScriptEngine.java:458) ~[?:?]                                                             │
  │        at com.oracle.truffle.js.scriptengine.GraalJSScriptEngine.eval(GraalJSScriptEngine.java:426) ~[?:?]                                                             │
20│        at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:262) ~[java.scripting:?]                                                                    │ined│        at org.openhab.automation.jsscripting.internal.scriptengine.DelegatingScriptEngineWithInvocableAndAutocloseable.eval(DelegatingScriptEngineWithInvocableAndAutoc│
00│e.java:53) ~[bundleFile:?]                                                                                                                                              │46to│        at org.openhab.automation.jsscripting.internal.scriptengine.InvocationInterceptingScriptEngineWithInvocableAndAutoCloseable.eval(InvocationInterceptingScriptEng│
20│InvocableAndAutoCloseable.java:78) ~[bundleFile:?]                                                                                                                      │ Sna│        at org.openhab.automation.jsscripting.internal.scriptengine.DelegatingScriptEngineWithInvocableAndAutocloseable.eval(DelegatingScriptEngineWithInvocableAndAutoc│
20│e.java:53) ~[bundleFile:?]                                                                                                                                              │  20│        at org.openhab.automation.jsscripting.internal.scriptengine.InvocationInterceptingScriptEngineWithInvocableAndAutoCloseable.eval(InvocationInterceptingScriptEng│
20│InvocableAndAutoCloseable.java:78) [bundleFile:?]                                                                                                                       │  20│        at org.openhab.core.automation.module.script.internal.handler.ScriptConditionHandler.isSatisfied(ScriptConditionHandler.java:54) [bundleFile:?]                 │
20│        at org.openhab.core.automation.internal.RuleEngineImpl.calculateConditions(RuleEngineImpl.java:1150) [bundleFile:?]                                             │
20│        at org.openhab.core.automation.internal.RuleEngineImpl.runRule(RuleEngineImpl.java:987) [bundleFile:?]                                                          │  20│        at org.openhab.core.automation.internal.TriggerHandlerCallbackImpl$TriggerData.run(TriggerHandlerCallbackImpl.java:87) [bundleFile:?]                           │
20│        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) [?:?]                                                                                │ Sto│        at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]                                                                                               │  20│        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) [?:?]                                         │
20│        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?]                                                                        │
20│        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]                                                                        │
20│        at java.lang.Thread.run(Thread.java:833) [?:?]

Update 2: See below. I’m leaving these logs here in case someone else sees the same problem over the next couple of days.

The settings on the add-on still have “Use built in variables” selected as well as “Use included library” selected (that one’s new right?).

The „Use Included Library“ option is new and enabled by default: I have added some openhab-js injection code caching mechanism that speeds up openhab-js injection especially on less powerful systems, but due to a wrong webpack configuration the current SNAPSHOT does not work.

This is a known regression from a PR merged yesterday, I have a new PR to fix that regression: [jsscripting] Fix regressions from #14135 & Log stack on `IllegalArgumentException` by florian-h05 · Pull Request #14142 · openhab/openhab-addons · GitHub.

@rlkoshak You can get your rules again by disabling the „Use Included Library Option“: This makes the addon inject the library from disk instead of injection the cached openhab-js source.

1 Like

OK, cool.

But to be clear, as I understand it, disabling the option requires the library to be installed as a node_module, right? That seems to be the case based on what I’m seeing after disabling that option and restarting.

Currently yes, but it should not require the library to be installed as node_modules.
This is also fixed in my linked PR.

If everything works correctly, disabling the option would only decrease performance because openhab-js injection is not cached. But everything should continue to work as before.

1 Like

To complete the circle, it works now. Steps I took (for future readers):

  1. Choose “Don Not Use Included Library” and save under Settings → JavaScript Scripting
  2. Install the openhab-js library by running npm install openhab from the userdata/automation/js directory.
  3. Restart OH (may not be required).

Thanks for all the work and the quick turn around. I look forward to testing out this new caching mechanism once the regression gets fixed.

This brings up a new idea which may or may not be feasible. I’ll open a feature request issue for discussion. For the curious the jRuby library has a way to install gems through MainUI. I wonder if JS Scripting could support installing node modules the same way.

2 Likes