Trigger Group Item over KNX

Given these items:

Rollershutter knxAllShutters {knx="..."}
// or a Switch item, if you only want UP/DOWN

Group:Rollershutter gShutters
Rollershutter rShutter_01 (gShutters) {knx="..."}
Rollershutter rShutter_02 (gShutters) {knx="..."}
Rollershutter rShutter_03 (gShutters) {knx="..."}
Rollershutter rShutter_04 (gShutters) {knx="..."}
Rollershutter rShutter_05 (gShutters) {knx="..."}
Rollershutter rShutter_06 (gShutters) {knx="..."}
...

The rule would be like this:

rule "drive all shutters"
when
    Item knxAllShutters received command
then 
    gShutters.members.forEach[s|       //s will be substituted by the item names
        s.sendCommand(receivedCommand) //send the command to s (i.e. each item, one by one)
        Thread::sleep(250)              //4 commands per second
    ]
end

If using a switch item for UP/DOWN the actual command would be slightly different:

s.sendCommand(if(receivedCommand == OFF) UP else DOWN)

If using a rollershutter item, in theory it should suffice to do this:

rule "drive all shutters"
when
    Item knxAllShutters received command
then 
    gShutters.sendCommand(receivedCommand)
end

Of course, this would result in 14 knx commands at the same time, which will, in most cases, result in command loss at the knx bus (one or two rollershutters will not move at all).

2 Likes