- Platform information:
- Hardware: x86_64
- OS: Ubuntu Linux 20.04.4
- Java Runtime Environment: Azul Zulu 11.62+17 (11.0.18-b10)
- openHAB version: openHAB 3.4.2 Release Build
When trying to use the example code from JavaScript Scripting - Automation | openHAB it does not run the script.
It complains about no such function.
Script:
var counter = cache.private.get('counter');
if (counter === null) {
counter = { times: 0 };
cache.private.put('counter', counter);
}
console.log('Count', counter.times++);
Console output:
13:20:41.861 [ERROR] [.internal.handler.ScriptActionHandler] - Script execution of rule with
UID 'a4a6e27576' failed: org.graalvm.polyglot.PolyglotException: TypeError:
undefined has no such function "get"
Installed JS Scripting is installed and selecting ECMA 2021+ when making the script:
What am i doing wrong?