OH4 upgrade issue

I’d rather recomment to use the HTTP script actions:

@mpuff: What do the logs say?

@wborn Can you please check the Docker container?

$ docker run --rm -it --net=host openhab/openhab


Launching the openHAB runtime...

                           _   _     _     ____  
   ___   ___   ___   ___  | | | |   / \   | __ ) 
  / _ \ / _ \ / _ \ / _ \ | |_| |  / _ \  |  _ \ 
 | (_) | (_) |  __/| | | ||  _  | / ___ \ | |_) )
  \___/|  __/ \___/|_| |_||_| |_|/_/   \_\|____/ 
       |_|       4.0.0 - Release Build

Use '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
To exit, use '<ctrl-d>' or 'logout'.

openhab> info
  Karaf version               4.4.3
  Karaf home                  /openhab/runtime
  Karaf base                  /openhab/userdata
  OSGi Framework              org.eclipse.osgi-3.18.0.v20220516-2155

  Java Virtual Machine        OpenJDK 64-Bit Server VM version 17.0.7+7-Debian-1deb11u1
  Version                     17.0.7
  Vendor                      Debian

Looks good to me. :slight_smile:


The rule problem with the HTTP problem is solved, due to the fact, that I have had to manual
install “JavaScript Scripting” addtional after upgrade to OH 4.0.0-1. After that I have had to open each rule and save it. After that the rule and therfore the http command works again…

Everything is so complicated this time with the update to the new version.
As an NonExpert it’s to hard to me to find all the issue and more time consuming to find solutions.

  • Java 11/17 issue…
  • Install “JavaScript Scripting” manual
  • Units are not the same as in OH 3.4.4 e.g. kWh and Watt etc…
  • Have had to delete items with humidity and create them new that they work…

After installing Java 17, following carefully reading https://github.com/openhab/openhab-distro/releases/tag/4.0.0#breaking-changes-that-require-manual-interaction-after-the-upgrade should avoid most issues.
I don‘t know which JavaScript you used, because in your initial post you did not mention it, but Nashorn changed MIME type and was moved to an add-on as mentioned in the release notes.

You are right, that carefully read instructions, would help to do presteps beforehand.
And I‘m also sure that 95% of us are technical expert‘s, developers, programmers, coders, whatever, and like to script. They all understand what impacts it have and preconditions here and there needs to be done…

I belong to the other 5% of users they are able to open a terminal window and type in the command to update the system and hope they everything will go well.

So this is my expection and my knowledge to setup a private used smart home system….

It would also be nice to see some pictures what and how to do, and not in words…
You know, that picture say more than 1000 words…

1 Like

Thank you both for your great work. I was not aware of the simple info command in Karaf console.

The problem is that I am owerwriting the java.security file, because it blocks TLS1.0 protocol, which is needed by binding for IHC. I need to provide my own version to change the default settings in this file.

In all the snapshot builds for OH4 the path in the Docker image has been: /usr/lib/jvm/temurin-17-jdk-amd64/conf/security/java.security

However, in OH4 release the path is: /usr/lib/jvm/java-17-openjdk-amd64/conf/security/java.security

I got an error creating the container with the message ‘Path not found’, so I thought the Java part was missing. It is not missing, but the path has changed. I changed my path in the docker run statement, and everything works fine.

Again, thanks for your support :pray:

1 Like

You can also use the $JAVA_HOME environment variable for that which is set when the container is started:

Then your changes will keep working with any Java version on any architecture and also when another JVM is used.

The JVM in the container was changed to fix issues on some platforms.

See: Docker container does not start on Raspberry lite 64: openhab/runtime/lib/endorsed is not supported

The problem is that I cannot create the container. I need to adjust the file java.security, so I have copied it out to my local drive, where I made the changes. Then I refer to this file in my docker run command, which looks like this:

