[SOLVED] Control an entire group with a single proxy item

  • Platform information:
    • Hardware: Raspberry 3
    • OS:Openhabian
    • Java Runtime Environment: Zulu
    • openHAB version: 2.4
  • Issue of the topic: I would like to control 5 rollershutters with a single proxy item; when the proxy item change status, only a single shutter moves. What is the correct way to address this? List all 5 after the sendCommand instruction so they move together? According to the logs all of them receive the command but only one of them moves.

Previously I was able to get this done using a Group entry in the sitemap with the mapping (with the 1.13 Souliss binding), but with the latest version of the Souliss binding, I no longer define the items of the binding, instead I add the gateway and the things get auto-discovered and then I link them to my items. With the latest binding, the same method of adding a Group entry to the sitemap with all the items produces the same behavior (only 1 shutter moves, not all of them). Unfortunately version 1.13 of the Souliss binding (which you can install from PaperUI) keeps one CPU spinning on 100% so I’d prefer to keep the newer one and figure out how to move all 5 together.

  • Items configuration related to the issue

Channels are defined via PaperUI, but they are all Souliss entries which work fine when commands are sent to an individual entry.

Rollershutter GF_LivingRoom_Shutter1 “Roller Shutter” (GF_LivingRoom, gShutter) [“Rollershutter”] {channel=""}
Rollershutter GF_LivingRoom_Shutter2 “Roller Shutter” (GF_LivingRoom, gShutter) [“Rollershutter”] {channel=""}
Rollershutter GF_LivingRoom_Shutter3 “Roller Shutter” (GF_LivingRoom, gShutter) [“Rollershutter”] {channel=""}
Rollershutter GF_Bedroom_Shutter1 “Roller Shutter” (GF_Bedroom, gShutter) [“Rollershutter”] {channel=""}
Rollershutter GF_Bedroom_Shutter2 “Roller Shutter” (GF_Bedroom, gShutter) [“Rollershutter”] {channel=""}

  • Sitemap configuration related to the issue

    Text label="Roller Shutter" icon="rollershutter" {
    Default item=ProxyRollerGF
        }
    
  • Rules code related to the issue

rule “GF proxy roller DOWN”
when
Item ProxyRollerGF received command DOWN
then {
sendCommand( GF_LivingRoom_Shutter1, DOWN )
sendCommand( GF_LivingRoom_Shutter2, DOWN )
sendCommand( GF_LivingRoom_Shutter3, DOWN )
sendCommand( GF_Bedroom_Shutter1, DOWN )
sendCommand( GF_Bedroom_Shutter2, DOWN )
}
end

rule “GF proxy roller UP”
when
Item ProxyRollerGF received command UP
then {
sendCommand( GF_LivingRoom_Shutter1, UP )
sendCommand( GF_LivingRoom_Shutter2, UP)
sendCommand( GF_LivingRoom_Shutter3, UP )
sendCommand( GF_Bedroom_Shutter1, UP )
sendCommand( GF_Bedroom_Shutter2, UP )
}
end

rule “GF proxy roller STOP”
when
Item ProxyRollerGF received command STOP
then {
sendCommand( GF_LivingRoom_Shutter1, STOP )
sendCommand( GF_LivingRoom_Shutter2, STOP)
sendCommand( GF_LivingRoom_Shutter3, STOP )
sendCommand( GF_Bedroom_Shutter1, STOP )
sendCommand( GF_Bedroom_Shutter2, STOP )
}
end

09:59:24.880 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'ProxyRollerGF' received command DOWN
09:59:24.907 [INFO ] [smarthome.event.ItemStateChangedEvent] - ProxyRollerGF changed from NULL to 100
09:59:27.438 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'GF_LivingRoom_Shutter1' received command DOWN
09:59:27.447 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'GF_LivingRoom_Shutter2' received command DOWN
09:59:27.454 [INFO ] [arthome.event.ItemStatePredictedEvent] - GF_LivingRoom_Shutter1 predicted to become DOWN
09:59:27.465 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'GF_LivingRoom_Shutter3' received command DOWN
09:59:27.478 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'GF_Bedroom_Shutter1' received command DOWN
09:59:27.485 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'GF_Bedroom_Shutter2' received command DOWN
09:59:27.518 [INFO ] [arthome.event.ItemStatePredictedEvent] - GF_LivingRoom_Shutter2 predicted to become DOWN
09:59:27.534 [INFO ] [smarthome.event.ItemStateChangedEvent] - GF_LivingRoom_Shutter1 changed from NULL to 100
09:59:27.555 [INFO ] [arthome.event.ItemStatePredictedEvent] - GF_LivingRoom_Shutter3 predicted to become DOWN
09:59:27.563 [INFO ] [smarthome.event.ItemStateChangedEvent] - GF_LivingRoom_Shutter2 changed from NULL to 100
09:59:27.569 [INFO ] [arthome.event.ItemStatePredictedEvent] - GF_Bedroom_Shutter1 predicted to become DOWN
09:59:27.576 [INFO ] [smarthome.event.ItemStateChangedEvent] - GF_LivingRoom_Shutter3 changed from NULL to 100
09:59:27.592 [INFO ] [arthome.event.ItemStatePredictedEvent] - GF_Bedroom_Shutter2 predicted to become DOWN
09:59:27.599 [INFO ] [smarthome.event.ItemStateChangedEvent] - GF_Bedroom_Shutter1 changed from NULL to 100
09:59:27.604 [INFO ] [smarthome.event.ItemStateChangedEvent] - GF_Bedroom_Shutter2 changed from NULL to 100
09:59:36.223 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'ProxyRollerGF' received command STOP
09:59:36.236 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'GF_LivingRoom_Shutter1' received command STOP
09:59:36.253 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'GF_LivingRoom_Shutter2' received command STOP
09:59:36.261 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'GF_LivingRoom_Shutter3' received command STOP
09:59:36.268 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'GF_Bedroom_Shutter1' received command STOP
09:59:36.273 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'GF_Bedroom_Shutter2' received command STOP

Perhaps this would work with a delay between each command sent.
That does mean you’d need a rule based solution, not using a group’s inbuilt command passing.
You can iterate over a group’s members in a rule.
Example

Thanks, I’ll experiment with it and let you know. Gave it a quick try, but it only moved 2 out of the 5 (even though I have not added any delays, so I’ll try that and see if it helps).

Maybe the underlying issue is that the gateway isn’t queuing commands nicely.

Yes, turned out if I add a 0,2 sec delay, it works flawlessly. Now there’s just one last thing, is there a way to sort the group so the commands gets executed in the same order all the time? Right now, when I close the shutters, they close in a different order than when I open them and I have to open them all completely to align them :slight_smile: Any ideas for that? I saw there’s a function for sorting them (gGShutter.members.sortby) but not sure how to add it to the current code. Btw this is the working code:

rule "GF proxy roller"
when
        Item ProxyRollerGF received command
then
        gGShutter.members.forEach[s|
                s.sendCommand(receivedCommand)
                Thread::sleep(200)
        ]
end

Solved it :wink: here’s the working code:

rule "GF proxy roller"
when
	Item ProxyRollerGF received command
then
	gGShutter.members.sortBy[ name ].forEach[s|
		s.sendCommand(receivedCommand)
		Thread::sleep(200)
	]
end