I have a rule:
// ###########Activitiy
rule "Activity scene selection"
when
Item Scene_Activity received command
then
switch(receivedCommand) {
case 0 : return false //no selection
case 1 : { //TV
callScript("LG_srcHDMI2")
if (HTPC_Radio.state != "OFF") {
sendCommand(HTPC_Radio, "OFF")
sendCommand(Marantz_Power, OFF)
}
if (Scene_Activity.state == 2)) {
sendCommand(HTPC_Radio, "OFF")
sendCommand(Marantz_Power, OFF)
}
}
...
As you can see i have two nearly identical if statements in the rule, but i’ don’t know how i can join them:
i was thinking something like:
case 1 : { //TV
callScript("LG_srcHDMI2")
if (HTPC_Radio.state != "OFF") or (Scene_Activity.state == 2) {
sendCommand(HTPC_Radio, "OFF")
sendCommand(Marantz_Power, OFF)
}
}
but this throws an error:
2016-04-13 19:46:23.237 [ERROR] [o.o.c.s.ScriptExecutionThread ] - Error during the execution of rule 'Activity scene selection': Ambiguous methods [protected java.lang.Object org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._evaluateAssignment(org.eclipse.xtext.xbase.XAssignment,org.eclips
I haven’t been able to find any examples of using or
and and
in if satements
in rules in this way. I know it is possible to use them in the when
part of the rule but not in the if statement in the then
part of the rule.
Any suggestions?