JavaScript file-based scripts not detected

  • Platform information:

    • Hardware: quad core Intel Celeron J4105 (-MCP-), x86_64, 8 GB RAM, 150 GB Storage
    • OS: Linux 5.15.0-73 via Ubuntu 22.04.2 LTS
    • Java Runtime Environment: openjdk 18.0.2-ea (edit: same with openjdk 17)
    • openHAB version: 3.4.4, JavaScript Binding is installed
  • Issue of the topic:

Creating js files in $OPENHAB_CONF/automation/js with JSRules doesn’t create a rule/script (nothing visible in the web interface), crons aren’t executed and no log output is produced. The files and folders are owned by the openhab user.

This worked some time ago via the docker image. In this current setup I’m using the ubuntu/debian installation of openhab.

  • Rules code related to the issue:
rules.JSRule({
  name: "test",
  description: "Just a test",
  triggers: [triggers.GenericCronTrigger("* * * * *")],
  execute: (event) => {
    console.log('Hello');
  },
  tags: [],
  id: "MyTest"
});

Any help appreciated.

That java version is not the recommended one for 3.4.4

The same happens with java 17.

Java 17 is not recommended either. openHAB 3.4 was developed and tested with Java 11.

2 Likes

I looked at the v4 docs, sorry. Thanks for the hint. Works now.

2 Likes