KNX and switch-control: openhab does not reply state


my Idea ist to have a knx Switch trigger a rule in openab and then openhab should answer “ON” to the switch like any physical knx actor does to a switch.
I created the following thing for a control-switch and derived an item from that.

Type switch-control : KNX_Switch_No_Real_Aktoror "MySwitch" [ ga="0/1/207"]

When the pysical switch is pressed, the rule triggers. I would expect that openhab would send a “ON” to the group address “0/1/207” but nothig happens. Do I need a rule for that?

If I get this right your plan is to trigger some logic in the rule that may reply ON or OFF, depending on its calculation. You expect to have the state being available from OH, being able to query it from knx and being send over to knx after the rule completes.

What I do not understand is your group address setup.
0/1/207 is the address your physical switch is sending to the bus when being pushed?
Then to which address do you want an answer to be written to ?

Maybe create an item to the group address of a things channel that shall receive the information and send a corresponding command to it from within the rule.

Some more details on what you try to achieve would help to help you.

Not quite.
0/1/7 is the group address for the state of the knx thing. 0/1/6 is the group address on which the physical switch sends on or off to openhab via the knx bus. Openhab receives this on or off but sends no state reply as an actor would. In my post I left 0/1/6 out of the config, it should be ga=“0/1/6+0/1/7”. Even with that, I get no reply from openhab on 0/1/7

The switch-control should answer on or off on 0/1/7. Did I miss something in the config of the thing?

Perhaps I need only to restart openhab.

In case you understand German: this Link explains in detail how the switch-control behaves.
It might help.

As far as I understand, I could set the state of the physical switch with postUpdate(On), which sends a state update using the state group address, correct?

If you send a command “ON” to the physical actors group address for switching it, it will - depending on the settings of your physical actor and the outcome of your switching request - send an update for the status group address onto the knx bus.
In case you configured an openHab item with the physical actors state knx group address you will receive an update on that item in OH setting it to “ON”.

For the KNX binding, xxx-control type channels work in opposite sense to ordinary channels.
Reception of a KNX message triggers an openHAB command to the linked Item.
A state update of the openHAB Item results in a message to KNX.

Correct, those are used to „simulate“ a knx device.
You can use them to e.g. link a device connected to another binding with knx.
Maybe looking at the „follow“ profile for items would help to achieve similar effects.

so if that is the Things config

Thing device knx_virtual “knx_virtual” [ ]
//virtuel KNX switch and openhap is the actor sending state
Type switch-control : KNX_Switch “KNX Switch” [ ga=“0/1/206+<0/1/207”]


and that is the rule which updates the item the thing is connected to


Then the pysical switch should be informed using the group address “0/1/207” that is has to show “ON”, right?

Your “KNX_Switch” is a channel within the thing, not an item.
You need to create an item based on that channel first.
Switching the item to ON or OFF then should afaik cause the status to be sent onto the bus using the group address for the status. Ideally it does not require a rule for that behavior.
Just give it a try.

I have an item connected to the thing. Same name as the thing or different name, it just sends ob/off on 0/1/206 but does not send state on 0/1/207.

I do not understand why the state update is not sent by openhab using 0/1/207 :slight_smile: -)

Guess this should solve it:
The “virtual actor” only sends on the first knx group address (as all knx devices do).
A switch-control ignores the “<”, your channel responds on both group addresses defined, but replies only on the first one.
Consider switching the order of your group addresses in the channel definition - the status address should come first.

Type switch-control : KNX_Switch “KNX Switch” [ ga=“0/1/207+0/1/206”]

1 Like

tested again as you have shown but still, openhab does not send anything. I deleted the rules to avoid an error there.

openhab shows when I press the pysical button:
KNX_Switch predicted to become ON
[vent.ItemStateChangedEvent] - KNX_Switch changed from OFF to ON

and after sencond press
KNX_Switch predicted to become OFF
[vent.ItemStateChangedEvent] - KNX_Switch changed from ON to OFF

but the state seems to be not sent. Any ideas? :slight_smile:

Hmm, thought that should work.

Another idea:

  • Remove the state group address from the virtual actors switching channel (Below named “SWITCH_A”).
  • Create a second channel in an actor just for the status group address (“STATUS_A”)
  • Create one item for switching the virtual actor (you already have one)
  • Now link your item additionally to the status channel, but use the “follow” profile for the status one

Switch youItem {channel=“knx:SWITCH_A”,channel=“knx:STATUS_A” [profile=“follow”]}

I would expect the following behaviour:
Whenever you switch the item to a different state through "SWITCH_A"´s group address, the secondary channel (“STATUS_A”) should receive the same value. So the state should be propagated from the switching channel to the status channel and therefor onto the bus.

I did something similar for my room thermostats and the thermostats on the radiators. Setting the room thermostat triggers setting the radiators setpoints as they are linked with the “follow” profile to the same item. (Could have been done with ZWave associations but was not familiar with how to configure this in OH)

To be honest: if this does not work I´m out of ideas.

There is a closing bracket too much.
Should be:

Switch youItem {channel=“knx:SWITCH_A”,channel=“knx:STATUS_A” [profile=“follow”]}
1 Like

Thanks, corrected.

1 Like

Thank you very much, two separate switch-control (one for the switching message knx->openhab, one for transferring the state openhab->knx) work now perfectly.

1 Like

Then please mark this as resolved and tag the solution.

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.