Help: Gauge with small floating point value

I’ve successfully setup openhab5 and configured a model, some things (smartmeter and lambda heat pump) and created a nice overview page with gauges. All this works smoothly.

I want to connect a sensor.community air quality sensor. I found the binding and successfully configured it. The values of the sensor are in the µg/m³ range. They are displayed correct, with correct unit, and they are stored in the database as ‘0.0000xx’ which is correct as well.

I also added gauges at the overview page, but am stuck with a problem.

It seems the min/max of the gauge are only integer values, so I cannot enter e.g. ‘0.000500’ which would be the correct value for max. The smallest possible value is 1, which is obviously far too large here.

I am aware that one can apply transformations/scaling to values, but then I would loose the correct values/units I already have, wouldn’t I?

What is the correct way to make the gauges work?

Thank you very much for any help!

There is a page in the documentation with details about the configuration settings for all the oh widget components:

The oh-gauge page lists min and max properties. So, one solution could be to just adjust those so that the appropriately bracket your air quality values.

Another alternative is the value property of the gauge. There you could build a widget expression that transforms the state of your item into something more appropriate for the 0 - 100 range of the gauge. That’s a slightly more advanced approach but one that gets you into widget epxression which opens up a whole new level of building the UI.

1 Like

The transformation may be to just change the units. You could use ppm, ng/m³ or even pg/m³.

1 Like

Thanks, widget expressions - works like a charm :slight_smile: !

For reference, if someone else looks for this:

In the properties of gauge, entered for Value:

=items.Particulate_Sensor_Particulate_Matter_category_25.numericState*1000000000

and for Value Text:

=items.Particulate_Sensor_Particulate_Matter_category_25.displayState

What I was missing is that in the documentation for Value:

Value, if the item is not set - between min & max (for instance, defined with an expression)

this means that item can be left undefined - I thought that it means item does momentarily provide no value.