Hello everyone,
Maybe you have an idea how I can simplify my rule.
I want to bring my shutters to a certain height by voice command (10, 20, 30, …, 100). So far my rule looks like this:
rule "Voice"
when
Item VoiceCommand received command
then
var String command = receivedCommand.toString.toLowerCase
logInfo("Voice.Rec","VoiceCommand received "+command)
if (command.contains("10")&&command.contains("rollo"))
{
if (command.contains("1")) {
S1.sendCommand(10)
}
else if (command.contains("2")) {
S2.sendCommand(10)
}
else if (command.contains("3")) {
S3.sendCommand(10)
}
else if (command.contains("4")) {
S4.sendCommand(10)
}
else if (command.contains("5")) {
S5.sendCommand(10)
}
else if (command.contains("küche")&&command.contains("tür")) {
S6.sendCommand(10)
}
else if (command.contains("küche")&&command.contains("fenster")) {
S7.sendCommand(10)
}
else if (command.contains("wc")) {
GF_Toilet_Shutter.sendCommand(10)
}
else if (command.contains("htr")) {
GF_LaundryRoom_Shutter.sendCommand(10)
}
else if (command.contains("bad")) {
FF_Bathroom_Shutter.sendCommand(10)
}
else if (command.contains("schlafzimmer")) {
FF_Bedroom_Shutter.sendCommand(10)
}
else if (command.contains("lilia")) {
FF_KidsRoom_Shutter.sendCommand(10)
}
else if (command.contains("johannes")) {
FF_GuestRoom_Shutter.sendCommand(10)
}
}
end
This works so far. Unfortunately I would have to do it nine more times. That somehow doesn’t seem very effective to me.
Is there a more clever way?
Best regards!