docker run \
        --name openhab4\
        --net=host \
        -v /etc/localtime:/etc/localtime:ro \
        -v /etc/timezone:/etc/timezone:ro \
        -v /home/xxxxxx/Documents/openhab4/conf:/openhab/conf \
        -v /home/xxxxxx/Documents/openhab4/userdata:/openhab/userdata \
        -v /home/xxxxxx/Documents/openhab4/addons:/openhab/addons \
        -v /home/xxxxxx/Documents/openhab4/conf/java.security:/usr/lib/jvm/java-17-openjdk-amd64/conf/security/java.security \
        -d \
        --restart=unless-stopped \
        -e USER_ID=997 \
        -e GROUP_ID=997 \
        -e OPENHAB_HTTP_PORT=8078 \
        -e OPENHAB_HTTPS_PORT=8441 \
        -e "EXTRA_JAVA_OPTS=-Djava.net.preferIPv4Stack=true" \
        -e TZ=Europe/Copenhagen \
        --memory=1600m \

If you have a suggestion on how to make this dynamic, I am very interested.
The hardware controlled by IHC binding only supports TLS1.0 currently.

You could for instance create a shell script to copy your version of the file to the location using $JAVA_HOME before openHAB is started. See Executing shell scripts before openHAB is started.

Then your script could simply be:

#!/bin/bash -ex

cp /openhab/conf/java.security $JAVA_HOME/conf/security/java.security

Then it would work with the Alpine and Debian containers as well as all architectures (armhf, arm64, amd64).

in the logs, I can see that the items are ok, they get all status updates, but I have the following errors:

[WARN ] [s.internal.SingleValueTransformation] couldn't transform response because transformationService of type 'JS' is unavailable
[WARN ] [s.internal.SingleValueTransformation] Transformation service JS for pattern shelly_convertkwh.js not found!
[WARN ] [s.internal.SingleValueTransformation] The transformation add-on 'javascript' does not exist - ignoring it.

can this has something to do with my problem? I think not

I’d think it is rather unrelated to your issues, but it should be fixed as well.

Please install the JavaScript Scripting add-on to get the JS transformation service working again.

After upgrade in Openhabian from 3.4.4-2 now to Openhabian 4.0.0-1, I get warnings in the logfile, that units cannot convert from “W” to “kWh”. As thoose are to diffferent units I was checking.

It seems, that with the 4.0.0-1 binding for shelly, all (at least the value from the gen1 plug s) the values which are “average the power from the last minute” are set with the wrong unit.

When I delete the item and I create NEW it will be generated new, but with the wrong value:

It should be Number:Power AND NOT Number:Energy.

@markus7017 : Please correct in the new version of the binding.

UPDATE: Also all LastPower#1 to #3 are impacted…

i have everything file based, does someone know, how I can install the javascript scripting file based?
I tried to add it to the add-on.cfg like:
automation = javascriptscripting, js, javascript

none of the 3 are working.

You were very close, try this instead:

automation = jsscripting



Thank you, that’s it :slight_smile:

1 Like

I have the same issue with things and sitemaps not showing up, also only textual definition. It is a fresh openhabian installation. I can recover things if I do a manual save on any .things file, the same with .sitemap, but I am sure this is not the behaviour that is desired.

This doesn’t happen if I clean the cache before (sudo openhab-cli clean-cache), but it happened several times that because of other issues (jre223 rule engine not working etc.) I restarted openhab via sudo systemctl restart openhab.service, and then that issue happened.

Anyone who has experienced that and/or knowing how to fix it?

@mpuff Do you still have that behavior?

I still have the issue, I need to restart openhab several times until it works again :confused:

OK. Could one of the maintainers comment on this issue? Should we issue a bug report and if so, to which part of openHAB should this report refer to?

@mpuff I have no problem recovering it:

  • Either by opening every things and sitemap file and adding or removing a blank line and then saving it.
  • Or (not 100% sure because tested only 2x) by sudo systemctl stop openhab.service, sudo openhab-cli clean-cache, sudo systemctl start openhab.service

There is an issue to track this.

In the 4.1.0-SNAPSHOT build there are two potential fixes to address these issues (openhab-osgiify#42, openhab-core#3779).

So if someone can help testing them we can backport them to 4.0.x as well. :slight_smile:

Have filed the issue here: