Read 4 bit dimming command from KNX bus


(Martin Sundström) #1

Hi,

I am currently working with another logic engine for KNX and have run in to a show stopper for that one. For that reason I am looking for something else and want to know if OH can do the following. I have never used OH so bare with me…

I have a physical MDT KNX touch-button that has a one button dimming function. When using that function the button sends a 4 bit dimming command to the KNX bus. Today I use a DALI gateway to read that command and set the value for my spots. But now I want to integrate more logic to it, so my question is if OH can read a 4 bit dimming command from the KNX bus so I can use that in a script in OH?

My current logic engine can´t read 4 bit dimming events, just send them and that is a bit annoying…

I hope my question make sense, thanks in advance!


[SOLVED] How to dim a Z-Wave-Dimmer using KNX
(Angelos) #2

Do you know what is the DataPoint Type (DPT) ID ? (most likely, it is 3.007 = [000b…111b])
Maybe you can post also an example telegram to check it.

I don’t use 4 bit DPTs in my KNX installation with OH2 but I use others without any problems
Example: 8 bit (aka 1 byte) for my Shutter Actuators using 5.001 DPT which is 8bit

Without being 100% certain, I would say yes…


(Martin Sundström) #3

Hi and thanks!

Yes, it is 3.007, I can take a screenshot of ETS if you want to?

Ok, in other words we can assume that it will be ok. I think I will give it a go and se if I can make it work.

Thanks again!
Martin


(Angelos) #4

Maybe we can help more by understanding better the scenario:
What would you like to achieve ? What logic you want to implement in your (OH2) system ?


(Udo Hartmann) #5

DPT 3.007 is INCREASE/DECREASE, the common way is either to send
4b0001 (= DECREASE one Step) / 4b1001 (= INCREASE one Step) repeatedly OR send
4b0001 (= DECREASE one Step) / 4b1001 (= INCREASE one Step) for start dimming and 4b0000 / 4b1000 to break dimming (=STOP)

openHAB will receive the INCREASE / DECREASE messages but not the break message.
So, if the MDT button is configured to send only INCREASE / DECREASE messages repeatedly, you can define a rule in openHAB to INCREASE / DECREASE a value:

rule "MyDimmer"
when
    Item MyKNXDimmer received command
then
    if (recievedCommand == INCREASE)
        MyDaliDimmer.sendCommand((MyDaliDimmer.state as DecimalType) + 5) //increase 5%
    else if (recievedCommand == DECREASE)
        MyDaliDimmer.sendCommand((MyDaliDimmer.state as DecimalType) - 5) //decrease 5%
end

(Martin Sundström) #6

Excellent, I think the increase and decrease till be enough since the rule won´t do anything if it doesnt receive another command. I will take a look on the accual command sent by the MDT button to make sure that it sends increase and decrease.

Thanks a lot!


(Martin Sundström) #7

I would like to be able to do other commands as well when doing the dimming so I need to know when the button starts dimming. Also I want to do all the logic in one place and not use built-in logic in buttons or the dali gateway.


(Angelos) #8

Then… openHAB2 was designed for you :slight_smile:
Good Luck ! (…if you get stuck… the community is here :sunglasses:)


(Martin Sundström) #9

That sound great! :slight_smile:

Thanks so far, I will probably end up posting some more questions in the near future… :smile:


(Martin Sundström) #10

Ok, so I have finally got OH2 working and started to do some testing, and it turns out that my MDT buttons sends INCREASE, BREAK and DECREASE, BREAK messages. So no repeated INCREASE or DECREASE there. I am trying to figure out if I can make this work anyway but I am out of ideas. Do you have any other ideas?

Thanks!


(Udo Hartmann) #11

You have to configure absolute dimming :slight_smile:


(Martin Sundström) #12

Ok, just to make sure that I understand you. For example if I push a button, OH2 sets the dimming to a predefined value, like 50%?

Do you know if there are there any plans to implement relative dimming in OH2 for KNX?


(Udo Hartmann) #13

absolute dimming is, to send the dimmlevel to the actuator. Each knx dimmer should have at least following objects:

  • ON/OFF
  • INCREASE/DECREASE (most common is start-stop-dimming)
  • actual state as Bit (ON/OFF)
  • set dimm level (%, DPT5.001 is most common)
  • dimm state (DPT5.001)

To completely define a knx dimmer in openHAB, you have to set

  • ON/OFF
  • Dimmlevel SET
  • Dimmlevel STATE

INCREASE/DECREASE are not required at all.

Dimmer MyDimmer "My dimmer [%d%%]" {knx="1/1/1,5.001:1/1/4+<5.001:1/1/5"}

