How to display valve level of HmIP-eTRV-2 in percent

The valve level of the HM-CC-RT-DN thermocontroller is being displayed in percent. The valve level of the HmIP-eTRV-2 is a fraction of 1, i. e. percent divided by 100.

Is there any easy way to instruct Openhab in the items file to show the value with a factor of 100, so that it is percent again ?

Number Salon_Hzg2_VALVE
    "Salon Hzg2 Ventil [%d %%]"
    <heating>
    (gSalon_Hzg2)
    {channel="homematic:HmIP-eTRV-2:xxxxxxxxx:yyyyyyyyyyyyy:1#LEVEL"}

The above only shows 0 %.

Thanks - Martin

The generic way to represent a ratio in openHAB would be a Number:Dimensionless type Item.
(Dimmer types too, but that’s special purpose and not really a good fit here.)

You can (a binding channel can) update a Number:Dimensionless Item state with a numeric with no units, that is assumed to be a ratio “X-to-1”. Which sounds like you are describing the Homematic input as?
The Items state can then be displayed in any ‘ratio’ units you like - %, dB, ppm, etc., using the Item’s properties.
so, 0.1 auto-converts to 10%

A transformation profile on the link between binding channel and Item can massage the update value (e.g. multiply by 100 and add a % unit) but I don’t think that is required here.

1 Like

Hmmm, Dimmer works correctly except that I don’t want the slider to show up. Any way to get rid of that ?

If I set Number:Dimensionless I see the same as before (0%).

My item files are not only used for basic definition but also for display in an admin sitemap. The admin sitemap only defines groups of items, so I cannot modify the individual item control here (a 45 x 10 items sitemap just for my heating controllers is too much effort).

As I said, Dimmer isn’t really suitable here. If you want to display it in a different widget, then do so; exactly how depends on the UI in use.

It won’t change until the next update from the device. The auto-convert takes place at the update.
You would need to be getting a plain number from your channel, in a form like “0.1”
And you would need to set the Item’s default unit to percent, which it looks like you may have already done.

if your Item is defined from xxx.items file (GUI defined Items would need to use metadata, but I think the old fashioned way works in the file case)

I don’t know what that means.

When I change the type from Dimmer to Number:Dimensionless (nothing else changed) and save the items file I get the following events:

2022-09-24 20:19:08.176 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Salon_Hzg1_VALVE' changed from NULL to 5 %
2022-09-24 20:19:08.176 [INFO ] [openhab.event.ItemUpdatedEvent      ] - Item 'Salon_Hzg1_VALVE' has been updated.
2022-09-24 20:19:08.192 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Salon_Hzg1_VALVE' changed from 5 % to 0.05 %

and I see 0 % in my display (Basic UI).

I have got a HmIP-eTRV-C2 which probably works similar. I have defined everything in Main UI. The item is defined as Number:Dimensionless. With this definition I had the same problem and instead of 95 % the displayed value was 0,95 % (I think the reason for this problem is that the CCU returns differently for HM an HMIP devices).

I found a solution for this problem by defining a profile for the channel with “Multiply by 1”:
image

Sounds a bit strange, but it works.

1 Like

Any idea how to do it in an items file ?

Unfortunately this profile is not document :frowning: here: Transformations / Profiles | openHAB

Maybe something like this could work:

item (channel="xxx" [profile="multiply", multiplicand="1"])

Maybe you can also use the offset profile (this is document) with an offset of 0

Guessing this is some subtle effect of linking a number type channel to a Quantity type Item. The “null-transform” actually converts a pure numeric into a quantity value, number-with-unit, even when the unit remains null.
In the special case of Dimensionless a null unit is a valid unit (ratio).
But plain number direct from the channel is not quite the same as quantity type with no unit from the quantity-aware profile, and a different conversion path is followed.

Reflecting on what is “supposed” to happen, it makes sense. If we were to link a channel with numeric update say 0.7 to a Number:Power with kWh units, we’d get 0.7kWH. Linking the same channel to another Number:Power with W units, we’d get 0.7W. i.e. No conversion taks place, no starting units.

Ah, sitemaps in use then.
The Group widget in sitemaps is quite limited; if you let it show the Group members subpage by default you get each member with its default widget by type e.g. Dimmer Item displays with slider.
No choices; neither can you change colours or even the display order of members.

That’s great for a quick test, but not much use for a finished user-facing page, so most people move on to configuring the manual way

Group item=myGroup {
   Text item=myDimmer
   Switch item = mySwitch
}

Now you have full control, but you have to specify every widget. At least you can order them, exclude some members, even show non-members; but no auto member action.

That’s quite some effort which I do for the user display (= sitemap). My admin display (sitemap) shows all items for all things grouped by room / floor or building. Since this admin display is quite populated I prefer to define all items in the item files. My admin sitemap simply defines the order of rooms to be displayed. When everything is defined correctly in the item files the effort for the sitemap is very small. That’s why I want to concentrate on the items - not on the sitemap.

Tried this:

Number:Dimensionless Salon_Hzg1_VALVE
    "Salon Hzg1 Ventil [%d %%]"
    <heating>
    (gSalon_Hzg1)
    {channel="homematic:HmIP-eTRV-2:xxxxx:yyyyyyyyyyy:1#LEVEL" [profile="offset", offset="2"]

which did not seem to have any effect, not even the offset.

Tried the “multiply” profile as well - using a multiplicand of 1 and 100. No effect either.

All this stuff is very version dependent. Can we establish your openHAB version, please?

OH 3.3.0 on a debian x64 machine

Tried this after reading the documentation:

Number:Dimensionless Salon_Hzg1_VALVE
    "Salon Hzg1 Ventil [%d %%]"
    <heating>
    (gSalon_Hzg1)
    {channel="homematic:HmIP-eTRV-2:xxxx:yyyyyyyy:1#LEVEL" [profile="system:offset", offset=-0.1]}

This didn’t have ANY effect either. I’m stuck

I’m not convinced this text defined Item ends up with an effective default unit.

For experiment, create a new Item (different name of course). Assign % unit in metadata state presentation stuff. Link to homematic channel (it is okay to link multiple Items to any channel).

Thanks for your input. I stay with the dimmer setting for the time being, as proposed by the binding. It shows the stupid slider but everything else is as I want it.

You can change the default widget for each Item, as I understand it.