[knx2] Issue with Scene Number

Has anyone encountered problems with knx scene numbers?

My Thing Channel:

Type number-control         : scene1 "Lichtszene"       [ga="17.001:3/0/0"]

My Item:

Number Virtuelle_Scene1       "Lichtszene"     {channel="knx:device:bridge:Virtuell:scene1"}

If setting the scene to something by using a knx scene button, openHAB complains about wrong number format:

2018-04-26 22:51:54.352 [WARN ] [.internal.handler.DeviceThingHandler] - An error occurred on channel knx:device:bridge:Virtuell:scene1: 17.001 Scene Number: wrong value format: 3.0
tuwien.auto.calimero.KNXFormatException: 17.001 Scene Number: wrong value format: 3.0
        at tuwien.auto.calimero.dptxlator.DPTXlator.newException(DPTXlator.java:505) 

Where does the .0 come from? Do I have to configure something additional to get a Number Item which is of type Integer?

Version is openHAB 2.3.0 Build #1264

Hi Udo,

almost the same problem here.
Actually it was exactly the same, as long as I configured via textfiles as you did and got a little better by using PaperUI (dont know why).

But I also get always something like SCENENR**.0** and there is no chance in my rules to cast it to any other type like DecimalType.

With KNX1 binding same rule was still ok!

Best
Roland

OK sorry, since I cleared the cache and the tmp directory, the textfile configuration is working the same way as the config by PaperUI.

But for the scene number still no solution

Last update:

now it seems, that it is possible to cast the numbers again.

I am using

var Erdgeschossszenen_Value = (Erdgeschossszenen.state as DecimalType).intValue

to get ā€œcleanā€ scene numbers and everything works fine again.

Solution was to clean up the cache and tmp directories.

I have the same problem. Just spend whole afternoon rewriting my knx.items / knx.things files. Everything seems to work but I control most lighting in house with scenes. When I send a scenenumber from openhab nothing happens.


knx.things:

Type number : AlgemeneScene "SCENE ALGEMEEN" [ga="17.001:1/5/1"]

knx.items:

Number AlgemeneScene "SCENE ALGEMEEN" {channel="knx:device:bridge:scene:AlgemeneScene"}

Rules:

sendCommand(AlgemeneScene,9)

the last one would activate scene number 10 in knx bus on previous version. Iā€™m kinda stuck. wish I could roll back to previous version.

You can simply activate legacy 1.x bindings and use knx1 ā€¦

Thatā€™s what I found shortly after :grinning: kept my knx.things file for later hopefully and put my old knx.items file back.

Do you know if this is a bug in knx v2 and will be fixed later on?

I didnā€™t get an satisfying answer yetā€¦ But I didnā€™t raise this issue yet, as I experienced a more severe ā€œerrorā€ (well, turned out, that some optional configuration isnā€™t optional under certain circumstances, even though it was optionalā€¦)

Mmmā€¦ looks like Iā€™ll be staying on KNX v1 then for now, running OH stable version 2.3 since itā€™s a live environment, hopefully your ā€œerrorā€ gets sorted out as wellā€¦

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!