Gardena smart sensor - Weird number format ("one") of soil humidity sensor

Platform information:

  • Hardware: Raspi 3
  • OS: Raspian OS 10
  • openHAB version: 3.1.0 Release Build running on Docker 2.6.2
  • Bindings: Homematic Binding for CCU 2 (controlling lights via Alexa, logging the heating), Gardena Binding for Gardena Gateway / smart irrigation control (logging soil humidity), Alexa Binding (controlling the Homematic lights)

While I’m pretty happy the way the Gardena binding is working on my openHAB (primarily: logging the soil moisture and valve status; the actual irrigation is done by the Gardena smart irrigation control directly), the way the values are formatted in openHAB is pretty irritating:

While the battery level of the sensor looks perfectly fine


… and the graph also looks the way it should (ignore the fact that there’s not much data inside)…

… the soil humidity just looks odd (with the “one”-string at the end)…


… and the y-axis label looks weird (with the “%unit”):

I did read through the “transformation-chapter” in the tutorial (Transformations | openHAB), but since I have to substract a " one"-string from a string, convert it to a number and add a " %" I’m a bit puzzled on how to do that.

Anyone with the same problem / anyone can give directions? Specifically:

  • How to convert " one" to " %"?
  • How to change the y-axis-label in the graph “%unit%” to “%”?

Thanks a lot!

‘one’ is a unit of a Number:Dimensionless in openHAB. If you post ‘50’ to Number:Dimensionless type, it will be interpreted as a ratio ‘50-to-1’ (hence the ‘one’. If you post ‘50%’ to a Number:Dimensionless you get 50%.

Okay, the difference here is that your Item is a plain Number type.

What you need to know to sort all this out are the types of the channels that you have linked to these Items. You should link these to matching Item types.

If your Gardena channel is just a number, you can link that to just a Number Item, and add a decorative % symbol to the presentation.
Or you can massage the plain number data from the channel with a profile to add a % symbol to the update, link to a ‘real’ Number:Dimensionless Item.

Thanks, this did the trick! :slight_smile:

For this one…

… I had to read through https://www.openhab.org/docs/concepts/units-of-measurement.html and play around a bit, but at the end “Add Metadata → State Description” and %.0f %% as the pattern works as intended. :slight_smile:

Thanks for your help!

@rossko57, quick follow-up question: I noticed that, after implementing the change mentioned above, the formatting of the number is perfect…
image

… and also the detailed graph when clicking on the tile is the way it should be…

… but I noticed that the “preview-graph” in the cell itself does not appear anymore (compare left and right tile)…
image

I did compare the yaml-code of the two cells, and they’re identical. Since the “preview graph” did work before I implemented the formatting above, I assume it has to do with that?

component: oh-label-cell
config:
  trendItem: Feuchtigkeitssensor_Blumen_SoilHumidity
  action: analyzer
  actionAnalyzerItems:
    - Feuchtigkeitssensor_Blumen_SoilHumidity
  item: Feuchtigkeitssensor_Blumen_SoilHumidity
  stateAsHeader: true
  expandable: false
  icon: oh:lawnmower
  header: Blumen

Is there a way to have the formating correct and the “preview-graph” working?

Don’t ask me, know nothing about the UI. I throw it open.

You may wish to confirm what ‘this’ you did before exactly, what type of Item have you ended up with here?