I have made some rules, for some broadlink, but some is for dumb devices, so same button do the same when on and off. My question is, is there a way to simplefy this in one rule, and not in two?
example:
rule “Enciende la tele”
when
Item Scene_TV_AOC_POWER received command ON
then
sendCommand(TV_AOC,“TV_AOC_POWER”)
end
//
rule “Apaga la tele”
when
Item Scene_TV_AOC_POWER received command OFF
then
sendCommand(TV_AOC,“TV_AOC_POWER”)
end
From what I can tell you want to differentiate between ON and OFF for the item Scene_TV_AOC_POWER, which I assume is a Switch
rule "Enciende la tele"
when
Item Scene_TV_AOC_POWER received command
then
switch (receivedCommand) {
case ON : {
TV_AOC.sendCommand(ON)
}
case OFF : {
TV_AOC.sendCommand(OFF)
}
}
end
sendCommand(TV_AOC,“TV_AOC_POWER”) would send the actual string “TV_AOC_POWER”, which is not really what you want, I suppose.
To simplify even more you can just send on the receivedCommand to your TV_AOC
rule "Enciende la tele"
when
Item Scene_TV_AOC_POWER received command
then
TV_AOC.sendCommand(receivedCommand)
end
Also notice the different syntax to your example - more info about it here