This repository has been archived by the owner on May 7, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 780
Scripted Rule Support
Simon Kaufmann edited this page May 5, 2017
·
18 revisions
While there is no proper documentation yet available, I though it's a good idea to collect some knowledge here as a start.
This is how I got the scripted rule support running within the IDE.
Include the following bundles in the launch config:
org.eclipse.smarthome.automation.module.core
org.eclipse.smarthome.automation.api
org.eclipse.smarthome.automation.provider.file
org.eclipse.smarthome.automation.rest
org.eclipse.smarthome.automation.module.script.rulesupport
org.eclipse.smarthome.automation.module.timer
org.eclipse.smarthome.automation.providers
org.eclipse.smarthome.automation.parser.gson
org.eclipse.smarthome.automation.core
org.eclipse.smarthome.automation.module.script
Add this as a VM argument in the launch config:
-Dorg.osgi.framework.bundle.parent=ext
Scripts are searched for in conf/automation/jsr223
. The following example.js
worked for me:
'use strict';
se.importPreset("RuleSupport")
se.importPreset("RuleSimple")
var sRule = new SimpleRule(){
execute: function( module, input){
print("################ module:", module);
}
};
sRule.setTriggers([
new Trigger(
"aTimerTrigger",
"timer.GenericCronTrigger",
new Configuration({
"cronExpression": "0/15 * * * * ?"
})
)
]);
automationManager.addRule(sRule);
To be figured out 😉