Float values received from KNX 9.0001 - shown with many decimal places

I found some topics about this in KNX user forum, but no real idea how to solve globally.
Can somebody tell me how to handle DPT 9.001 temperature values coming from KNX nicely?

I need to use state description everywhere, but would like to rather have the rounded value in the number item itself.

e.g. channel definion

  - id: EG_Buero_Temperaturmesswert
    channelTypeUID: knx:number
    label: EG Büro Temperaturmesswert
    description: null
    configuration:
      ga: 9.001:<4/1/20


In the thirdparty smarthome-j marketplace there is a rounding profile that can round values before they get to the Item. You could also use a JS Transformation to do the same.

In neither case will it be easier than setting the State Description metadata though. You’ll have to do it one Item at a time.

It actually show up with many zeroes in the ui.
image

I would need to format there again.

Here an example from another room where I used state description as well:

              - component: oh-slider-cell
                config:
                  footer: ="Istwert " +
                    items["KNXTemperaturen_OGAnkleideTemperaturmesswert"].state
                  icon: oh:temperature
                  item: KNXHeizaktor_OGAnkleideHeizen
                  label: true
                  max: 24
                  min: 18
                  releaseOnly: true
                  scale: true
                  scaleSteps: 1
                  scaleSubSteps: 2
                  step: 0.5
                  subtitle: ="Sollwert " + items["KNXHeizaktor_OGAnkleideHeizen"].state
                  title: Ankleide
                  unit: ="°C"
                  vertical: 0

I might check the rouding profile or JS transformation.

You need to use .displayState instead of .state in your widgets to get the transformed version defined by the state description pattern.

items["KNXTemperaturen_OGAnkleideTemperaturmesswert"].displayState

Thank you, now I can peacefully go to bed for today :smiley:

I have another problem with state description.

When I use “displayState” and in State description pattern “%.1f %unit%” or “%.1f °C” it will show up as “undefined” for >some< items.

If I remove the “°” it will work, e.g. “”%.1f C". What the hack?

Is there a pattern for the Items that are showing as undefined? Are plain Numbers without units (for example)?

Yes, thank you for helping with my beginner questions.

The pattern for the undefined is same as for those which are shown.
If I change the item type to “basic Number” (without dimension) it would work as well. Is this the solution?

Not necessarily. Just trying to figure out what’s different about the Items that don’t work compared to the Items that do work.

When you removed the ° you ended up with an invalid unit. The fact that it worked in that case could have been because your Item didn’t have units in the first place. But if they have units that’s not the difference.

People have in the past run into problems trying to use the “wrong” symbol character, take care to use the correct “°”, copy-paste from a good example if necessary.

somehow I need to put two spaces in state description.
This was the difference between the working and not working.

Now I put everywhere two spaces “%.1f °C” and it works.
The funny thing is that it is displayed with one space on the page.

So I’m fine :wink:

config:
  label: Temperaturen / Luftfeuchte
  layoutType: responsive
  sidebar: true
