Homematic thermostat same models different apperence

I have serveral Homematic thermostats. The humidity is displayed in one as number in the other as number with unity %, altough the are the same model with the same firmeware. What could be the reason for that? I checked all entries the code definition…and found no difference.

Check the unit and state metadata of the humidity Items. I’m willing to bet the one that shows the % has one or both and the other one does not.

It’s weird! I have configured them the same way. Even after deleting two humidity items of the same models and redefining them the result ist the same.
Where can I find the unit metadata of an item?

Setting → Items → ItemName → Metdata

I can’t find anything that looks like unit there

Let’s step back.

Assuming OH 4 and all the Items are the same as these screen shots.

You have plain Number Items. (Note, please don’t just post screen shots. Click the pencil and the Code tab and post that too. Use code fences).

A plain Number Item does not carry units. It’s just a number.

What you see in MainUI and often in third party integrations and elsewhere is the label of the Item. You can define how the state of the Item appears on the UI through the label.

The label is configured through the State Description Metadata Pattern field. This field follows the same formatting as described at Items | openHAB.

To add metadata click the blue “add metadata” link. Choose State Description, and make sure the pattern includes % (e.g. %.0f %). I forget, you might need to double the % in this context (e.g. %.0f %%).

If you have Number:Dimensionless Items, the Item’s state carries the unit. In this case, at a minimum you will need to click that blue “add metadata” link and add unit with a value of %. The State Description might also need to be added if what you see in the UI isn’t exactly what you want.

This is the code of the item without %:

label: Bad oben Thermostat Luftfeuchtigkeit
type: Number
category: humidity
  - Bad_oben
  - gLuftfeuchtigkeit
  - gLuftfeuchtigkeit_Lueftungsanlage
groupType: None
function: null
  - Status
  - Humidity

and this the code of the item with %:

label: SH Thermostat Luftfeuchtigkeit
type: Number
category: Humidity
  - SH
  - gLuftfeuchtigkeit
  - gLuftfeuchtigkeit_Lueftungsanlage
groupType: None
function: null
  - Status
  - Humidity

The are both Homematic HmIP-WTH 2 devices with the same firmeware.

Is it possible to check the State Description before changing it?

Im interessted to find out why the same devices behave different when added to OH.

If it’s set it should show that.

There are cases where the binding can suggest it’s own state description but assuming the same type of device from the same binding there won’t be any difference between the Items.

Because these are just numbers, the only thing at play is the State Description.

I didn’t know that I could select the grey State Description.
Same thermostats have a State Description some not!
The pattern is either %.0f %% or %d %%
The % unit is added now in the group list, but not when the items are displayed:

I can’t even get rid of the decimals.
Is it possible to add the units to the items list and get rid of the decimals?

The Items page always only shows the raw state of the Item before being formatted by the State Description Pattern.

How do they appear on the Overview Page? If you click on an individual Item, how does the state appear at the top of that page?

On all other pages the state appears correct. Now the commas are gonne to on the items page.

Now I am getting the following error:

2023-09-23 11:45:00.894 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID 'Luftfeuchtigkeit-1' failed: Conversion = '%' in Luftfeuchtigkeit

This is the rule:

rule "Luftfeuchtigkeit Alarm"
Item gLuftfeuchtigkeit changed or
Time cron "0 */15 * ? * *"  // viertelstündlich

logInfo("Luftfeuchtigkeit Alarm", "Luftfeuchtigkeit {} ", gLuftfeuchtigkeit.state)
if (gLuftfeuchtigkeit.state >= 70){
    logInfo("Luftfeuchtigkeit Alarm", "Luftfeuchtigkeit über 70%")
    val telegramAction = getActions("telegram","telegram:telegramBot:7591589e")
    telegramAction.sendTelegram("Luftfeuchtigkeit über 70%")
else logInfo("Luftfeuchtigkeit Alarm", "Luftfeuchtigkeit {} ", gLuftfeuchtigkeit.state)


gLuftfeuchtigkeit an all of its mebers are number items, only the state description adds the % unit.
Does this cause the conversion error an how could I solve this?

Well, there’s your answer. The formatting doesn’t apply on the Items page. It’s always going to show the raw state.

It shouldn’t. Assuming OH 4, the State Description only controls how the Items state appears in MainUI. It doesn’t change the actual state of the Item.

Do you get that first log statement or does the rule completely fail? If you do get it, why not show it?

Often, you need to case the state of a Item in Rules DSL to use it in a comparison.

if(gLuftfeuchtigkeit.state as Number >= 70)

It seems that the script is running and the error comes right after.

2023-09-26 08:00:00.627 [INFO ] [.model.script.Luftfeuchtigkeit Alarm] - Luftfeuchtigkeit 71 
2023-09-26 08:00:00.628 [INFO ] [.model.script.Luftfeuchtigkeit Alarm] - Luftfeuchtigkeit über 70%
2023-09-26 08:00:00.628 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID 'Luftfeuchtigkeit-1' failed: Conversion = '%' in Luftfeuchtigkeit

if(gLuftfeuchtigkeit.state as Number >= 70)
doesn’t solve the problem

Because you get “Luftfeuchtigkeit über 70%” that means the error is in the call to telegram. Why Telegram wants to convert anything I can’t say, I don’t use Telegram. There really isn’t anything after the if statement that could cause this error. Are you sure that it’s this rule?

Your guess was right. it was the % sign in the Telegram text string. After changing it from % to Prozent the error didn’t shown up any more.
Thank you for your help.