Rulename.js does not appear to be called - solved

  • Platform information:
    • Hardware: Intel 64 bit
    • OS: Debian
    • openHAB version: 3.3 with the JS add-on

Sorry, this feels like a stupid question. I am writing my rules in javascript and am not seeing them get called at all.

I’ve created a .js file in /etc/openhab/automations/js

scriptLoaded = function() {
  console.log("My script loaded");
}

Which the docs lead me to believe will log that line in the openhab.log file.

I also tried a creating a cron rule to output a log entry, but nothing shows at all.

I dont have any errors… just nothing. I’ve restarted openHab in case the JS add on needed it.

EDIT1: It shows fine in bundles, and I have made sure npm installed the files in the node directory.
EDIT2: If I create a script in the UI pointed at the new type of script it does work and logs as expected.

SOLVED: Found a bug report that lead me to double check the Java version the system was using. Turns out it was not using the right one - I think it was on Zulu v17… forced it back to v11 (as the instructions call out) and it started detecting the script. Everything else worked fwiw…