would send and receive ON/OFF telegram at 1/1/1, send absolute dimmer level at 1/1/4 and receive dimmer level state at 1/1/5 (with read request on startup)
So, when switching a dimmer ON, the knx dimmer will raise to the defined level (last level or a fixed one, depends on dimmer configuration)
When using a slider (Basic UI or similar), openHAB will send a value between 0 and 100, which represents brightness from 0% to 100%
When dimming manually (from wall switch), the knx dimmer will send its state at the end of dimming process as a number between 0% and 100% and openHAB will receive this value.
If you want relative dimming (maybe because you want to use Classic UI which does only provide INCREASE/DECREASE) you will have to use the rule above Read 4 bit dimming command from KNX bus but you have to define absolute dimming to let the rule do its work.


(Pascal Fontaine) #14

Hi,
I am watching your answers/discussions since a few weeks. I´m very impressed about your knowledge and hope you could help me.
I am using Openhab 2.3 and want wo Dimm an Fibaro Dimmer with an MDT KNX RF Switch (Glastaster).

These picture shows the available objects in ETS5 and the telegrams from the Switch:

Can you please tell me how to configure the Dimmer in the KNX thing? Do I need a Dimmer or an Dimmer-Control?

Let me know if you need some further information…

Best regards,
Pascal Fontaine


(Angelos) #15

Hi Pascal,

Is this the Fibaro Dimmer that you are using: https://www.fibaro.com/en/products/dimmer-2/ ?

If yes: This is a Z-Wave device and you can’t manage it using the KNXv2 Binding.
You will need to integrate this into your openHAB2 system using the Z-Wave Binding

Then, you can have a rule that takes the command from the KNXv2 Bound Switch Item to control the Z-Wave dimmer

Ps: It’s easier to open up a new thread for your case and link to existing ones


(Pascal Fontaine) #16

Hi Angelos,

thanks for your answer, this is the right Dimmer.
The Dimmer is already included in my ZWave binding and it works fine.
Now I want to control the ZWave Dimmer from my KNX RF Switch over my KNX line coupler and IP gateway.


(Angelos) #17

Ok… Personally, I don’t have experience with the -control type of Channels in KNX.
@Udo_Hartmann has used them and he maybe able to help you.

You can try to use a rule that takes the input from the KNX bound Item and sends it to the Z-Wave Dimmer.

To be honest, it’s not 100% clear to me either the -control functionality and the documentation entry is a bit vague:

We need to develop some examples to add them in the documentation. Maybe an example with a Dimmer Item that is bound to 2 binding configs would be useful.

Take a look here for a similar example: Knx and TRÅDFRI
and check this also: Unit-Support, KNX 2, Karaf 4.1.5 Upgrade and more!


(Angelos) #18

Try the following:

Type dimmer-control        : controlDimmer        "Control Dimmer"        [ switch="0/5/0+0/5/2", increaseDecrease="0/5/1", frequency=300 ]

Then, go into your Z-Wave Dimmer Item and add the knx channel to test it (without a rule)

Dimmer	WDim01_Dim		"Staircase LED Dim [%d %%]"	<slider>	(gAll)	{ channel="zwave:device:512:node4:switch_dimmer", channel="knx:device:..."}

(Pascal Fontaine) #19

Thanks for yout help :slight_smile:
The light can be switched on, but not off. I think the switch needs an status or something.
Do you have an idea?

My.things:
Thing device aktor2[address=“1.2.5”, fetch=false, pingInterval=300, readInterval=0]{
Type dimmer-control : Licht_UG_Gang “Control Dimmer” [ switch=“0/5/0+0/5/2”, increaseDecrease=“0/5/1”, frequency=300 ]}

My.items:
Dimmer UGRailDimmer_Dimmer “Dimmer UGGang [%d %%]” <slider> (gAll) { channel=“zwave:device:998cac51:node11:switch_dimmer”, channel=“knx:device:bridge:aktor2:Licht_UG_Gang”}


(Udo Hartmann) #20

The correct configuration for knx2 would be

Type dimmer-control : controlDimmer        "Control Dimmer"        [ switch="0/5/2+0/5/0", increaseDecrease="0/5/1", frequency=300 ]

As you can see, the status address is the first one, because openHAB will use this GA to send the status to knx. openHAB will receive the command through the second GA and it will receive INCREASE/DECREASE through the third GA.

I don’t know anything about Fibaro (or zwave), so don’t know if fibaro can handle INCREASE/DECREASE commands. If not, you will have to use a rule like this:

rule "dimming fibaro through knx"
when
    Item myKnxDimmerControl received command
then
    switch receivedCommand: {
        case ON: {
            myZwaveDimmer.sendCommand(ON)
        }
        case OFF: {
            myZwaveDimmer.sendCommand(OFF)
        }
        case INCREASE: {
            myZwaveDimmer.sendCommand((myZwaveDimmer.state as Number) + 5)
        }
        case DECREASE: {
            myZwaveDimmer.sendCommand((myZwaveDimmer.state as Number) - 5)
        }
        default: {
            logWarn("knx_incdec","received a command which is not supported: {}",receivedCommand)
        }
    }
end

Of course you have to split the channels to two items…