[SOLVED] Delay for group commands

Tags: #<Tag:0x00007f6182a66478> #<Tag:0x00007f6182a66360>

Hi Folks,

I have a bunch of somfy blinds and rollershutters which are controlled through somfy tahoma binding. If I controll every single device with openhab, everything works fine. But if I try to controll a group e.g. from basicUI or by a rule it happens that controlled things go offline.
Because of the logs I guess this happens due to limitation of number of commands at the same time by the somfy cloud service.

Now my question: is there a way to define a delay between commands send to every single member of a group? Perfect would be a setting within the group definition.

This sounds to me as though it should be a feature request in GitHub for the binding. To answer your question though, no, you can’t delay the commands to group members when a command is sent to the group. However, you could send the command to a proxy Item instead of the group, have a rule trigger on that, and iterate through the group to send the commands using timers to space them out.

1 Like

NO, basically you can’t. You could request a feature request in the gitHub for the binding or you could use the Gatekeeper approach:

Following your suggestion, I’ve created a workaround with proxy items like this one

var long delay = 100

rule "gVBlindscD Proxy"
    Item gVBlindcDProxy changed
    var value = (gVBlindcDProxy.state as DecimalType).intValue
    gVBlindcD.members.forEach[item | sendCommand(item,value) Thread::sleep(delay)]

This solves my “overload” tahoma issue (with some reorganisation of my group structure).
But anyway, your are right, it sould be a feature of the binding. Unforunatly I have to confess, that I’ve never created a feature request, yet :no_mouth:. I’ll give it a try :sunglasses:

Look into using timers rather than sleep. There are several topics discussing the dangers of using sleep.

Please do look at the Gatekeeper DP. It was written exactly to solve this problem and the coffee is already written and tested. If you move to scripted automation at some point, there is a submission to the Helper Library sending approval that implements the Gatekeeper DP for you that you can just use, no copy/paste/edit. https://github.com/openhab-scripters/openhab-helper-libraries/pull/232

I’ve already took a look to this DP. Looks really promising. :+1:
But for the moment I’ve another misbehaviour to understand.

Rules which use the usual groups work fine. Even if they trigger five blinds with two channels each at the same time. But sliders from the basicui needs this proxy item workaround. It’s not clear for me yet, which part is the problem here.

I confess I was to fast with the conclusion, the overflow of tahoma service is the (only) reason. And if I would still need the delay to handle it, I’ll switch to the gatekeeper DP.
But for now I think I’ve to start another topic to get answers for the updated “challenge”

Short update:

The “devil” is the openhab android app. See this topic: Slider items with new Android App 2.8.0 not working anymore

I just still didn’t get why tahoma kicks the bridge and the things offline when getting a float number instead of integer. But for now I can have a calm sleep because my rules with groups are good as they have been at the beginning.

Sorry for bothering you with a pseudo-problem. :roll_eyes: But at least I’ve learned more :grimacing:about iterating through groups and DP.