- Platform information:
-
Hardware: Rasberry Pi 4
-
OS: Linux raspberrypi 5.4.83-v7l
-
Java Runtime Environment:
openjdk version “11.0.9.1” 2020-11-04
OpenJDK Runtime Environment (build 11.0.9.1+1-post-Raspbian-1deb10u2)
OpenJDK Server VM (build 11.0.9.1+1-post-Raspbian-1deb10u2, mixed mode) -
openHAB version: OH 3.0.0
-
- Issue of the topic: Example Script throwing error in openhab.log file.
Just to make sure things are running correctly, I decided to use the Jython example given at: JSR223 Scripting | openHAB
which is:
scriptExtension.importPreset(“RuleSupport”)
scriptExtension.importPreset(“RuleSimple”)
class myRule(SimpleRule):
def execute(self, module, inputs):
print “This is a ‘hello world!’ from Jython rule.”
sRule = myRule()
sRule.setTriggers([
TriggerBuilder.create()
.withId(“aTimerTrigger”)
.withTypeUID(“timer.GenericCronTrigger”)
.withConfiguration(
Configuration({
“cronExpression”: “0 * * * * ?”
})).build()
])
automationManager.addRule(sRule)
- In the log file openhab.log I get the following:
2021-01-07 23:48:11.769 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID ‘b001e0ea15’ failed: :4:0 Expected an operand but found class
class myRule(SimpleRule):
^ in at line number 4 at column number 0
I’m not sure what I am doing wrong, any ideas?