OH3: Measurement unit and decimals not displayed for item from remote openHAB binding [SOLVED]

  • Platform information:
    • Hardware: Raspberry PI 4
    • OS: Debian 1.7, official OH3.0.0 Docker image deployed in K3S
    • Java Runtime Environment: Java 11
    • openHAB version: OH3.0.0
  • Issue of the topic:

I’ve tested to connect to my production environment running OH2.5 from my OH3 testbed using the Remote openHAB binding (really cool and useful binding :grinning: ).

I then installed the exact same binding in my production environment as in OH3 and created the exact same item for a temperature sensor on my car. In the items list both behaves the same and display both measurement unit and decimals.

But when clicking on the link to the remote openHAB item the measurement unit is not displayed and the measurement lacks decimals:

Clicking on the item created in OH3 it shows measurement unit and decimals:

Developer tools for remote openhab item shows:

So displayState shows 5, what causes that?

For the other item from OH3 it shows:

No displayState is sent from server.

If I create a page displaying the items I get the same behaviour:

I get the same behaviour when testing other temperature items from other bindings in my production environment so it seems to be isolated to items that are imported via the remote openHAB binding.

What cold cause that behaviour? Is there any w.o.?

BR,

/Janne

Click on add metadata and configure the Item state formatting (or something like that) the same as it’s defined on OH 2. You can have even more control over how that card looks by defining a custom default card widget and you can have full control over it. someone’s the default isn’t that smart.

Was your items created with the new UI ?
The remote openHAB binding is not retrieving the “pattern” from the remote item. So be sure to define a “pattern” including the unit for your item in your main server.
This should be mentioned in the binding documentation.
This is not easy to enhance but you can open an enhancement request for this feature in Git.

Was your items created with the new UI ?

Yes.

This should be mentioned in the binding documentation.
This is not easy to enhance but you can open an enhancement request for this feature in Git.

OK, will do!

That did the trick:

Thanks for the tip! :slight_smile:

1 Like

I opened a feature request and will try to implement it.

2 Likes

When using the following pattern for humidity %d %% the value is displayed times 100:

So it would be gr8 to get your fix for re-using the remote item pattern formatter. :slight_smile:

It might work better with %.0f %%
%d can mess things up.

Same result:

I’d suggest you have a Number:Dimensionless type Item, but it is getting updated with just a number without units.

Yes, that is what this thread is about since I test the remote OH binding to integrate from my OH2.5.x production towards my OH3 testbed, the issue is that the OH remote binding does not handle the original remote item patterns at all.

In my production environment this items is defined as:

Number Oregon_Outdoor_Humidity_Front "Oregon Front Humidity [%d %%]" <humidity> {channel="tellstick:sensor:1:15_F824_oregon:humidity"}

and their it displays the humidity correctly in a sitemap:

image

But when I use the same item via remote OH binding and set the same pattern in metadata, since it is not handled by the binding, the value is displayed * 100.

But that is not a Quantity type Item. It has no units, though you can specify a bit of text to be shown in display with it, like %.
You can’t map that to a Number:Dimensionless type Item because its value, its raw state, has no units.
Or rather you can, because Dimensionless is the one Quantity type that accepts a number with no units, but you won’t get the value you expect.

Yes, of course, the same item type has to be used. I will not change that because I can’t.
What I would like to provide by default is the same pattern formatter and this will work if you use the same item type.

You are correct, changing to:

Number:Dimensionless Oregon_Outdoor_Humidity_Front "Oregon Front Humidity [%d %%]" <humidity> {channel="tellstick:sensor:1:15_F824_oregon:humidity"}

and using metadata pattern %d %% or %d %unit% then gives correct result.

But you still need to configure the metadata pattern to get correct unit, hopefully that will work out of the box with the proposed fix.

1 Like

The feature is now implemented:

2 Likes

The PR is now merged and should be included in next snapshot tomorrow morning.

1 Like