Percent in items not converting

I’d have expected that numbers formated as percent in the items file would be converted (displayed as a multiple of 100). Is my expectation or something in my code wrong?

Number Heizung_Stellwert_EG_Flur		"Heizung Stellwert EG Flur [%d]"							(EG_Flur, Temperatur, Temperatur_EG)		{channel="knx:device:MDTBridge:MDT_AKH_EG:Kanal_C_stell"}
Number Heizung_Stellwert_EG_Flur_test	"Heizung Test Stellwert EG Flur [%d %%]"					(EG_Flur, Temperatur, Temperatur_EG)		{channel="knx:device:MDTBridge:MDT_AKH_EG:Kanal_C_stell"}

Heizung_Stellwert_EG_Flur delivers 1.0 (=100%) [as expected]
Heizung_Stellwert_EG_Flur_test delivers 1 % (instead of 100%)
Source KNX channel delivers a percentage which is recognized by openHAB as 1.0 (seen in log from ItemStateChangedEvent)

Am I missing something or is the conversion not working?

1 Like

The % sign is like a degrees or $, it’s just a display unit. The decimal value you give it just has the % tacked on the end, there’s no mathematical calculation as part of using that sign. Your value has to have been converted into the percentage first.

Hmm, but why is the percent value (5.001) delivered by knx2 as 1.0 and not as 100.0

1 Like

Hey Björn.

I’ve got the same problem. KNX1 binding is working well with DPT 5.001, 8bit unsigned percentage values, but KNX2 binding stores the value as a float between 0 and 1. That’s ok, but I have not found at least one pattern to show the “real” percentage value between 0 and 100.

Right now I do not know any trick to convert the value into percentage values. It’s really annoying creating rules or lambdas for that purpose, isn’t it?


Yes, definitly. That was exactly the purpose of my question. I try to avoid rules for tivial things wherever possible (exec binding is anoying there as well with its missing feature to return a number instead of string only)

Does KNX binding support transforms?

Thinks; if these are really dimmers, have you tried as Dimmer Item types (which understand percentages, unlike a Number)

No dimmers (for them its ok), heating power in percent

Okay, a Number Item is a Number Item and knows nothing about percentages.
You can’t put a value “1.0” into it and expect it to be recognized as meaning 100%. It’s just a number. You can choose to display it with a % symbol, but it’s still just a number.

Why KNX represents 100% as 1.0, I do not know. Question for KNX protocol -designer. It’s not unreasonable to use a fraction to express it, 0.0 - 0.5 - 1.0 instead of 0% 50% 100%. But that’s the rules of KNX and we can’t change that.

What OpenHAB provides you with is an Item type called Dimmer. This understands percentages, as well as ON/OFF. When you link that kind of Item to a KNX channel with percentages, the binding is smart enough to sort out the conversion between KNX idea of a portion and OpenHABs.

Whether the Item is really a light dimmer, or a heater, or a motor speed control is pretty irrelevant. You can label it what you like. ‘Dimmer’ is just shorthand for ‘a thing that works in a 0% to 100% range’

But why doesn’t % convert 1.0 to 100% like km/h is converted to m/s (compare here) or °C to F …

This is the heart of the issue.

Number Heizung_Stellwert_EG_Flur_test	"Heizung Test Stellwert EG Flur [%d %%]"

[%d %%] is not formatting anything as a percentage. It just says display the number with a % sign. No conversion would be carried out if you decided to display it with the word ‘percent’, or a $ sign.
The Number type Item cannot know how to do percentage conversions, For any given data source, 100% might be 1.0 , or 100 , or 255 etc.

Anyway, clearly the OH KNX binding knows what to do with percentages, as we can tell by the way it works properly with Dimmer type OH Items.
An obvious thing to do is to use a Dimmer type OH Item with a dimmer KNX channel. I guess you have some reason not to do that. What is your KNX channel device type defined as?

An alternative might be where some bindings allow the use of a transform between raw data and OH Item useful for conversions. So far as I know, KNX binding does not support transforms.

Another alternative might be to use the new-ish units of measurement feature of OH. Percentage can be assigned as a QuantityType to a Number Item.
It’s the binding that does the work of initial conversion, so you would need the
KNX-2 binding to support UoM .
I do not think the binding yet supports UoM, but it would seem like a useful feature to raise an enhancement request for.

Has anyone a solution for that? Using OH 2.4 M4 and there is no change. Also have a MDT AKH and the percentage is delivered between 0.01 and 1.00 and the KNX2 Binding does not convert this.

Hey Julian.

I ran into the same issues after migrating from KNX 1.x binding to KNX 2.x binding. As rossko57 mentioned …

[%d %%] is not formatting anything as a percentage. It just says display the number with a % sign. No conversion would be carried out if you decided to display it with the word ‘percent’, or a $ sign.
The Number type Item cannot know how to do percentage conversions, For any given data source, 100% might be 1.0 , or 100 , or 255 etc

