How to interpret KNX scenes as ON/OFF Switch?


Brand new first-time user of OH here, just set up an instance on a RP3 today with a simple connection to my old Hager Tebis EIB installation. Surprisingly, it works - I can see when a light is turned on and off, and I can turn it on and off via OH. Yay :triumph:

Unfortunately the implementation is quite odd (old??). Instead of using DPT 1.001 to turn the light on & off, the switch sends a one-byte binary value (0x32 for ON, 0x30 for off) to the GA. So to get this to work I had to use 18.001 to interpret this as scene selection as follows:


Number Front_stairwell_light {knx="18.001:1/0/5"}


Switch item=Front_stairwell_light label="Top Light" icon=light mappings=[ 48="off", 50="on" ]

So, in the UI I now see the light with two buttons, one for ‘off’ and one for ‘on’. And, as I said, it works as expected both for a physical switch being hit (and reported) and for switching via the UI.

But what I’m trying to do is work out how to get OH to recognise that 48 is an off state, and 50 is an on state, for a normal light switch so that OH ‘understands’ this is an on/off light & I get the little slider switch in the UI (and the icon changes automatically) instead (and other standard switch on/off semantics work by default).

I feel like I need to translate or map the values somehow to tell OH that this device is just an ordinary switch and to treat the nominated values simply as ‘on’ or ‘off’ (sort of how the MIOS binding does for z-wave stuff).

Unfortunately I can figure out how to do this…

Does anyone have any suggestions?


Well, Tebis is… sorry… sort of shit :slight_smile: . Luckily, I rejected to use this and decided to use ETS from the very beginning (July 2005).

Now, what you could do, is to use some unbound items for UI and define rules to “translate”:

Switch mySwitch "my Switch is [%s]" //will use the default dynamic icon for switches
Number mySwitch_knx {knx="..."}
rule "translate knx"
    Item mySwitch_knx received command
    if(receivedCommand == 48)
    else if(receivedCommand == 50)

rule "translate mySwitch"
    Item mySwitch received command // switched from UI
    if(receivedCommand == OFF)
    else if(receivedCommand == ON)

Of course doing that with more switches would be a mess… you probably would want to use groups to build a more general rule for all switches.

Awsome - thanks so much for the response!

I totally agree, Tebis is indeed a POS :frowning: Unfortunately I didn’t know anything about KNX at the time and believed the salesman when I put this in about 13 years ago… One thing in its favour - it has been totally reliable up to now!

Re the code - took me a while to realise there was a minor issue with your suggestion (needs “Item” in the when clause) but, once that was sorted, it worked perfectly. Thanks so much!!

Just a pity that this amount of code is necessary - had hoped to just shim a translate in at the binding or item layer… :relaxed:

Next challenge - I have 23 different lights to manage. Which means I need 46 mappings (knx->OH and OH->knx). I’d rather not write individual code for each!!!

I note you suggest using groups to build a more general rule… would you be able to elaborate a bit please?

I’ve spent about a day googling away, but am sort of stuck. The closest I come is using a Lambda to manage the code, with maybe two hashmaps to manage the translations in either direction, but working out which device triggered & hence managing the corresponding switch is still escaping me…

Thanks again!!

Sorry for the missing Item, I did update my posting in case of someone else stumbles over it.

In case of a more general rule, take a look at Design Pattern: Working with Groups in Rules, @rlkoshak explains the whole thing a lot more accurate than I could do.

Dear friends,

I’ve got a problem with the scenes delay!

If I make a dimming for 6 lamps ( put it on 50% ) it takes something like 5 seconds to turn on.

Someone give me a solution for it???

No cross postings, please.