Virtuel rollershutter Item for alle rollershuttter

Hi have a lot of rollershutters. It work fine for all single commands.

Now I want one rollershutter to set all rollershutter together.
Alle rollershutters need the command and the Position to refresh the widget.

Virtuel rollershutter -> alle single rollershutter -> commands to Hardware.

item (Virtuel):

 Number VirtualAlleRolloPositionen "PositionAlleRollos" <icon> (groups)


rule "Item AlleRollos"
    Item AlleRollos received command
        case "UP": {    
          (alle other commands)
        case "DOWN": {
          (alle other commands)

But i dont refresh my widgets?

And how can i give the position to the other rollershutter Positions?
I cant set a Number to a NumberItem.

What is the right way to use a lot items with one Item?

rule "Item VirtualAlleRolloPositionen"
    Item VirtualAlleRolloPositionen received command
    rolloKuechePosition = receivedCommand as Number

What type of Item are your real rollershutters?

Have you considered using a Group as the “master control”?

1 Like

all items of the rollershutter are numbers.
I dont use groups at the moment.
But what can i do if i have a group of rollershutters? I need a Master so set all other rollershutters?

The common way is to build real rollershutter items for each real rollershutter, then put all rollershutter items in one group of type rollershutter.

Group:Rollershutter gShutter "All Shutters"
Rollershutter Shutter01 "Shutter 1 [%d %]" (gShutter) { ... }
Rollershutter Shutter02 "Shutter 2 [%d %]" (gShutter) { ... }
Rollershutter Shutter03 "Shutter 3 [%d %]" (gShutter) { ... }

If the shutters need a number for absolut positioning and can’t react on commands like UP/DOWN/STOP, you will need an additional rule:

rule "control shutter"
    Member of gShutter received command
    if(!(receivedCommand instanceof Number))
        switch receivedCommand {
            case UP : triggeringItem.sendCommand(0)
            case DOWN : triggeringItem.sendCommand(100)
            default : logWarn("shutter","Command {} not supported!",receivedCommand)
        logInfo("shutter","received Number {}, doing nothing!",receivedCommand)

This will suffice to control both each shutter as well as the whole group. Please be aware that there is no STOP command.


@Udo_Hartmann Thank you, it works fine.

But I need it for the Item position, too.

My code:

   rule "Item AlleRolloPositionen"
    Member of AlleRolloPositionen received command
    if(!(receivedCommand instanceof Number))
        switch receivedCommand {
            default : triggeringItem.sendCommand(AlleRolloPositionen.state)
        logInfo("shutter","received Number {}, doing nothing!",receivedCommand)

This is the same with a Number Type and a Group for alle rollershutter positions.

But, if i change a group member Position, the “master” Position go to undefined. What can I do, that the position of the “master” go to 0?

there should be no need to translate a number to itself. If setting the group to a specific position, it should send this command to all members of the group.
If this does not work, think about the code of the rule :wink:

rule "control shutter"                                                               // name of rule
when                                                                                 // list of triggers
    Member of gShutter received command                                              // a member of the group received a command
then                                                                                 // what to do
    if(!(receivedCommand instanceof Number))                                         // received command is not a number
        switch receivedCommand {                                                     // decide dependend on received command
            case UP : triggeringItem.sendCommand(0)                                  // command is UP, so send 0
            case DOWN : triggeringItem.sendCommand(100)                              // command  is DOWN, so send 100
            default : logWarn("shutter","Command {} not supported!",receivedCommand) // any other command will cause a warn log
        }                                                                            // end of switch block
    else                                                                             // command is a number
        logInfo("shutter","received Number {}, doing nothing!",receivedCommand)      // log an info that the command was a number

Please pay attention to the invisible part :wink: and scroll to the right…

Now, if sending a number through this sort of rule, you would create an endless loop (the rule triggers itself)
For the group you could use this rule:

rule "shutter group position"                // name of rule
when                                         // list of triggers
    Item gShutter received command           // the group itselv received a command
then                                         // what to do
    if(receivedCommand instanceof Number)    // command is a number
        gShutter.members.forEach[m|          // for each member of the group
            m.sendCommand(receivedCommand)   // send the received command
        ]                                    // end of code block "for each"

But as said above, this rule should not be necessary, as the group will resend all received commands to the items.

Thank you, i see, that I need nothing else only the group.
And Tank you for the code description.