16 bit unsigned

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

Any help ?

thanks

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

still missing:

  • your actual environment of 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.,

Ok letā€™s go

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}

Still missing your environment! :frowning:

try without the dpt, itā€™s not neccessary for temperature-readings - at least for OH3.x+ Thatā€™s why we ask for the specifics, please read here:

Ok I tried without still nothing still 0.2

###############################################################################
###############  openhab  #####################################################
###############################################################################
##        Ip = 
##   Release = Debian GNU/Linux 11 (bullseye)
##    Kernel = Linux 5.10.0-19-amd64
##  Platform = Xen HVM domU, BIOS 4.13 11/21/2022
##    Uptime = 21 day(s). 3:19:57
## CPU Usage = 4.24% avg over 10 cpu(s) (10 core(s) x 1 socket(s))
##  CPU Load = 1m: 0.84, 5m: 0.77, 15m: 0.82
##    Memory = Free: 0.87GB (12%), Used: 6.73GB (88%), Total: 7.61GB
##      Swap = Free: 0.95GB (100%), Used: 0.00GB (0%), Total: 0.95GB
##      Root = Free: 66.00GB (90%), Used: 7.27GB (10%), Total: 77.24GB
##   Updates = 0 apt updates available.
##  Sessions = 1 session(s)
## Processes = 170 running processes of 4194304 maximum processes
###############################################################################
                          _   _     _     ____   _
  ___   ___   ___   ___  | | | |   / \   | __ ) (_)  ____   ___
 / _ \ / _ \ / _ \ / _ \ | |_| |  / _ \  |  _ \ | | / _  \ / _ \
| (_) | (_) |  __/| | | ||  _  | / ___ \ | |_) )| || (_) || | | |
 \___/|  __/ \___/|_| |_||_| |_|/_/   \_\|____/ |_| \__|_||_| | |
      |_|                  openHAB 3.4.1 - Release Build

Maybe I should say that the device is not knx certified

Whatā€™s your environment?

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.

How do you read that?

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:

  1. create a .js file in your transform folder containing the transformation from uint16 to decimal
  2. insert the JS-transformation to your things-file
  3. enjoy

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

1 Like

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.

Why do you use DPT 7 in KNX for temperature? The standart is DPT 9.001. You can get a lot of problems with it not only in OH.

You try to read DPT 7 as DPT9 - so you get wrong display value. Try 7.001:0/0/1.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.