Hi,
I have installed the experimental rules on my RPI3 with openhabian and put the files from the mini-wiki (jslib) in /srv/openhab2-conf/automation/jsr223.
Then I changed paths in JSRule.js and helper.js. Next I generated in the same dir a file called test.js.
'use strict';
load('/srv/openhab2-conf/automation/jsr223/jslib/JSRule.js');
logInfo("################# SimpleRuleExamples.js ##################", TimerTrigger);
JSRule({
name: "Example 4",
description: "Most simple spelling live",
triggers: [ //Enable/Disable Rule
//NOT Working: ShutDown()
//NOT Working: StartupTrigger()
//stateCondition("testItemSwitch", "ON", "cond1") //Error: Can not create new object with constructor org.eclipse.smarthome.automation.Condition with the passed arguments; they do not match any of its method signatures.
//IS WORKING: TimerTrigger("0/15 * * * * ?")
//IS WORKING: new TimerTrigger("0/15 * * * * ?")
//TimerTrigger("0/15 * * * * ?")
//StartupTrigger()
//IS WORKING: ChangedEventTrigger("testItemSwitch", "ON", "OFF")
//IS WORKING: UpdatedEventTrigger("testItemSwitch"),
//IS WORKING: CommandEventTrigger("testItemSwitch")
//CommandEventTrigger("Test_Button", "ON", "OFF")
CommandEventTrigger("Test_Button")
],
execute: function( module, input){
sendCommand("Wallplugs_i2", ON);
logInfo("Wallplugs_i2 "+__LINE__, "Wallplugs_i2.state = " + Wallplugs_i2.state);
}
});
The sendCommand works, but I cannot get the state. If I try I get the following error:
2018-01-21 18:44:57.467 [ERROR] [.automation.core.internal.RuleEngine] - Failed to execute rule ‘a35b4ab9-ab50-4d97-819c-1578a9642d98’: Fail to execute action: 1
I took the file from github (example 4):
Anybody an idea?