[knx2] Issue with Scene Number

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?

afaik there was no change in question of wrong interpretation as float instead of integer.

Hi,

I’m trying to get scenes from KNX working via Openhab (raspberri Pi, openHAB 2.5.0 Release Build)

things:

 Type number       : Scenes_Living_Keuken             "Scenes Living Keuken           "            [ ga="5.010:3/1/0"]  your code goes here

item:

Number   ScenesLivingKeuken                     "Scenes living keuken"                                                     {channel="knx:device:bridge:dummy:Scenes_Living_Keuken"}

sitemap:

Switch item=ScenesLivingKeuken label="Scenes gelijkvloers" mappings=[0="TV kijken", 1="Eten aan Living Tafel"]

when I select via BasicUI the scens, I receive the correct Group-adress in KNX/ETS but the datapointtype is incorrect. and KNX does not react on the info.

see extract below. first input is scenes selection from OH and no reaction on the bus. 2e line is the same scene selection from KNX/ETS

any help? how can I add the correct datapoint type?

thanks

Did you try different DPT types? like 17.001? not sure on this, I’m still on the KNX binding v1 because of this reason :slightly_smiling_face:

Yes I tried 17.001 18.001 and several other. but it seems like OH doesn’t take into account the specified DPT. in my code above I still had 5.010 as DPT. this was also one I tried but no succes

each entry from OH comes into ETS/KNX but does not trigger any reaction

I believe that’s what I struggled with 2yrs ago, when I tried to convert to KNX binding v2. It was such a cumbersome task that I stayed (until now) with binding v1. But there must be a way to get a scenenumber over to KNX I guess? I believe Udo had a way? but haven’t tried it anymore since