[knx2] Issue with Scene Number

Well, in fact, knx2 is very strict in configuration, so, if you know, what to keep in mind, it should work nice and smooth.
But in question of scene number, this isn’t solved yet - but maybe I also have to make a special configuration, who knows? :wink:

Should be possible to use KNX v1 and KNX v2 concurrently, so for the scene stuff we could use v1 and for everything else v2 until everthing is fixed?

Not very nice maybe to use both versions at the same time, but it seems to be a suitable workaround for me.

For what I tested, knx2 worked like a charm… besides my scenes :roll_eyes: and most of our automation rules use scenes to control lights etc. I tried different DPT just to see if scene numbers would arrive on the bus in different format or so, but couldn’t get it working. Mixing v1 and v2 sounds a bit like looking for trouble though :relaxed: but let me know if it works :stuck_out_tongue_winking_eye:

cheers

Depends on your hardware connection to the knx bus I suppose.
I use a knx ip tunnel which is able to open up to 4 tunnels to the knx bus.
This alllows me to use ETS, knx1 and another knx2 connection at the same time.
Means, for me it works.

Hello together,

I have still the same problem. If I use the datatype 17.001 for KNX scenes I got the same exception. But I was able to use this value in rules. If I set up scene 1 in KNX the exception tell me “wrong value format: 0.0”. So I had to be careful because of that. I think in your example you are using scene 4. (wrong value format: 3.0).
And if I pressed the button for teaching (normal the scene number will be 1+64) I also got the value of 0.0. So I was not able to decide if somebody runed scene or teached scene.

If I use the datatype 18.001 (I want to learn in scenes as well) I get a KNXFormatException, too. I wrote a topic some time ago.

Hope someone can fix it, because I am still not able to use scenes at home.

Here is the topic:
https://community.openhab.org/t/knx-2-3-0-problem-with-scene/42932

To lighten up the scenes a little bit…

  • There is definitely an issue, 'cause when defining a number channel with DPT 17.001, every received integer is changed to float. And openHAB complains about itself… :rofl:
  • But the Number is received and stored. I’m also able to send a scene command through the same channel by using an Integer.
  • The ETS will display the Scene Number as 1 to 64, while the knx bus will transport the
    Scene Number as 0 to 63!!!
    This is due to the fact, that Scene Number is defined as a 6Bit value:
    • DPT 17.001(Scene Number): rrUUUUUU (8bit Value, the two MSB have to be 0)
    • DPT 18.001(Scene Control): BrUUUUUU (8bit Value, the second MSB has to be 0) B is for
      • 0 -> Recall or
      • 1 -> Store

So it’s obvious that when switching to “Scene 1” openHAB will receive a 0. This is correct.

Thanks for the information.

  • Thats true, the scene is changed to float (DPT 17.001), but I am able to use it in rules.
  • With the DPT 18.001 I am not able to use it anymore. The logfile will trace the correct scene number (Scene 1 in ETS -> data=‘0x00’ or data=‘0x80’ for learning in). But I am not able to use it in rules. The Exception will break the program before. This is the biggest problem actual for me. I checked out the source code and with a small change I was able to use it. I am not sure if it is a bug or if I am using the DPT 18.001 in a wrong way.
  • All the stuff with scenes was working very nice with KNX1. So I hope it could be fixed for KNX2 soon.

Jep, As I never used DPT18 within openHAB myself, this part was only from the knx sheets :wink:

In theory, the code should be something like that:

Type number : scene "Scene" [ ga=18.001:1/2/3 ]
Number myScene "Scene [%d]" { channel="...:scene" } // store or recall scene
Switch setScene "Store Scene"// set to ON to store
Number mySceneNumber "scene Number to store is [%d]" // knx-scene - 1
rule "set scene"
when
    Item setScene received command ON
then
    if(mySceneNumber.state instanceof Number) {
        if (mySceneNumber.state >= 0 && mySceneNumber.state <= 63 ) {
            myScene.sendCommand((mySceneNumber.state as Number) + 128) // maybe ...state as Number).intValue + 64
        }
    }
    setScene.postUpdate(OFF)
end

EDIT: changed the 64 (Bit 7) to 128 (Bit 8)…

Thanks for your example. With this code it is maybe possible to set and learn scenes via openhab. I didn´t try yet because the onliest thing I need to do is to get the information if someone pressed the KNX button for scenes for setting or learning it. So I don´t need to set it from openhab, I just need to react in rules.

Set up channel 15 in Paper UI: "Number control" 18.001:15/1/0

Number SzeneOff "Scene Off" {channel="knx:device:KNXToRaspbi:15"}

rule "sceneOff"
when
	Item SzeneOff received command
