Number:Illuminance got unit °C?

Hey everyone!

After migrating from 3.4.5 to 4.0.2 I get the following warning in the logs:

2023-09-06 22:02:23.335 [WARN ] [penhab.core.library.items.NumberItem] - Failed to update item ‘PrasenzmelderGastebad_PMGastebadHelligkeit’ because ‘0 °C’ could not be converted to the item unit ‘lx’

Converting °C to Lux is indeed quite a task.

If I have a look at the item, it looks like this:

Should “Type” = Number:Illuminance set the item’s unit to lx instead of °C?

The item does have a state description:


If I remove the state description the warning is gone but the item does only show the number and not “Lux” anymore.

Where does the °C come from?
How can I get the “Lux” after the number if not by using the state description?

Please don’t post screen shots where a code tab is available. Click to edit the Item and you’ll see a code tab. Paste the YAML you find there. Use code fences.

```
code goes here
```

Yes, that tells OH that the units that Item accepts are those that represent illuminance which, in that specific case is only Lux. Note, the actual unit is lx not Lux.

The state description only changes how the Item is shown. The actual Item’s unit is controlled by the unit metadata (see the breaking changes for OH 4) or, if not defined at all, the system default which depends on your locale. Given illuminance only has one unit, lx should be the unit assumed.

What is updating this Item? Does it include °C as the unit? If an Item with a unit gets updated with a state with a unit, OH will try to convert from the sent unit to the unit carried by the Item.

I found the “reason”.

The item is updated by a channel (knx binding). The knx device is set to the correct DPT, i.e. 9.004


However, if the knx device within openhab is not explicitely set to 9.001 as well, it will interpret the received value as °C, which is 9.001 within KNX.



Administration

Things
Loading...

    Label of the thing
    status badge
    This contains the thing UID
    Label of the thing
    status badge
    This contains the thing UID
    Label of the thing
    status badge
    This contains the thing UID
    Label of the thing
    status badge
    This contains the thing UID
    Label of the thing
    status badge
    This contains the thing UID
    Label of the thing
    status badge
    This contains the thing UID
    Label of the thing
    status badge
    This contains the thing UID
    Label of the thing
    status badge
    This contains the thing UID
    Label of the thing
    status badge
    This contains the thing UID
    Label of the thing
    status badge
    This contains the thing UID

Präsenzmelder Gästebad
1

UID: knx:device:e016ef5bd9:c74c558dda

2

label: Präsenzmelder Gästebad

3

thingTypeUID: knx:device

4

configuration:

5

  pingInterval: 600

6

  address: 1.0.90

7

  readInterval: 0

8

  fetch: true

9

bridgeUID: knx:ip:e016ef5bd9

10

location: Gästebad

11

channels:

12

  - id: PMGaestebadPraesenz1

13

    channelTypeUID: knx:switch

14

    label: Präsenz Gästebad 1

15

    description: ""

16

    configuration:

17

      ga: 6/0/0

18

  - id: PMGaestebadPraesenz3

19

    channelTypeUID: knx:switch

20

    label: Präsenz Gästebad 3

21

    description: ""

22

    configuration:

23

      ga: 6/0/2

24

  - id: PMGaestebadAlarm

25

    channelTypeUID: knx:switch

26

    label: PM Gästebad Alarm

27

    description: ""

28

    configuration:

29

      ga: 6/0/3

30

  - id: PMGaestebadTemperatur

31

    channelTypeUID: knx:number

32

    label: PM Gästebad Temperatur

33

    description: ""

34

    configuration:

35

      ga: 3/1/20

36

  - id: PMGaestebadHelligkeit

37

    channelTypeUID: knx:number

38

    label: PM Gästebad Helligkeit

39

    description: ""

40

    configuration:

41

      ga: 9.004:6/1/0

42

​


That means that I have to set an explicit DPT for all KNX channels to make sure nothing weird happens.

1 Like