Hello all
So i have a question maybe some of you can help how do you convert in openhab a 16 bit unsigned to something humanly readable ?
maybe for more inspiration i am looking at a knx group adress with dpd 7.000 from a device and basically that is a temperature sensor reading right now i am getting a value of 0016 in ets monitor wich is 16 degree i believe but if i use lets say 7.001 i get 22 pulses
please tell us, how you connected your KNX bus with openHAB - and what version and platform you use with openHAB
the way to go is the KNX binding, which does all this ootb:
The device itās on a knx tp line passing trought a knx router all is fine there. I have no problem reading it in openhab but I only get 0.2 if I use a 9.001:0/0/1 number in openhab
your configuration
** KNX things
** KNX channels
** KNX items
at least for that specific GA.
my 2cents: youāre on OH3.4+ and you have to consider the default UoM introduced in 3.4. but to verify and help you, we need your config obviously. otherwise itās just a shot in the dark.,
Type number : temperature "temperature" [ ga="7.000:<13/0/8" ]
Number:Temperature temperature "Sauna temperature [%.1f °C]" <temperature> (g_temoerature) ["Measurement","Temperature"] {channel="knx:device:general:general:temperature}
At least these:
Whatās your KNX device connecting the KNX bus to openHAB? How is your KNX bridge configured?
Do other KNX devices work as they should?
Whatās running on your openHAB server in parallel to openHAB?
Its a simple question how to read a 7.yyy Wich is a 2 x 8-bit unsigned value from knx in openhab I donāt have problems with communication errors or anything wrong with network VM network cards anything environment java etc
Itās simple. You configure KNX as is and you get the correct values out of it.
If it doesnāt- it has to do something with your environment and/or configuration. But youāre not sharing it, so thereās nothing I can help you with.
I will explain one more time in ets I have a group address with dpd 7.000 that reads in the monitor 0016 as value now the knx device is not certified.
This is what the manual is saying
DATA TYPE VALUES
All of the data type values are simple unsigned whole numbers. Specific
KNX data types are not used. For example, if a 16-bit unsigned value of
20 is written in the group address for the temperature settings,
the temperature will be set at 20 °C. Specific KNX data types for
temperature are not used.
now weāre talking. It has something to do with your environment. Your device just delivers uint16 values to the KNX bus no matter what. That I did not read out of your answers.
Hint: ā0016ā in hex is not 16 but 22 in integer.
And your question has nothing to do with KNX in the first place. The best way is to use a JS-transformation within your item-definition:
create a .js file in your transform folder containing the transformation from uint16 to decimal
ad 1)
converting hex2int is a simple parseInt with the first argument being your value and the second being ā16ā (for base 16) and this should do:
(function(inputValue) {
const integer = parseInt(inputValue, 16); // converting uint16 to dec
if (isNaN(integer)) {return 0; } // in case the conversion didn't work
return integer;
})(input)
ad 2)
just add the transformation to your item definition
Number:Temperature temperature "Sauna temperature [%.1f °C]" <temperature> (g_temoerature) ["Measurement","Temperature"] {channel="knx:device:general:general:temperature"[profile="transform:JS", function="<filename>"]}
oh ā¦be sure you have āJavascript Transformation Serviceā installed
i was looking at this but Calimero mentions it can handle that type of dpd so thinking maybe there is a trick in knx binding to do that directly without profile transformation.
Thank you for the explanation i appreciate it also for the ambiguous questions.