then
            logInfo("Szene OFF", "Command received ")
            if(SzeneOff.state == 9)
	    {
                   // Do something, e.g. set Hue components, Z-Wave...
            }
end

So the onliest thing I want to do to pass the command of Scene On/Learn to openhab to switch on/remember state of none KNX components (hue). Because actual I am only able to use scenes just with KNX components.
But the log entry “Scene off, Command received” in my example is not shown actual, because the exception will appear before.

Translator couldn't parse data for datapoint type '18.001' (KNXFormatException).
Ignoring KNX bus data: couldn't transform to any Type (destination='15/1/0', datapoint='command DP 15/1/0 'knx:device:KNXToRaspbi', DPT id 18.001, low priority', data='0x09')

I am not sure what I should configurate differently. I tried out to use “Number” and “Number Control” in the Paper UI. Both with the same result.

I’m pretty sure that number-control is the correct one.
Maybe it’s possible to fake the DPT as long as the scene-DPT is broken:

Type number-control         : scene1 "Szene Off"       [ga="5.010:15/1/0"]

Wow! Thats working…now I get 0.0 or 128.0 with the datatype 5.010!

Thanks a lot!

Any news on this topic? As far as I can see, the DPT ist still delivered as decimal (x.0)…

I was trying to play around with some workarounds, but neither worked…maybe I have errors in the syntax?

var Scene_Value = (Scene.state as DecimalType).intValue

//guessing that Scene_Value can't be used as a trigger first...
rule "Szene 1 Guten Morgen"

when

Item Scene received update

then

if {Scene_Value.state == 0}

HueColorCandle1Color.sendCommand ("30,64,80")

HueColorCandle2Color.sendCommand ("30,64,80")

HueColorCandle5Color.sendCommand ("30,64,80")

end

//Trying to use the Scene_Value directly...
rule "Szene 2 Gute Nacht"

when

Item Scene_Value received command 1

then

HueLightstripPlus1Dimmer.sendCommand (OFF)

HueColorCandle1Dimmer.sendCommand (OFF)

HueColorCandle2Dimmer.sendCommand (OFF)

HueColorCandle5Dimmer.sendCommand (OFF)

//SteckdoseTreppenhausOben.sendCommand (OFF)

SteckdoseFP1.sendCommand (OFF)

end

//Tried to use the floating point decimal the binding delivers (in this case I would have simply had two rules, depending on what triggered the rule
rule "Szene 3 Chillen"

when

Item Scene received command 2.0

then

HueColorCandle1Color.sendCommand ("29,80,70")

HueColorCandle2Color.sendCommand ("29,80,70")

HueColorCandle5Color.sendCommand ("29,80,70")

end

All three versions did not work… any ideas ?

I haven’t tried again, but I’m on stable release, so not sure KNX binding has updates (I still use legacy KNX binding also). Let me know if more recent versions do fix some of the above issues.

cheers
phil

I am on the latest snapshot, so obvisously there hasn’t been any fixes :frowning:

i would think there should be some changes in the knx binding of the latest snapshot releases, no?

Nothing I would have noticed (haven’t searched for changes in the documentation). My workaround so far ist to have rules duplicated like this (Szene 1 is triggerd when using the sitemap, Szene 1a is triggerd when received from the KNX bus):


rule "Szene 1 Guten Morgen"

when

Item Scene received update 0

then

HueColorCandle1Color.sendCommand ("30,64,80")

HueColorCandle2Color.sendCommand ("30,64,80")

HueColorCandle5Color.sendCommand ("30,64,80")

end

rule "Szene 1a Guten Morgen"

when

Item Scene received update 0.0

then

HueColorCandle1Color.sendCommand ("30,64,80")

HueColorCandle2Color.sendCommand ("30,64,80")

HueColorCandle5Color.sendCommand ("30,64,80")

end

I am sure there are more elegant ways to code this, but I am not a developer, so this works for me for the time being…

Sure.

Use a less special trigger and use the state:

rule "Szene 1 Guten Morgen"
when
    Item Scene received update
then
    var Number iScene
    if(!(Scene.state instanceof Number)) return;
    iScene = (Scene.state as Number).intValue
    switch (iScene) {
        case 0: {
            // Scene 0
        }
        case 1: {
            // Scene 1
        }
        case 2: {
            // Scene 2
        }
    }
end

Cool, thanks a lot!

@Udo_Hartmann: do you know by any chance if the x.0 still exists for dpt 5.010, 20.102 etc. I‘m always getting errors in the log, when trying to map the values, when System trying to send back values etc.

Thanks in advance for some hints

Best regards
Rolf

Same question here, in a live environment i’m still on knx 1.13

In knx 2.4 if using DPT 17.001, does it still show as a x.0 number or integer?