It looks to me, like any relative value, KNX DPT 5.x, will be processed as values between 0.00 and 1.00, All of my MDT actors relative values are represented that way running KNX 2.x binding: Heating actors, rollershutters, dimmers, etc.

The openHAB sitemap elements are running as expected without any changes. If you really have to show percentage values as numbers from 0 up 100, I guess, you’ll have to write down some rules for the items’ values you want to convert. I’d do so with lambdas for converting values from 0.00 up 1.00 to 0 up to 100 and vice versa.

But to be honest: Where do I have to show percentage values as numbers? For UIs I decided to show gauges or graphs, right? So I just had to modify my Graphana panels to show the information as expected. That was quite easy.

I’ll let you know if I find out any other solution, ok?

Best Regards.

Hm, DPT 5.001 is defined as Percentage, so I would expect the binding to pass the value in the correct format to OH, so that it receives a percentage value and not a fraction (decimal).

As there are other Posts available, reporting Problems with passing values to DPT 5.001, maybe there is actually some minor bug in the binding? I have created an issue on Github (, maybe somebody from the Magician Team (aka developers :-)) can have a look?

Do you have already a solution for it?
-> I use now OH 3.0 but I still have the same problem…

(My percentage Values is wrong)
0.39% -> it sould be 39%
1 -> it should be 100%

With Humidity (9.007) and also the Level of a Valve “5.001”


Number         OG_Ankleide_Michi_Temp_stellwert             "OG_Ankleide_Michi_Temp_stellwert"                  <Temperatur>  (gOG_Ankleide_Michi)  ["Level", "Valve"]                     {channel="knx:device:bridge:generic:OG_Ankleide_Michi_Temp_stellwert"}
Number         OG__Luftfeuchtigkeit_Relativ   "OG__Luftfeuchtigkeit_Relativ [%.2f %%] "        <Humidity>    (gOG_Ankleide_Michi)  ["Measurement", "Humidity"]            {channel="knx:device:bridge:generic:OG_Ankleide_Michi_Luftfeuchtigkeit_Relativ"}

Here the Result:
0.39% -> it sould be 39%
1 -> it should be 100%

Using dimmer (instead of number) was the solution (/workaround) for me

1 Like

Hello to all,

I have similar behavior.

I was not able to transmit the percent of the heating valve to the knx bus with this setup.

    Thing device KnxHeizung @ "KNX" [
    ] {
        Type number        : KnxEGKuecheStellgroesse    "Heizung Küche Stellgröße"       [ ga="5.001:<0/1/16" ]

I played around and changed ga from 5.001 to 9.001 and now I was able to see the data on the bus but with two decimal digits as described above, I think this is related to KNX datatype.
This does not solved my issue

After changing everythig to a dimmer I was able to see the data in percent :

   Thing device KnxHeizung "KNX Heizung" @ "KNX" [
    ] {
        Type dimmer        : KnxEGKuecheStellgroesse    "Heizung Küche Stellgröße"       [ position="5.001:<0/1/16" ]

In my opinion the KNX binding can only transmit “ga=9.001” ?
This is working:

        Type number        : KnxEGWohnzimmerSollTemp  "Heizung WZ Soll Temperatur"            [ ga="9.001:<0/1/21" ]

Using ga=5.001 do not transmit data on the bus.

        Type number        : KnxEGWohnzimmerSollTemp  "Heizung WZ Soll Temperatur"            [ ga="5.001:<0/1/21" ]

Can somebody confirm this behavior?

Maybe this is a bug?

I tried with openhab 3.0.2 and I am experiencing the same as you.

The humidity value comes as expected from the KNX bus:

In openhab the knx.things is defined as:

Type number : Lueftung_Humidity_Extract [ ga=5.001:<30/1/31 ]

The items are defined as:
Number:Dimensionless Lueftung_Humidity_Extract "Extract [%d %%]" (gLueftung, gLueftung_Humidity) { channel="knx:device:bridge:lueftung_medium_poll:Lueftung_Humidity_Extract" }

Openhab reads in the value as float:
16:21:01.019 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Lueftung_Humidity_Extract' changed from NULL to 0.57 %

Using this YAML

component: oh-label-cell
  header: Humidity Extract
  icon: oh:temperature
  item: Lueftung_Humidity_Extract
  trendItem: Lueftung_Humidity_Extract

results in an error:
16:26:40.228 [WARN ] [se.internal.SseItemStatesEventBuilder] - Exception while formatting value '0.57 %' of item Lueftung_Humidity_Extract with format '%d %%': d != java.math.BigDecimal

When changing the item to:

Number:Dimensionless Lueftung_Humidity_Extract “Extract [%.1f %%]” (gLueftung, gLueftung_Humidity) { channel=“knx:device:bridge:lueftung_medium_poll:Lueftung_Humidity_Extract” }

The displayd value is 0.6%
How can we achieve 60% without having a rule for that?

Don’t use a Number:Dimensionless type Item. The KNX channel is of plain number type.

If you want to tag on a % or any other character to a number display, use the Item state presentation metadata.