Trigger Group Item over KNX

Hi guys,

is it possible to trigger a Group item over a Group address?

I want to switch my rollershutter Group over a knx Group address UP and DOWN.

Out of Openhab the Group can be switched.

But if i put the knx address after the item, i get an error.

It is also not possible to create a rule, with the Group item.

Here is one config i tried:

rule "Rollo gesamt Test"
when
Item Rollo_gesamt_test changed to 100
then
Rollo_gesamt_Regel.sendCommand(DOWN)
end

Group:Rollershutter:OR(UP,DOWN) Rollo_gesamt_Regel “Rollo gesamt[(%d)]” (all)

Rollershutter Rollo_gesamt_test “Rollo gesamt test” (all) {knx=“2/0/14”}

Thx for support
Vaillan

I am not sure if I understood correctly the issue :slight_smile:
You should show the log (with the error) and to describe a bit more what you want to achieve.
First, find the optimum path to your goal, then debug the path.

I would try the following:

  1. Setup a new (e.g. Switch) Item and bind it to the KNX GA. This Item will be used just as a control point.
  2. Setup your Rollershutter Items (properly bound to their KNX GAs) and Group them
  3. Setup a rule that fires based on the state of the first “control” Item and sends the command to the Group

One (potential) problem that I see from your existing config is the incomplete KNX GA setting on the Rollo_gesamt_test Item (Rollershutter type). You could try to use a Switch item type (or Number) Link

Additionally to Angelos answer, I’d like to add:
You have not written, if you have already a GA for “Rollo_gesamt” or if you want to combine your individual “Rollos” in openHAB to a Group.
I’d strongly recommend to have a GA for each Rollo and already for a Group within KNX (you have to have ETS for that). Then you add this GA to an extra item and you have full control over your “Rollos” even without openHAB.
If you don’t have a Group GA, of course you can have a openHAB Group, which triggers your “Rollos_Gesamt” - and it should work as Angelos described.

1 Like

i am sorry, for my bad description.

This is just a small part of my config.

I have 14 Rollershutters and all of them are in the Group named rollershutter.
Now i have a big rule to close all rollershutters (each Rollershutter sendcommand (DOWN) with a own knx Group Address ).

I want to optimize this rule to make it a Little bit clearer.

So I made a Rollershutter widget with the Group Item Rollo_Gesamt_Regl in Habpanel which sends a DOWN or UP.
That works.

But if i want to trigger this Group Item out of a KNX Group Address 2/0/14 it doesn´t work.
There is also no Log Entrie - just Rollo_gesamt_test received commad Up or Down.
No Entrie about the Group Item.

And that ist the question, how do i have to trigger the Group Item Rollo_gesamt_Regel, that should Switch the whole Rollershuttergroup with a knx Group address.

I hope this is understandable.

Thx
Vaillan

Do I understand correctly, you have a Group GA “2/0/14”, which sends all of your 14 rollershutters DOWN or UP?
You can’t connect a GA (or whatever binding) to a Group in openHAB. You have to bind 2/0/14 to an item.

So, you have to add a item “Rollo_gesamt” and bind that one to the Group GA. Then you can have a rule, which triggers that item.

in short: a Group GA is an item in openHAB - not a Group.

yes, i know that.

But is it possible to trigger the Openhab Group that includes all Rollershutter with only one KNX Group Adress?

So i have clearer and smaller Rule.

Now i have this rule - works but is really big:

rule "Alle Rollo runter"
when
Item Rollo_gesamt changed to DOWN
then
sendCommand(Rollo_OG_Schlafzimmer,DOWN)
Thread::sleep(2000)
sendCommand(Rollo_OG_Kinderzimmer1,DOWN)
Thread::sleep(2000)
sendCommand(Rollo_OG_Kinderzimmer2,DOWN)
Thread::sleep(2000)
sendCommand(Rollo_OG_Bad_1,DOWN)

and so on…

I want to make it clearer and thought, that i Cloud trigger ther working Openhab Group out of a knx Group.
So the rule would be much smaller.
Ist that possible?

yes, you can - and it should do as intended! - If the items within the Group “understand” the command. You can’t tell a Switch Item to change to 22.5. :wink:

two comments:

  • do you encounter problems with you KNX-telegrams? the Thread::sleep() command is not the best you can do… (and I don’t need it for my KNX-installation, as the binding handles the communication)
  • I still don’t understand, why you won’t use 2/0/14?
Rollershutter Rollo_gesamtGA	"alle Rollos [%d %%]" 	{ knx="2/0/14, ..." }

So, it will just tell your KNX actuator to address all your shutters?

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

Thanks for Reply,

thats why i put a delay between each knx command.

Your rule is much smaller than mine and works also - thanks a lot.

best regards
Vaillan

Hello Udo,

thanks for the above rule - I just upgraded to OH2.5 and used our rule template for my rollershutters since I encountered exactly the problem you described in your post. I have 24 rollershutters and with triggering the entire “Group” many times a few shutters wouldn’t move at all due to having to many KNX Group Adresses sent without any delay in between.

Yet - when implementing your rule I found a potential Typo in your rule - at least thats what the VS Code validation told me - so maybe this also helps others.
Not sure if this changed with OH2.5?!

Instead of:

Thread:sleep

an additional : needs to be entered

Thread::sleep

So my working rule looks like:

rule "Good night RollerShutter"
when
    Item Good_Night_Shutters received command
then 
    Grp_Good_Night.members.forEach[s | s.sendCommand(receivedCommand) Thread::sleep(200) ]
end

Yepp, you’re totally right.

corrected the typo above…