OH4 upgrade issue

Next issue… Now with rules…

Here comes the error log:

2023-07-25 15:15:29.939 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID 'feeddc6b81' failed: var HttpUtil =  ___ Java.type("org.openhab.core.io.net.http.HttpUtil")
var urlmessage = encodeURI("TEXT MESSAGE.")
HttpUtil.executeUrl("GET", "https://api.callmebot.com/whatsapp.php?source=openHAB&phone=+4911111111&apikey=12345678&text=" + urlmessage , 2000)
   1. The method or field Java is undefined; line 1, column 15, length 4
   2. The method encodeURI(String) is undefined; line 2, column 83, length 9

JAVA 17 was and is installed…

the release thread isn’t for personal, unanalyzed issue but to consolidate knowledge so please only post there when appropriate else open your own threads

after I updated to openhab 4, I have now no sitemap and not things, I have everything done file based, I can see all items, transformations and rules, the items also changing the values like temperature sensors, so it is working, but strange that I can’t see anymore the thing to it.
when I try to open the sitemap, it tells me I didn’t define a sitemap.
has someone the same?

I use openhab in docker.

Hi
I am running OH4 with a quite recent build No 3531 which is working fine. It is running in Docker, and the image is from the official openHAB site: Docker

However, when I try to fetch OH 4.0.0 release from the same URL, it seems that Java 17 is not included in the image. Therefore, I am not able to upgrade to OH 4.0.0
Can the Docker image be recreated, so it includes Java 17 like all the OH 4.0 snapshot images?
Thanks.

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

:hourglass_flowing_sand:

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>                                                                                                                                                           
openhab> info
Karaf
  Karaf version               4.4.3
  Karaf home                  /openhab/runtime
  Karaf base                  /openhab/userdata
  OSGi Framework              org.eclipse.osgi-3.18.0.v20220516-2155

JVM
  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:

2 Likes

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 \
        openhab/openhab:4.0.0

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

:slight_smile:

2 Likes

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?