ReferenceError: "console" is not defined in <eval>

Raspberry Pi OS, Pi 4, all latest distros - openhab installed from distro. I have a rule with an ECMAscript action (first time trying the OH3 interface). Rules work fine with timers and actions on things. With ECMAscript I get the above error. Full text is Script execution of rule with UID ‘2dabdc1660’ failed: ReferenceError: “console” is not defined in at line number 1

Script is:‘Luminance change detected’);

As nobody seems to have run into this before, I’ve got to assume that I’ve made some very basic mistake, but can’t figure out what it is.


Which ECMAscript are you using? For the OH3.X there is a built-in ECMAscript using an older JS which if you are just starting you should probably avoid because it is on its way out. And a newer version for which you have to install the JSScripting Add-on.


For‘Luminance change detected’); you need that newer version.

Well I just assumed the Javascript action was what I wanted, which is half true because I had to install the Javascript Automation to get the 2 ECMAScript versions. I then used the later version as you recommended and the console.log now works.

Now all I need to do is fix the rest of my script errors :slight_smile:

Thanks for your help. You got me on the right track and now I can proceed to the next problem.