sendCommand for Group Items using Numbers

Dear all,

It seems that sendCommand have some issues with numbers when using groups.

All my rollershutters (which are from different brands) are in the group Grollo

The following rule is intended to open all rollershutters at 7:30 from Monday to Friday.

rule "Rollladen Mo-Fr AUF"
        Time cron "0 30 7 ? * MON,TUE,WED,THU,FRI"    
        sendCommand(Grollo, OFF) 

Unfortunately some rollershutters can’t handle the command OFF
So it would be better to amend the OFF to 0. But then the whole rule doesn’t work.

In individual rules for each rollershutter it is ok to use:

Any help would be appreciated.

Are any of these Items linked to Rollershutter Items? I ask because Rollershutter Items do not support ON/OFF commands.

1 Like

I’m not sure if the type of the Group (e.g. Group:Dimmer etc.) influences what is “allowed”. I think it should - if specified.

The action sendCommand needs strings for command and itemname. Maybe the method would work:

sendCommand(Grollo, "0")  // action
Grollo.sendCommand(0)     // method

But I observed that sending commands through a group item often fails, so please try explicit control of group members:

rule "Rollladen Mo-Fr AUF"
    Time cron "0 30 7 ? * MON-FRI"    
    Grollo.members.forEach[ i | i.sendCommand(0) ]
1 Like

Yes, some are Rollershutter - thus I need to send 0 to the group.

I’ll try this, thanks …

By way of explanation, when you send a command to a group, it gets passed on very quickly to each member. There’s no orderly queue. Especially when the Items are associated with real devices, you’d be dependent on the binding managing some kind of strategy of queue and delay. Some connection technologies simply aren’t very good at dealing with a flurry of commands.

To distinguish cases like that - OH command is okay but never arrives at device - from cases like you first described - OH rejects some command types - it is important to look in events.log to see what is happening with OH Items.

In this case, because you have a mix of Dimmers and Rollershutters, Udo’s solution is perfect.

But what if you have really different Item types, like Switches and Location? In this case you would not be able to send the same command to each through the Group at all. In that case you can do something like:

    Grollo.members.filter[ m | m instanceof SwitchItem ].forEach[sw | sw.sendCommand(<switch command>) ]
    Grollo.members.filter[ m | m instanceof Location ].forEach[ lo | lo.sendCommand(<location command>) ]

Obviously replace the stuff in < > with whatever is appropriate.

1 Like