# openHAB 4.0 Milestone discussion

**URL:** <https://community.openhab.org/t/openhab-4-0-milestone-discussion/145133>\
**Category:** News & Important Changes\
**Created:** [March 10, 2023, 11:01pm UTC](https://community.openhab.org/t/openhab-4-0-milestone-discussion/145133 "2023-03-10T23:01:43Z")\
**Posts on this page:** 20\
**Page:** 13

<div class="post-metadata">

**Author:** ![Andrew\_Rowe](https://community.openhab.org/user_avatar/community.openhab.org/andrew_rowe/32/37075_2.png) [@Andrew\_Rowe](https://community.openhab.org/u/Andrew_Rowe)\
**Post date:** [May 6, 2023, 8:01pm UTC](https://community.openhab.org/t/openhab-4-0-milestone-discussion/145133/246 "2023-05-06T20:01:15Z")

</div>

Wow, thanks Jan! 👍  
So if I uninstall default persistence RRD and install InfluxDB problem goes away? I’m on 4.0M2

---

<div class="post-metadata">

**Author:** ![hafniumzinc](https://community.openhab.org/letter_avatar_proxy/v4/letter/h/b9bd4f/32.png) [@hafniumzinc](https://community.openhab.org/u/hafniumzinc)\
**Post date:** [May 6, 2023, 8:05pm UTC](https://community.openhab.org/t/openhab-4-0-milestone-discussion/145133/247 "2023-05-06T20:05:45Z")

</div>

> [@J-N-K](#):
>
> your setups contain a lot of items

Any idea how many constitutes “a lot”? Would that depend on system specification?

> [@J-N-K](#):
>
> issue recently found in th implementation of nearly all persistence services.

Would this issue exist in OH3 too?

---

<div class="post-metadata">

**Author:** ![Andrew\_Rowe](https://community.openhab.org/user_avatar/community.openhab.org/andrew_rowe/32/37075_2.png) [@Andrew\_Rowe](https://community.openhab.org/u/Andrew_Rowe)\
**Post date:** [May 6, 2023, 8:10pm UTC](https://community.openhab.org/t/openhab-4-0-milestone-discussion/145133/248 "2023-05-06T20:10:07Z")

</div>

> [@ML1982](#):
>
> Have a look at this file.  
> /var/lib/openhab/etc/services.cfg  
> You can change the parameters of the workaround there and it will survive a reboot.

Thanks for the hint  
Mine was located at /usr/share/openhab/runtime/services.cfg  
I’m going to leave it be and try removing RRD

I’ve been doing some firmware development on esp8266 and every once in awhile the com port go sideways and the only way to bring it back is to restart  
this issue made that kind of a PITA 😉

---

<div class="post-metadata">

**Author:** ![Andrew\_Rowe](https://community.openhab.org/user_avatar/community.openhab.org/andrew_rowe/32/37075_2.png) [@Andrew\_Rowe](https://community.openhab.org/u/Andrew_Rowe)\
**Post date:** [May 6, 2023, 8:11pm UTC](https://community.openhab.org/t/openhab-4-0-milestone-discussion/145133/249 "2023-05-06T20:11:40Z")

</div>

> [@hafniumzinc](#):
>
> Would this issue exist in OH3 too?

good question T  
I never had an issue until I fired up OH4

> [@hafniumzinc](#):
>
> Any idea how many constitutes “a lot”?

for me 240 items  
default persistence setup

---

<div class="post-metadata">

**Author:** ![ML1982](https://community.openhab.org/letter_avatar_proxy/v4/letter/m/a9a28c/32.png) [@ML1982](https://community.openhab.org/u/ML1982)\
**Post date:** [May 6, 2023, 9:45pm UTC](https://community.openhab.org/t/openhab-4-0-milestone-discussion/145133/250 "2023-05-06T21:45:00Z")

</div>

@J-N-K

I am already using influxDB, the persistence setup is

```yaml

Strategies {
        everyMinute : "0 * * * * ?"
        everyHour : "0 0 * * * ?"
        everyDay : "0 0 0 * * ?"
        every2Minutes : "0 */2 * ? * *"

        // if no strategy is specified for an Item entry below, the default list will be used
       default = everyUpdate
}

Items {
        // persist the Item state of Heating_Mode and Notifications_Active on every change and restore them from the db at startup
         * : strategy = everyUpdate, everyMinute
         gRestoreOnStartup* : strategy = restoreOnStartup

        // additionally, persist all temperature and weather values every hour
        //Temperature*, Weather* : strategy = everyHour
}

```

I’ve got 636 items and persistence for all of them. I think 636 is “a lot”.

Did I understand correctly that a bugfix is in recent snapshots but not yet in 4.0M2?

I recently disabled the Samsung bundle via karaf. I also reduced the number of lines in fronttail from 2000 to 200. At the moment the system seems to be stable. I will check again tomorrow morning.

About the other bug:

```yaml
Ignoring invalid configuration for pool 'felix.fileinstall.filename': file:/var/lib/openhab/etc/org.openhab.threadpool.cfg - value must be an integer

```

how can I fix that? I have only integers there:

```yaml
openhabian@openhabian:~ $ more /var/lib/openhab/etc/org.openhab.threadpool.cfg
discovery = 5
safeCall = 200
thingHandler = 5

```

---

<div class="post-metadata">

**Author:** ![kristofejro](https://community.openhab.org/user_avatar/community.openhab.org/kristofejro/32/50458_2.png) [@kristofejro](https://community.openhab.org/u/kristofejro)\
**Post date:** [May 7, 2023, 6:54am UTC](https://community.openhab.org/t/openhab-4-0-milestone-discussion/145133/251 "2023-05-07T06:54:40Z")

</div>

Out of curiousity just checked this and for me I can observe exactly the same situation as @apella12 described.  
(4.0.0.M2 - Milestone Build on Pi4)

---

<div class="post-metadata">

**Author:** ![ML1982](https://community.openhab.org/letter_avatar_proxy/v4/letter/m/a9a28c/32.png) [@ML1982](https://community.openhab.org/u/ML1982)\
**Post date:** [May 7, 2023, 7:33am UTC](https://community.openhab.org/t/openhab-4-0-milestone-discussion/145133/252 "2023-05-07T07:33:17Z")

</div>

The system remained stable throughout the night.  
Now, after enabling the Samsung TV Binding, the OH web interface became slower, CPU usage increased and an hour later I had an automatic reboot of OH.

Maybe it’s related to this issue ([Consistent 100% CPU use of safeCall-queue thread - #2 by morph166955](https://community.openhab.org/t/consistent-100-cpu-use-of-safecall-queue-thread/143792/2)) because the Samsung TV Binding uses UPNP, but to be honest I didn’t quite understand what UPNP is.

By the way, the startup error with:

```yaml
Ignoring invalid configuration for pool 'felix.fileinstall.filename': file:/var/lib/openhab/etc/org.openhab.threadpool.cfg - value must be an integer

```

is still there.

and this one, after starting openhab-cli console

```yaml

openhabian@openhabian:~ $ sudo openhab-cli console
[sudo] password for openhabian:

Logging in as openhab
Password:
Failed to load native library:jansi-2.4.0-43230a45d4ce9e45-libjansi.so. osinfo: Linux/arm
java.lang.UnsatisfiedLinkError: /var/lib/openhab/tmp/jansi-2.4.0-43230a45d4ce9e45-libjansi.so: /var/lib/openhab/tmp/jansi-2.4.0-43230a45d4ce9e45-libjansi.so: cannot open shared object file: No such file or directory

```

also.

---

<div class="post-metadata">

**Author:** ![LordLiverpool](https://community.openhab.org/user_avatar/community.openhab.org/lordliverpool/32/38581_2.png) [@LordLiverpool](https://community.openhab.org/u/LordLiverpool)\
**Post date:** [May 8, 2023, 11:07am UTC](https://community.openhab.org/t/openhab-4-0-milestone-discussion/145133/253 "2023-05-08T11:07:22Z")

</div>

I gather that from the thread that, for JSR223 Javascript rules (in .js files), Java 17 needs to be installed in OH4 (or the Nashorn addon). Will the rules then continue working without further changes, or are there other migration steps?

---

<div class="post-metadata">

**Author:** ![florian-h05](https://community.openhab.org/user_avatar/community.openhab.org/florian-h05/32/117524_2.png) [@florian-h05](https://community.openhab.org/u/florian-h05)\
**Post date:** [May 8, 2023, 11:41am UTC](https://community.openhab.org/t/openhab-4-0-milestone-discussion/145133/254 "2023-05-08T11:41:05Z")

</div>

Regarding what to to with JavaScript rules, the Milestone 1 announcement ([openHAB 4.0 Milestone Builds](https://community.openhab.org/t/openhab-4-0-milestone-builds/145132)) gives some tips. For JSR223 JavaScript rules in /automation/jsr223, I think installing the Nashorn add-on should be enough, but you should probably migrate to JS Scripting (/automation/js) to use it‘s great helper library.

---

<div class="post-metadata">

**Author:** ![LordLiverpool](https://community.openhab.org/user_avatar/community.openhab.org/lordliverpool/32/38581_2.png) [@LordLiverpool](https://community.openhab.org/u/LordLiverpool)\
**Post date:** [May 8, 2023, 1:50pm UTC](https://community.openhab.org/t/openhab-4-0-milestone-discussion/145133/255 "2023-05-08T13:50:13Z")

</div>

How much work is involved in migrating to JS Scripting? Any docs on that? Is JS Scripting where there will be more development in future?

---

<div class="post-metadata">

**Author:** ![rlkoshak](https://community.openhab.org/user_avatar/community.openhab.org/rlkoshak/32/75251_2.png) [@rlkoshak](https://community.openhab.org/u/rlkoshak)\
**Post date:** [May 8, 2023, 2:10pm UTC](https://community.openhab.org/t/openhab-4-0-milestone-discussion/145133/256 "2023-05-08T14:10:35Z")

</div>

> [@LordLiverpool](#):
>
> How much work is involved in migrating to JS Scripting?

It depends. There’s a simple import you can do to make Nashorn JS work with GraalVM JS. So at worst it would be the addition of one line at the top

```
if(typeof(require) === "function") Object.assign(this, require('@runtime'));

```

That imports all the stuff that is available to Nashorn rules by default into a GraalVM JS. Note that there are some collisions in names (e.g. `items` is a reference to a Map of Item names and their current state in Nashorn but in GraalVM `items` is your interface to access, create, and remove Items. Therefore it’s better to assign `@runtime` to a variable but that means everywhere you use something injected into the rule (e.g. `events.sendCommand()`) you’ll have to prepend the variable. If you are going to go through that effort, you may as well port to GraalJS.

> [@LordLiverpool](#):
>
> Any docs on that?

There are reference docs for building rules (and transformations) in GraalVM JS (note Nashorn provides ECMAScript 5.1 which was released almost a dozen years ago and has received no updates to the language since where as GraalVM JS provides ECMAScript 2021).

Unlike with Nashorn, GraalJS comes with the Helper Library (no need to clone a github repo and put it in the right spot) or it can be installed via `npm`. Also unlike Nashorn, the Helper Library goes to great lengths to provide a pure JavaScript interface to OH (all interactions with OH in Nashorn are through Java Classes and Objects) freeing you from needing to worry about type conversions in most cases.

The docs for GraalVM JS are very thorough and complete and can be found at [JavaScript Scripting - Automation | openHAB](https://www.openhab.org/addons/automation/jsscripting/). But because the Helper Library is so much more complete and comprehensive, porting to it is likely going to largely be a rewrite of most lines of a Nashorn rule. Though in my experience the GraalVM JS version of the code is roughly half the size of the Nashorn equivalent thanks to stuff that used to need to be imported (e.g. access to metadata) that come with the library now and new features added to ECMAScript in the dozen years since Nashorn.

> [@LordLiverpool](#):
>
> Is JS Scripting where there will be more development in future?

To my knowledge there is no work being done in Nashorn now and none planned for the future. All new JS work is being done on GraalVM JS. The Nashorn add-on is there for backwards compatibility. Note: both Nashorn and GraalVM JS can be installed and used at the same time.

---

<div class="post-metadata">

**Author:** ![LordLiverpool](https://community.openhab.org/user_avatar/community.openhab.org/lordliverpool/32/38581_2.png) [@LordLiverpool](https://community.openhab.org/u/LordLiverpool)\
**Post date:** [May 8, 2023, 2:45pm UTC](https://community.openhab.org/t/openhab-4-0-milestone-discussion/145133/257 "2023-05-08T14:45:27Z")

</div>

OK, sounds like GraalJS is the way to go then. With the Nashorn addon installed, how do you tell the system which JS your .js script is meant to be? Can you switch back and forth as you debug the migrated rules?

---

<div class="post-metadata">

**Author:** ![rlkoshak](https://community.openhab.org/user_avatar/community.openhab.org/rlkoshak/32/75251_2.png) [@rlkoshak](https://community.openhab.org/u/rlkoshak)\
**Post date:** [May 8, 2023, 2:56pm UTC](https://community.openhab.org/t/openhab-4-0-milestone-discussion/145133/258 "2023-05-08T14:56:51Z")

</div>

> [@LordLiverpool](#):
>
> With the Nashorn addon installed, how do you tell the system which JS your .js script is meant to be?

For UI rules they each use a different mime type.

In OH 3.4:

- Nashorn: application/javascript
- GraalVM JS: application/javascript;version=ECMAScript-2021

In OH 4:

- Nashorn : application/javascript;version=ECMAScript-5.1 (I think)
- GraalVM JS: application/javascript

In file based rules, Nashorn rules go under `$OH_CONF/automation/jsr223/js` (or something like that, I don’t really remember but if you are using Nashorn you already know) and GraalVM JS the files go under `$OH_CONF/automaion/js`.

> [@LordLiverpool](#):
>
> Can you switch back and forth as you debug the migrated rules?

While a Nashorn rule can be run on GraalVM, the opposite is not necessarily true. If you use the GraalVM JS Helper Library your rule or anything added to the language since 2011 your code will not run on Nashorn. So you will be talking about having two instances of a given rule with one enabled and the other disabled.

I believe this works for both file based and UI based rules and survives a reboot, but you should verify.

In MainUI you can disable/enable rules by clicking the pause icon at the top. So you can enable one and disable the other. Do your work and if it’s not ready for prime time disable the new and enable the old until the new rule is ready to take over.

If that doesn’t work for file based rules, you’ll have to use something like changing the extension of the files or commenting out to switch between the two.

Rules can be enables/disabled from other rules too (it’s _way_ easier to do from GraalVM JS with the Helper Library) so you could have a rule you run to do the enable/disable if you don’t want to use MainUI. I think you can also do it from the Karaf Console.

---

<div class="post-metadata">

**Author:** ![LordLiverpool](https://community.openhab.org/user_avatar/community.openhab.org/lordliverpool/32/38581_2.png) [@LordLiverpool](https://community.openhab.org/u/LordLiverpool)\
**Post date:** [May 8, 2023, 4:15pm UTC](https://community.openhab.org/t/openhab-4-0-milestone-discussion/145133/259 "2023-05-08T16:15:00Z")

</div>

> [@rlkoshak](#):
>
> Nashorn rules go under `$OH_CONF/automation/jsr223/js` (or something like that, I don’t really remember but if you are using Nashorn you already know) and GraalVM JS the files go under `$OH_CONF/automaion/js`.

Ahh, right, kind of obvious. It’s just the folder location. Actually that’s easy because I could just switch back and forth in my deployment script.

> [@rlkoshak](#):
>
> While a Nashorn rule can be run on GraalVM, the opposite is not necessarily true. If you use the GraalVM JS Helper Library your rule or anything added to the language since 2011 your code will not run on Nashorn. So you will be talking about having two instances of a given rule with one enabled and the other disabled.

What I’d do is have two separate copies of my rules and migrate one to GraalVM. Then I could have my deployment script put either copy into their respective locations according to whether I’m debugging the migrated rules or going back to the old ones.

Thanks!

---

<div class="post-metadata">

**Author:** ![milo](https://community.openhab.org/letter_avatar_proxy/v4/letter/m/85e7bf/32.png) [@milo](https://community.openhab.org/u/milo)\
**Post date:** [May 8, 2023, 9:08pm UTC](https://community.openhab.org/t/openhab-4-0-milestone-discussion/145133/260 "2023-05-08T21:08:49Z")

</div>

Hello,  
so what are the steps for upgrading from oh3.4.4 to oh4.0m2 ? Or is the snapshot currently better?

Upgrading java via openhabian menu? And than upgrading to milestone build? Can I revert back to oh3.4.4 from milestone build?

---

<div class="post-metadata">

**Author:** ![Andrew\_Rowe](https://community.openhab.org/user_avatar/community.openhab.org/andrew_rowe/32/37075_2.png) [@Andrew\_Rowe](https://community.openhab.org/u/Andrew_Rowe)\
**Post date:** [May 8, 2023, 10:19pm UTC](https://community.openhab.org/t/openhab-4-0-milestone-discussion/145133/261 "2023-05-08T22:19:11Z")

</div>

> [@milo](#):
>
> steps for upgrading from oh3.4.4 to oh4.0m2

what is host operating system? Here is how I did my Linux host

> [@Upgrading OH3 to OH4 Linux Mint](https://community.openhab.org/t/upgrading-oh3-to-oh4-linux-mint/145156):
>
> I run openHAB on a small desktop PC running Linux Mint 19.2 This is an apt-get installed openHAB, this is NOT an openHABian install. This is not a headless system, I have a monitor, keyboard and mouse. Here is how I upgraded my install to the brand new M1 version WARNING: “Here be dragons”\* This worked for me but version 4 at this time is NOT officially released! Follow these instruction at your own peril!!! I am just documenting how I did it. First I checked which version of Java was runn…

---

<div class="post-metadata">

**Author:** ![milo](https://community.openhab.org/letter_avatar_proxy/v4/letter/m/85e7bf/32.png) [@milo](https://community.openhab.org/u/milo)\
**Post date:** [May 9, 2023, 4:09am UTC](https://community.openhab.org/t/openhab-4-0-milestone-discussion/145133/262 "2023-05-09T04:09:19Z")

</div>

I am running on openhabian

---

<div class="post-metadata">

**Author:** ![wezzix](https://community.openhab.org/user_avatar/community.openhab.org/wezzix/32/52860_2.png) [@wezzix](https://community.openhab.org/u/wezzix)\
**Post date:** [May 10, 2023, 12:09pm UTC](https://community.openhab.org/t/openhab-4-0-milestone-discussion/145133/263 "2023-05-10T12:09:14Z")

</div>

I want to share that I had huge problems with Java 17 not installing on RPi 4 due to unmet dependencies and how I solved it.

```yaml
$ sudo apt-get install openjdk-17-jre-headless
Some packages could not be installed.
...
The following packages have unmet dependencies:
 openjdk-17-jre-headless : Depends: libc6 (>= 2.34) but 2.28-10+rpt2+rpi1+deb10u1 is to be installed
                           Depends: libgcc-s1 (>= 3.5) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

```

Turns out, nothing is broken, but libc6 is held and it warns about incompatibilities if you upgrade that.  
I tried upgrading from buster to **bullseye** but made no difference.

Then I manually downloaded **Zulu Java 17** , Linux 32 bit edition, and that worked.  
Instructions from ChatGPT:

```yaml
wget https://cdn.azul.com/zulu-embedded/bin/zulu17.42.19-ca-jre17.0.7-linux_aarch32hf.tar.gz
tar -zxvf zulu17.42.19-ca-jre17.0.7-linux_aarch32hf.tar.gz
sudo mv zulu17.42.19-ca-jre17.0.7-linux_aarch32hf /usr/lib/jvm/
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/zulu17.42.19-ca-jre17.0.7-linux_aarch32hf/bin/java 1
sudo update-alternatives --config java
java -version

```

Hope this is useful to someone. At least now the error is searchable.

Edit: The correct way to upgrade probably would have eliminated the issue. [Link](https://www.tomshardware.com/how-to/upgrade-raspberry-pi-os-to-bullseye-from-buster)

---

<div class="post-metadata">

**Author:** ![apella12](https://community.openhab.org/user_avatar/community.openhab.org/apella12/32/117154_2.png) [@apella12](https://community.openhab.org/u/apella12)\
**Post date:** [May 10, 2023, 9:28pm UTC](https://community.openhab.org/t/openhab-4-0-milestone-discussion/145133/264 "2023-05-10T21:28:10Z")

</div>

Wrote a similar procedure (non ChatGPT 😉) to use Zulu on Buster earlier in this chain [openHAB 4.0 Milestone discussion - Setup, Configuration and Use / News & Important Changes - openHAB Community](https://community.openhab.org/t/openhab-4-0-milestone-discussion/145133/16).

Only other comment on your post is that there should be no problem with openjdk17 on Bullseye. After running OH4M1 for about a month with Buster/Zulu I upgraded to bullseye, (the non-recommended way - not with a new clean install) and changed the java back to openjdk17 with no issues. The Bullseye/openjdk17 is also the current openhabian base for a clean install of OH4, so something must have been amiss with your upgrade to Bullseye.

---

<div class="post-metadata">

**Author:** ![milo](https://community.openhab.org/letter_avatar_proxy/v4/letter/m/85e7bf/32.png) [@milo](https://community.openhab.org/u/milo)\
**Post date:** [May 11, 2023, 7:07pm UTC](https://community.openhab.org/t/openhab-4-0-milestone-discussion/145133/265 "2023-05-11T19:07:58Z")

</div>

any help on this?

[Previous page](https://community.openhab.org/t/openhab-4-0-milestone-discussion/145133.md?page=12)

[Next page](https://community.openhab.org/t/openhab-4-0-milestone-discussion/145133.md?page=14)
