Transform rain forecast value

Hi,

i am a bloody beginner of OH and love the Paper UI. It’s easy to work with.

I have 1 issue that I cannot sort out:

  1. I get the required weather information (rain forecast) in 0.00 mm
  2. I setup a rule if rain forecast is > 0.01 turn off a device

But as the string of rain forecast incl. “mm”, the rule does not work.
Is there an easy way to transform the string through Paper UI?

So “0.02 mm” to “0.02”

Please help. I am totally lost :frowning:

Thanks!
Chris

Tell us about your Item definition, is it string or a number or number with units?
Then we can help with handling it.

it says

openweathermap:weather-and-forecast:eed549e5:local:forecastHours03#rain

Number:Length

and return something like “0.02 mm”

How does your Rule looks like ?

EDIT:

To make a comparision, try the Rule-Example below:

rule "Rain warning"

when
    Item localHourlyForecast3RainVolume changed

then
    if(localHourlyForecast3RainVolume.state >0.01 | "mm") {
       logInfo("RainVolume","RainVolume with Pattern: " + localHourlyForecast3RainVolume)
     } // works
     if( (localHourlyForecast3RainVolume.state as Number).floatValue > 0.01) {
       logInfo("RainVolume","RainVolume as Float for comparison: " + localHourlyForecast3RainVolume)
     } // works
     var vRainVol = (localHourlyForecast3RainVolume.state as Number).floatValue
     if( vRainVol > 4) {
       logInfo("RainVolume","RainVolume with changed Variable: " + vRainVol)
     } // works
end

This example shows you three ways to compare a fixed value against an UOM-Item (Quantity-Type). Pls. have a look here.
Cheers
Peter