blocks:
  - component: oh-block
    config: {}
    slots:
      default:
        - component: oh-grid-cells
          config: {}
          slots:
            default:
              - component: oh-cell
                config:
                  action: toggle
                  actionCommand: ON
                  actionCommandAlt: OFF
                  actionItem: KNXHeizaktor_Heizen1Kuhlen0
                  color: "=(items.KNXHeizaktor_Heizen1Kuhlen0.displayState == 'ON') ? 'red' :
                    'blue'"
                  header: Kühlen / Heizen
                  icon: "=(items.KNXHeizaktor_Heizen1Kuhlen0.displayState == 'ON') ? 'oh:fire' :
                    'oh:snow'"
                  item: KNXHeizaktor_Heizen1Kuhlen0
                  on: true
                  stateAsHeader: true
                  title: "=(items.KNXHeizaktor_Heizen1Kuhlen0.displayState == 'ON') ? 'Heizen' :
                    'Kühlen'"
  - component: oh-block
    config:
      title: Erdgeschoss
    slots:
      default:
        - component: oh-grid-cells
          config: {}
          slots:
            default:
              - component: oh-slider-cell
                config:
                  footer: ="Istwert " +
                    items["KNXTemperaturen_EGAbstellTemperaturmesswert"].displayState
                  icon: oh:temperature
                  item: Heizaktor_EGAbstellHeizen
                  label: true
                  max: 24
                  min: 18
                  releaseOnly: true
                  scale: true
                  scaleSteps: 1
                  scaleSubSteps: 2
                  step: 0.5
                  subtitle: ="Sollwert " + items["Heizaktor_EGAbstellHeizen"].displayState
                  title: Abstellraum
                  unit: ="°C"
                  vertical: 0
              - component: oh-slider-cell
                config:
                  footer: ="Istwert " +
                    items["KNXTemperaturen_EGGastebadTemperaturmesswert"].displayState
                  icon: oh:temperature
                  item: KNXHeizaktor_EGGastebadHeizen
                  label: true
                  max: 24
                  min: 18
                  releaseOnly: true
                  scale: true
                  scaleSteps: 1
                  scaleSubSteps: 2
                  step: 0.5
                  subtitle: ="Sollwert " + items["KNXHeizaktor_EGGastebadHeizen"].displayState
                  title: Gästebad
                  unit: ="°C"
                  vertical: 0
              - component: oh-slider-cell
                config:
                  footer: ="Istwert " +
                    items["KNXTemperaturen_EGBuroTemperaturmesswert"].displayState
                  icon: oh:temperature
                  item: KNXHeizaktor_EGBuroHeizen
                  label: true
                  max: 24
                  min: 18
                  releaseOnly: true
                  scale: true
                  scaleSteps: 1
                  scaleSubSteps: 2
                  step: 0.5
                  subtitle: ="Sollwert " + items["KNXHeizaktor_EGBuroHeizen"].displayState
                  title: Büro
                  unit: ="°C"
                  vertical: 0
              - component: oh-slider-cell
                config:
                  footer: ="Istwert " +
                    items["KNXTemperaturen_EGWohnenTemperaturmesswert"].displayState
                  icon: oh:temperature
                  item: KNXHeizaktor_EGWohnenHeizen
                  label: true
                  max: 24
                  min: 18
                  releaseOnly: true
                  scale: true
                  scaleSteps: 1
                  scaleSubSteps: 2
                  step: 0.5
                  subtitle: ="Sollwert " + items["KNXHeizaktor_EGWohnenHeizen"].displayState
                  title: Wohnen
                  unit: ="°C"
                  vertical: 0
              - component: oh-slider-cell
                config:
                  footer: ="Istwert " +
                    items["KNXTemperaturen_EGKucheTemperaturmesswert"].displayState
                  icon: oh:temperature
                  item: KNXHeizaktor_EGKucheHeizen
                  label: true
                  max: 24
                  min: 18
                  releaseOnly: true
                  scale: true
                  scaleSteps: 1
                  scaleSubSteps: 2
                  step: 0.5
                  subtitle: ="Sollwert " + items["KNXHeizaktor_EGKucheHeizen"].displayState
                  title: Küche
                  unit: ="°C"
                  vertical: 0
              - component: oh-slider-cell
                config:
                  footer: ="Istwert " +
                    items["KNXTemperaturen_EGWindfangTemperaturmesswert"].displayState
                  icon: oh:temperature
                  item: KNXHeizaktor_EGWindfangHeizen
                  label: true
                  max: 24
                  min: 18
                  releaseOnly: true
                  scale: true
                  scaleSteps: 1
                  scaleSubSteps: 2
                  step: 0.5
                  subtitle: ="Sollwert " + items["KNXHeizaktor_EGWindfangHeizen"].displayState
                  title: Windfang
                  unit: ="°C"
                  vertical: 0
              - component: oh-cell
                config:
                  header: Flur
                  icon: oh:temperature
                  subtitle: ="Istwert " +
                    items["KNXTemperaturen_EGFlurTemperaturmesswert"].displayState
                  title: Sollwert n/a
  - component: oh-block
    config:
      title: Obergeschoss
    slots:
      default:
        - component: oh-grid-cells
          config: {}
          slots:
            default:
              - component: oh-slider-cell
                config:
                  footer: ="Istwert " +
                    items["KNXTemperaturen_OGBadTemperaturmesswert"].displayState
                  icon: oh:temperature
                  item: KNXHeizaktor_OGBadHeizen
                  label: true
                  max: 24
                  min: 18
                  releaseOnly: true
                  scale: true
                  scaleSteps: 1
                  scaleSubSteps: 2
                  step: 0.5
                  subtitle: ="Sollwert " + items["KNXHeizaktor_OGBadHeizen"].displayState
                  title: Bad
                  unit: ="°C"
                  vertical: 0
              - component: oh-slider-cell
                config:
                  footer: ="Istwert " +
                    items["KNXTemperaturen_OGAnkleideTemperaturmesswert"].displayState
                  icon: oh:temperature
                  item: KNXHeizaktor_OGAnkleideHeizen
                  label: true
                  max: 24
                  min: 18
                  releaseOnly: true
                  scale: true
                  scaleSteps: 1
                  scaleSubSteps: 2
                  step: 0.5
                  subtitle: ="Sollwert " + items["KNXHeizaktor_OGAnkleideHeizen"].displayState
                  title: Ankleide
                  unit: ="°C"
                  vertical: 0
              - component: oh-slider-cell
                config:
                  footer: ="Istwert " +
                    items["KNXTemperaturen_OGSchlafenTemperaturmesswert"].displayState
                  icon: oh:temperature
                  item: KNXHeizaktor_OGSchlafenHeizen
                  label: true
                  max: 24
                  min: 18
                  releaseOnly: true
                  scale: true
                  scaleSteps: 1
                  scaleSubSteps: 2
                  step: 0.5
                  subtitle: ="Sollwert " + items["KNXHeizaktor_OGSchlafenHeizen"].displayState
                  title: Schlafen
                  unit: ="°C"
                  vertical: 0
              - component: oh-slider-cell
                config:
                  footer: ="Istwert " +
                    items["KNXTemperaturen_OGKindOstTemperaturmesswert"].displayState
                  icon: oh:temperature
                  item: KNXHeizaktor_OGKindOstHeizen
                  label: true
                  max: 24
                  min: 18
                  releaseOnly: true
                  scale: true
                  scaleSteps: 1
                  scaleSubSteps: 2
                  step: 0.5
                  subtitle: ="Sollwert " + items["KNXHeizaktor_OGKindOstHeizen"].displayState
                  title: Kind Ost
                  unit: ="°C"
                  vertical: 0
              - component: oh-slider-cell
                config:
                  footer: ="Istwert " +
                    items["KNXTemperaturen_OGHWRTemperaturmesswert"].displayState
                  icon: oh:temperature
                  item: KNXHeizaktor_OGHWRHeizen
                  label: true
                  max: 24
                  min: 18
                  releaseOnly: true
                  scale: true
                  scaleSteps: 1
                  scaleSubSteps: 2
                  step: 0.5
                  subtitle: ="Sollwert " + items["KNXHeizaktor_OGHWRHeizen"].displayState
                  title: HWR
                  unit: ="°C"
                  vertical: 0
              - component: oh-slider-cell
                config:
                  footer: ="Istwert " +
                    items["KNXTemperaturen_OGKindWestTemperaturmesswert"].displayState
                  icon: oh:temperature
                  item: KNXHeizaktor_OGKindWestHeizen
                  label: true
                  max: 24
                  min: 18
                  releaseOnly: true
                  scale: true
                  scaleSteps: 1
                  scaleSubSteps: 2
                  step: 0.5
                  subtitle: ="Sollwert " + items["KNXHeizaktor_OGKindWestHeizen"].displayState
                  title: Kind West
                  unit: ="°C"
                  vertical: 0
              - component: oh-cell
                config:
                  header: Flur
                  subtitle: ="Istwert " +
                    items["KNXTemperaturen_OGFlurTemperaturmesswert"].displayState
                  title: Sollwert n/a
  - component: oh-block
    config:
      title: Luftfeuchtigkeit
    slots:
      default:
        - component: oh-grid-cells
          config: {}
          slots:
            default:
              - component: oh-label-cell
                config:
                  header: Luftfeuchtigkeit Büro
                  icon: oh:humidity
                  item: KNXMesswerteTemperaturLuftfeuchtigkeit_EGBuroLuftfeuchtigkeit
              - component: oh-label-cell
                config:
                  header: Luftfeuchtigkeit Wohnen
                  icon: oh:humidity
                  item: KNXMesswerteTemperaturLuftfeuchtigkeit_EGWohnenLuftfeuchtigkeit
              - component: oh-label-cell
                config:
                  header: Luftfeuchtigkeit Schlafen
                  icon: oh:humidity
                  item: KNXMesswerteTemperaturLuftfeuchtigkeit_OGSchlafenLuftfeuchtigkeit
masonry: null
grid: []
canvas: null

1 Like

This is smelling of some kind of bug. It should work with no space characters “%.1f°C”, let alone one space.
I suspect this might be at the widget, more than server end.