Comparing Number Items using percentage with character "%" [Deconz]


i am currently programing a rule which involves comparing a humidity sensor reading optained from the Deconz binding to a threshold.

Logging the Item state with

logInfo("Info", deconz_humiditysensor_414706f1_humidity)

yields the following output

deconz_humiditysensor_414706f1_humidity (Type=NumberItem, State=58.36 %, Label=Humidity, Category=null)

The problem i am facing is, that comparing the item state against a threshold does not work, due to the appended “%” character in the state of the item.
E.g. the following does not work:

     // do this
    // do that

The workaround i have found looks like this:

val DecimalType humidityThresh= new DecimalType(90) 
var DecimalType sensorReading = new DecimalType(deconz_humiditysensor_414706f1_humidity.state.toString().replace("%","").replace(" ",""));
if(sensorReading >=humidityThresh)
     // do this
    // do that

Those skilled in the art of openhab rule making surely know a simpler way, right?

Welcome to UoM, units of measurement.

Extract the numeric value

if ( (deconz_humiditysensor_414706f1_humidity.state as QuantityType<Number>).doubleValue >= 90) {

or I think to compare in units

if ( deconz_humiditysensor_414706f1_humidity.state >= 90 | "%" ) {

Thank your for the quick answer.
Is there any guide or docu describing how to use QuantityType(s) within rule scripts in gerneral.
Did a quick search and couldn’t find any!