Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions Core/automation/lib/javascript/core/conditions.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,13 @@ if(ModuleBuilder == undefined)var ModuleBuilder = Java.type("org.eclipse.smartho

// ### stateCondition ###
var ItemStateCondition = function(itemName, state, condName){
return ModuleBuilder.createCondition().withId(getTrName(condName)).withTypeUID("core.ItemStateCondition").withConfiguration( new Configuration({
"itemName": itemName,
"operator": "=",
"state": state
})).build();
return GenericCompareCondition(itemName,state,"=",condName);
}
var stateCondition = ItemStateCondition;

// ### GenericCompareCondition ###
var GenericCompareCondition = function(itemName, state, operator, condName){
return ModuleBuilder.createCondition().withId(getTrName(condName)).withTypeUID("core.GenericCompareCondition").withConfiguration( new Configuration({
return ModuleBuilder.createCondition().withId(getTrName(condName)).withTypeUID("core.ItemStateCondition").withConfiguration( new Configuration({
"itemName": itemName,
"operator": operator,// matches, ==, <, >, =<, =>
"state": state
Expand Down
4 changes: 4 additions & 0 deletions Core/automation/lib/javascript/core/rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ return RuleBuilder.create(ruleDto.uid)
if (obj.name) {
rule.setName(obj.name);
}

if (obj.conditions){
rule.setConditions(obj.conditions);
}

//1. Register rule here
if (triggers && triggers.length > 0) {
Expand Down